Skip to content

Commit 78233d6

Browse files
committed
style: fix double indent and final result generation format in Pow(x,n) html and pandas notes
1 parent 081bb24 commit 78233d6

5 files changed

Lines changed: 14 additions & 24 deletions

File tree

Mathematics/Exponentiation by Squaring/leetcode/50. Pow(x, n)/Claude/README detailed.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,16 +773,15 @@ <h3>🎯 実際の計算比較</h3>
773773
function formatSteps(stepsData) {
774774
return stepsData.steps
775775
.map((step) => {
776-
const indent = ' '.repeat(step.depth);
777776
const className =
778777
step.depth === 0 ? '' : `step-indent-${Math.min(step.depth, 3)}`;
779778

780779
if (step.type === 'final') {
781780
return `<div class="final-result">${step.text}</div>`;
782781
} else if (step.type === 'result') {
783-
return `<div class="${className} step-result">${indent}${step.text}</div>`;
782+
return `<div class="${className} step-result">${step.text}</div>`;
784783
} else {
785-
return `<div class="${className}">${indent}${step.text}</div>`;
784+
return `<div class="${className}">${step.text}</div>`;
786785
}
787786
})
788787
.join('');

Mathematics/Exponentiation by Squaring/leetcode/50. Pow(x, n)/Claude/README.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,10 @@ <h2 class="text-2xl font-bold text-gray-700 border-b-2 border-indigo-400 pb-2 mb
519519
}
520520
}
521521

522-
fastPowWithSteps(x, n);
522+
const result = fastPowWithSteps(x, n);
523523
steps.push({
524524
type: 'final',
525-
text: `最終結果: ${originalX}^${originalN} = ${steps.length > 1 ? steps[steps.length - 2].text.split('=').pop().trim() : 1}`,
525+
text: `最終結果: ${originalX}^${originalN} = ${result}`,
526526
depth: 0,
527527
});
528528

SQL/Leetcode/Basic select/1179. Reformat Department Table/Claude Sonnet 4.6 Extended/Reformat_Department_Table_pandas.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def reformat_department(department: pd.DataFrame) -> pd.DataFrame:
6161
columns="month",
6262
values="revenue",
6363
aggfunc="first", # 重複行なし保証のため最軽量集計
64-
dropna=False, # preserves all-NaN columns (row preservation is handled via reindex or similar)
64+
dropna=False, # すべてNaNの列も保持する(行の保持はreindex等で対応)
6565
)
6666

6767
# ② 存在しない月列を NaN で補完し、カレンダー順に並べ替え
@@ -70,9 +70,8 @@ def reformat_department(department: pd.DataFrame) -> pd.DataFrame:
7070
# ③ 列名を仕様形式 "{Month}_Revenue" にリネーム
7171
pivoted.columns = [f"{m}_Revenue" for m in pivoted.columns]
7272

73-
# ④ index (id) を通常列に戻し、余分な列名ラベルを除去
73+
# ④ index (id) を通常列に戻す
7474
out = pivoted.reset_index()
75-
out.columns.name = None
7675

7776
return out
7877
```
@@ -97,7 +96,7 @@ def reformat_department(department: pd.DataFrame) -> pd.DataFrame:
9796

9897
- 売上なし月は `pivot_table` が自動で `NaN`(float64)を挿入する。整数列に `NaN` が混入すると `Int64`(nullable integer)への変換が必要な場合があるが、問題仕様上は `NaN` のままで許容。
9998
- `id` 列は int のまま保持される(`reset_index` 後も dtype 変化なし)。
100-
- `pivot_table``dropna=False` は preserves all-NaN columns (row preservation is handled via reindex or similar) という動作をします。列方向(すべてNaNの列)の保持に関するオプションで、全値が NaN の列も出力に残す設定です。なお、id(行)の保持は `pivot_table` ではなく、後続の `reindex` 等でインデックスを明示的に指定する必要があります。
99+
- `pivot_table``dropna=False` はすべてNaNの列も保持する(行の保持はreindex等で対応)という動作をします。列方向(すべてNaNの列)の保持に関するオプションで、全値が NaN の列も出力に残す設定です。なお、id(行)の保持は `pivot_table` ではなく、後続の `reindex` 等でインデックスを明示的に指定する必要があります。
101100

102101
---
103102

@@ -176,9 +175,8 @@ def reformat_department(department: pd.DataFrame) -> pd.DataFrame:
176175
.reindex(columns=_MONTHS) # 欠損月補完 + 列順固定: O(12)
177176
)
178177

179-
# ② id を通常列に戻す + 列名ラベルをクリア
178+
# ② id を通常列に戻す
180179
out = out.reset_index()
181-
out.columns.name = None
182180

183181
# ③ _COL_NAMESを使用して列名を一括置換
184182
out.columns = _COL_NAMES

public/Mathematics/Exponentiation by Squaring/leetcode/50. Pow(x, n)/Claude/README detailed.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,16 +773,15 @@ <h3>🎯 実際の計算比較</h3>
773773
function formatSteps(stepsData) {
774774
return stepsData.steps
775775
.map((step) => {
776-
const indent = ' '.repeat(step.depth);
777776
const className =
778777
step.depth === 0 ? '' : `step-indent-${Math.min(step.depth, 3)}`;
779778

780779
if (step.type === 'final') {
781780
return `<div class="final-result">${step.text}</div>`;
782781
} else if (step.type === 'result') {
783-
return `<div class="${className} step-result">${indent}${step.text}</div>`;
782+
return `<div class="${className} step-result">${step.text}</div>`;
784783
} else {
785-
return `<div class="${className}">${indent}${step.text}</div>`;
784+
return `<div class="${className}">${step.text}</div>`;
786785
}
787786
})
788787
.join('');

public/Mathematics/Exponentiation by Squaring/leetcode/50. Pow(x, n)/Claude/README.html

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,8 @@
99
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css"
1010
rel="stylesheet"
1111
/>
12-
<link
13-
href="/vendor/prismjs/plugins/line-numbers/prism-line-numbers.css"
14-
rel="stylesheet"
15-
/>
16-
<link
17-
href="/vendor/fontawesome/css/all.min.css"
18-
rel="stylesheet"
19-
/>
12+
<link href="/vendor/prismjs/plugins/line-numbers/prism-line-numbers.css" rel="stylesheet" />
13+
<link href="/vendor/fontawesome/css/all.min.css" rel="stylesheet" />
2014
<style>
2115
.prismjs .copy-button,
2216
.code-toolbar > .toolbar button {
@@ -519,10 +513,10 @@ <h2 class="text-2xl font-bold text-gray-700 border-b-2 border-indigo-400 pb-2 mb
519513
}
520514
}
521515

522-
fastPowWithSteps(x, n);
516+
const result = fastPowWithSteps(x, n);
523517
steps.push({
524518
type: 'final',
525-
text: `最終結果: ${originalX}^${originalN} = ${steps.length > 1 ? steps[steps.length - 2].text.split('=').pop().trim() : 1}`,
519+
text: `最終結果: ${originalX}^${originalN} = ${result}`,
526520
depth: 0,
527521
});
528522

0 commit comments

Comments
 (0)