Open
Conversation
Add solutions for interval scheduling, sliding window, character counting, greedy, cycle detection, and data structure problems. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Greedy・Sliding Window・DFS・データ構造系の問題を追加。
アルゴリズム処理機序
1. Minimum Arrows to Burst Balloons (452) — 区間スケジューリング
flowchart LR A[区間をendでソート] --> B[arrow = 最初のend] B --> C{次の区間のstart > arrow?} C -->|Yes| D[arrows++ / arrow更新] C -->|No| E[同じ矢で貫通] D --> C E --> C2. Minimum Swaps to Group All 1s Together II (2134) — 円形スライディングウィンドウ
flowchart LR A[1の総数 = windowサイズ] --> B[初期window内の0を数える] B --> C[windowを1ずつスライド] C --> D[出る要素が0なら zeros--] D --> E[入る要素が0なら zeros++] E --> F[minZeros更新] F --> C3. Find All Anagrams in a String (438) — 固定幅ウィンドウ
flowchart LR A["pCount = p の文字頻度"] --> B["sCount = s[0..len(p)] の文字頻度"] B --> C{sCount == pCount?} C -->|Yes| D[index追加] C -->|No| E[ウィンドウを右へ1スライド] D --> E E --> F["右端追加 / 左端削除"] F --> C4. Minimum Suffix Flips (1529) — 貪欲法
flowchart LR A["current = '0'"] --> B{"target[i] != current?"} B -->|Yes| C[flips++ / current反転] B -->|No| D[次へ] C --> D D --> B5. Maximum Number of Integers to Choose (2554) — 貪欲法 + Set
6. LRU Cache (146) — HashMap + 双方向連結リスト
flowchart TB subgraph Structure HM[HashMap key→Node] DLL["Head ⇄ Node ⇄ ... ⇄ Tail"] end subgraph Get G1{key存在?} -->|Yes| G2[remove → insertHead → return val] G1 -->|No| G3[return -1] end subgraph Put P1{key存在?} -->|Yes| P2[val更新 → remove → insertHead] P1 -->|No| P3[新Node作成 → insertHead] P3 --> P4{cap超過?} P4 -->|Yes| P5[tail.prev を remove + delete] end7. Number of Islands (200) — DFS Flood Fill
flowchart TB A[グリッド全走査] --> B{"grid[i][j] == '1'?"} B -->|Yes| C[count++ / DFS開始] B -->|No| A C --> D["現セルを'0'に塗り替え"] D --> E[上下左右に再帰] E --> Aテクニック分類
Test plan
go build ./...で全ファイルコンパイル確認🤖 Generated with Claude Code