/**
* Definition for a binary tree node.
* function TreeNode(val, left, right) {
* this.val = (val===undefined ? 0 : val)
* this.left = (left===undefined ? null : left)
* this.right = (right===undefined ? null : right)
* }
*/
/**
* @param {TreeNode} root
* @return {number}
*/
var averageOfSubtree = function(root) {
let ans = 0;
function dfs(node) {
if (!node) return [0, 0]; // sum, count
const [ls, lc] = dfs(node.left);
const [rs, rc] = dfs可以。以下我建議你採用 **Windows + Codex App / Codex CLI 的全域安裝 SOP**。目標是讓所有專案都能使用 `$show-me`,並把 HumanLayer 裡偏 Claude Code/macOS 的部分改成 Codex-friendly。
Codex 官方目前會從 `$HOME/.agents/skills` 載入使用者層級 Skill;專案層則是 `<repo>/.agents/skills`。Skill 核心只需要目錄裡有 `SKILL.md`,且 frontmatter 至少包含 `name` 與 `description`。([OpenAI Developers][1])
# SOP:安裝 `humanlayer/show-me`
## 1. 先確認 Node.js
PowerShell:
```powershell
node -v
npx -v
```
目前 `skills` CLI 的套件要求 Node.js `>= 22.20.0`。([GitHub][2])
如果你的 Node 已符合可以,但要先把「版本」分成兩件事。你現在看到的 **`1.2.3` 是 `mattpocock/skills` 整個 repository / package 的版本**;目前 `package.json` 的確是 `1.2.3`。但 `grill-me`、`grill-with-docs` 個別的 `SKILL.md` **沒有自己的 semver `version:` 欄位**。([GitHub][1])
你之前是在 Codex 用 `npx skills ... --global` 這條路安裝,所以我建議以下都以 **Global Skill** 為主。
### 1. 先看 Codex 現在實際裝了哪些 Skills
在 PowerShell 執行:
```powershell
npx skills@latest list -g -a codex
```
應該會看到類似:
```text
Global Skills
grill-me
grill-with-docs
...
```
Codex 的 global skillsimpson
13
7RT
7:30
F23
B
C
E
G
K
J
F
B
E
C
fruits
second floor
one
terrase
at the restaurant
50%
global warming
hotspots
overnight
consequences
foreign students
2 hours
exam
course tutors
fat layer
killer wales
C
A
B
rising temparature
two degrees
nesting areas
breeding ice platform
food# Using HwRegChkVars to bypass requirements for Windows 11 Upgrades
## Process
1. Open Registry Editor to this key `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags`
2. Create a new _Key_ called `HwReqChk`
3. Verify/Change registry key to `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\HwReqChk`
4. Create a new **Multi-String Value** called `HwReqChkVars`
5. Enter the following values:<br>
```plaintext
SQ_SecureBootCapable=TRUE
SQ_S// Use in detail wrangle
float search_radius = chf("search_radius");
float min_dist = chf("min_dist");
int points_per_pt = chi("points_per_pt");
int max_neighbors = chi("max_neighbors");
int seed = chi("seed");
int original_npts = npoints(0);
for (int pt = 0; pt < original_npts; pt++)
{
vector P0 = point(0, "P", pt);
int near[] = nearpoints(0, P0, search_radius, max_neighbors);
// Need enough particles to define local volume
if (len(near) < 4)
continue;
for (int /**
* @param {number} n
* @return {number}
*/
var countCommas = function(n) {
// Convert n to BigInt so all math stays consistent
n = BigInt(n);
// Use BigInt for total since we accumulate BigInt values
let total = 0n;
// k represents how many commas numbers in this group have
// Group 1 → 1 comma (digits 4–6)
// Group 2 → 2 commas (digits 7–9)
// Group 3 → 3 commas (digits 10–12)
// ... up to n ≤ 10^15 → at most 4 commas
for (let k = 1n; k <= 5n; k++/**
* @param {number} n
* @return {number}
*/
var countCommas = function(n) {
// Numbers from 1 to 999 never contain commas in standard formatting.
// Starting at 1000, every number has exactly ONE comma (e.g., "1,000", "4,582").
// So we simply count how many numbers from 1000 up to n exist.
// If n < 1000, the result should be 0 - hence Math.max(0, n - 999).
return Math.max(0, n - 999);
};/**
* @param {string} s
* @return {number}
*/
var distinctSubseqII = function(s) {
const MOD = 1_000_000_007;
const last = Array(26).fill(0);
let dp = 1; // counts empty subsequence initially
for (const ch of s) {
const idx = ch.charCodeAt(0) - 97;
const newDp = (dp * 2 % MOD - last[idx] + MOD) % MOD;
last[idx] = dp;
dp = newDp;
}
return (dp - 1 + MOD) % MOD; // remove empty subsequence
};# Mermaid
### Generate PNG images
`npx @mermaid-js/mermaid-cli --scale 2.5 -i mermaid-diagram.md -o diagram.png`/**
* @param {string} s
* @param {string} t
* @return {number}
*/
var numDistinct = function(s, t) {
const m = s.length, n = t.length;
// dp[j] = number of ways to form t[0..j-1] using processed part of s
const dp = Array(n + 1).fill(0);
// Empty string t ("") can always be formed once — by deleting everything
dp[0] = 1;
// Iterate through characters of s
for (let i = 1; i <= m; i++) {
// Traverse backwards so dp[j - 1] refers to previous row's value
/**
* @param {number[]} nums
* @param {number} k
* @return {number}
*/
var firstStableIndex = function(nums, k) {
const n = nums.length;
// Build suffix min
const suffMin = Array(n);
suffMin[n - 1] = nums[n - 1];
for (let i = n - 2; i >= 0; i--) {
suffMin[i] = Math.min(suffMin[i + 1], nums[i]);
}
let prefMax = -Infinity;
for (let i = 0; i < n; i++) {
prefMax = Math.max(prefMax, nums[i]);
if (prefMax - suffMin[i] <= k) return i;
}/**
* @param {number[]} nums
* @param {number} k
* @return {number}
*/
var firstStableIndex = function(nums, k) {
const n = nums.length;
// Build prefix max
const prefixMax = Array(n);
prefixMax[0] = nums[0];
for (let i = 1; i < n; i++) {
prefixMax[i] = Math.max(prefixMax[i - 1], nums[i]);
}
// Build suffix min
const suffixMin = Array(n);
suffixMin[n - 1] = nums[n - 1];
for (let i = n - 2; i >= 0; i--) {
suffixMin[i] = Math.min(suffix<?php
// Advantage of this approach is you can design visually in the editor first
function dlrg_filter_post_content( $content, $post ) {
if ( $post->post_type === 'event' ):
// -----
$content ='';
//------
endif;
return $content;
}
add_filter( 'default_content', 'dlrg_filter_post_content', 10, 2 );/**
* @param {number[]} nums1
* @return {boolean}
*/
var uniformArray = function(nums1) {
nums1.sort((a, b) => a - b);
let smallestOdd = null;
let smallestEven = null;
for (let x of nums1) {
if (x % 2 === 1 && smallestOdd === null) smallestOdd = x;
if (x % 2 === 0 && smallestEven === null) smallestEven = x;
}
// Check possibility of all-even
let allEvenPossible = true;
for (let x of nums1) {
if (x % 2 === 1) {
// odd needs