-
Notifications
You must be signed in to change notification settings - Fork 0
Update snail traversal implementation and add SRI verification utility #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,11 +5,8 @@ | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>LeetCode: Snail Traversal - 蛇行パターンで1D→2D配列変換</title> | ||
|
|
||
| <!-- Tailwind CSS --> | ||
| <script | ||
| src="https://cdn.tailwindcss.com/3.4.1" | ||
| crossorigin="anonymous" | ||
| ></script> | ||
| <!-- Tailwind CSS (Play CDN - SRI非対応) --> | ||
| <script src="https://cdn.tailwindcss.com"></script> | ||
|
|
||
| <!-- Google Fonts --> | ||
| <link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
|
|
@@ -23,19 +20,19 @@ | |
| <link | ||
| href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" | ||
| rel="stylesheet" | ||
| integrity="sha384-wFjoQjtV1y5jVHbt0p35Ui8aV8GVpEZkyF99OXWqP/eNJDU93D3Ugxkoyh6Y2I4" | ||
| integrity="sha384-wFjoQjtV1y5jVHbt0p35Ui8aV8GVpEZkyF99OXWqP/eNJDU93D3Ugxkoyh6Y2I4A" | ||
| crossorigin="anonymous" | ||
| /> | ||
| <link | ||
| href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/line-numbers/prism-line-numbers.min.css" | ||
| rel="stylesheet" | ||
| integrity="sha384-AnUkTNLI8COlMCRJ0FHIdX76If83145OTCLUx4gQyfnO0gGeO/sD9czGEUBxtkUU" | ||
| integrity="sha384-nUkTNLI8COlMCRJ0FHIdX76If83145OTCLUx4gQyfnO0gGeO/sD9czGEUBxtkcUv" | ||
| crossorigin="anonymous" | ||
| /> | ||
| <link | ||
| href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/toolbar/prism-toolbar.min.css" | ||
| rel="stylesheet" | ||
| integrity="sha384-vEUzJ34/1CCeefTGUKLgvA5Z/vYIwi+Jyu8aAaCfFDxfwZ3Xs3OfkkIeegsLRM11" | ||
| integrity="sha384-EUzJ34/1CCeefTGUKLgvA5Z/vYIwi+Jyu8aAaCfFDxfwZ3Xs3OfkkIeegsLRM11e" | ||
| crossorigin="anonymous" | ||
| /> | ||
|
|
||
|
|
@@ -251,8 +248,10 @@ <h3 class="text-xl font-semibold text-teal-800 mt-6 mb-3">戦略のポイント< | |
| TypeScript実装(最適化版) | ||
| </h2> | ||
|
|
||
| <pre class="line-numbers"><code class="language-typescript">declare interface Array<T> { | ||
| snail(rowsCount: number, colsCount: number): T[][]; | ||
| <pre class="line-numbers"><code class="language-typescript">declare global { | ||
| interface Array<T> { | ||
| snail(this: T[], rowsCount: number, colsCount: number): T[][]; | ||
| } | ||
|
Comment on lines
+251
to
+254
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find the files mentioned in the review comment
echo "=== Looking for the files ==="
find . -name "*README_react.html" -o -name "*Snail_Traversal_TS.ipynb" -o -name "README.md" | head -20Repository: myoshi2891/Algorithm-DataStructures-Math-SQL Length of output: 1378 🏁 Script executed: #!/bin/bash
# Search for Snail Traversal directory
echo "=== Searching for Snail Traversal files ==="
find . -type d -name "*Snail*" 2>/dev/null
find . -name "*README_react.html" 2>/dev/null
find . -name "*Snail_Traversal_TS*" 2>/dev/null
</script>Repository: myoshi2891/Algorithm-DataStructures-Math-SQL Length of output: 2038 🏁 Script executed: #!/bin/bash
# Read the HTML file around lines 251-254
echo "=== Checking README_react.html lines 240-265 ==="
sed -n '240,265p' "./JavaScript/2624. Snail Traversal/Claude Code Sonnet 4.5/README_react.html"
echo ""
echo "=== Checking Snail_Traversal_TS.ipynb structure ==="
# Get the line count of the notebook
wc -l "./JavaScript/2624. Snail Traversal/Claude Code Sonnet 4.5/Snail_Traversal_TS.ipynb"
echo ""
echo "=== Checking notebook for snail method declaration around line 29 ==="
sed -n '1,100p' "./JavaScript/2624. Snail Traversal/Claude Code Sonnet 4.5/Snail_Traversal_TS.ipynb" | grep -i "snail\|declare\|interface" -A 2 -B 2Repository: myoshi2891/Algorithm-DataStructures-Math-SQL Length of output: 2782 ノートブック版の型定義を HTML 版と同期する必要がある HTML ファイル(行 251-254)では 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -1297,18 +1296,20 @@ <h3 class="text-xl font-semibold text-teal-800 mt-8 mb-4">実装方法の比較< | |
| <p className="font-semibold text-emerald-900"> | ||
| Snail Traversalパターン: | ||
| </p> | ||
| {visual.result2d[0].map((_, colIdx) => { | ||
| const isEvenCol = colIdx % 2 === 0; | ||
| const colValues = isEvenCol | ||
| ? visual.result2d.map(r => r[colIdx]) | ||
| : [...visual.result2d].reverse().map(r => r[colIdx]); | ||
|
|
||
| return ( | ||
| <li key={colIdx}> | ||
| • 列{colIdx}: {isEvenCol ? '上から下' : '下から上'} [{colValues.join(', ')}] | ||
| </li> | ||
| ); | ||
| })} | ||
| <ul> | ||
| {visual.result2d[0].map((_, colIdx) => { | ||
| const isEvenCol = colIdx % 2 === 0; | ||
| const colValues = isEvenCol | ||
| ? visual.result2d.map(r => r[colIdx]) | ||
| : [...visual.result2d].reverse().map(r => r[colIdx]); | ||
|
|
||
| return ( | ||
| <li key={colIdx}> | ||
| • 列{colIdx}: {isEvenCol ? '上から下' : '下から上'} [{colValues.join(', ')}] | ||
| </li> | ||
| ); | ||
| })} | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| )} | ||
|
|
@@ -1619,10 +1620,5 @@ <h3 className="mt-0 text-teal-800 text-xl font-semibold"> | |
| const root = ReactDOM.createRoot(document.getElementById('react-root')); | ||
| root.render(<SnailTraversalSteps />); | ||
| </script> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-typescript.min.js"></script> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/line-numbers/prism-line-numbers.min.js"></script> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/toolbar/prism-toolbar.min.js"></script> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js"></script> | ||
| </body> | ||
| </html> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
エッジケースのコメントが不正確
[].snail(0, 0)の場合、0 * 0 = 0でthis.length = 0と一致するため、バリデーションは通過します。結果として空配列[]が返りますが、それはバリデーション失敗ではなく、行数が0のため空の結果が返るという理由です。コメントの「1×1=1 ≠ 0のため空配列を返す」は誤りです。
🐛 修正案
📝 Committable suggestion
🤖 Prompt for AI Agents