44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width,initial-scale=1.0 " />
66 < title > LeetCode #83 - Remove Duplicates from Sorted List</ title >
7- < script src ="https://unpkg.com/react@18/umd/react.development .js "> </ script >
8- < script src ="https://unpkg.com/react-dom@18/umd/react-dom.development .js "> </ script >
7+ < script src ="https://unpkg.com/react@18/umd/react.production.min .js "> </ script >
8+ < script src ="https://unpkg.com/react-dom@18/umd/react-dom.production.min .js "> </ script >
99 < script src ="https://unpkg.com/@babel/standalone/babel.min.js "> </ script >
1010 < script src ="https://cdn.tailwindcss.com "> </ script >
1111 < link rel ="preconnect " href ="https://fonts.googleapis.com " />
@@ -344,58 +344,42 @@ <h3 class="outfit font-bold text-teal-800 text-lg mb-3">問題の要点</h3>
344344
345345 < div class ="mt-2 overflow-x-auto " id ="mermaid-diagram ">
346346 < div class ="mermaid ">
347- flowchart TD
348- Start([" 開始 "])
349- Guard["ガード節< br /> head is None OR head.next is None ?"]
350- GuardTrue["return head< br /> 変更なしで即時返却"]
351- Init["初期化< br /> current = head"]
352- LoopCheck{"current.next< br /> is not None ?"}
353- Cache["nxt = current.next< br /> 次ノードをキャッシュ"]
354- DupCheck{"current.val< br /> == nxt.val ?"}
355- Skip["nxt をスキップ< br /> current.next = nxt.next< br /> ※ current は動かさない"]
356- Advance["current を前進< br /> current = nxt"]
357- Return["return head< br /> 重複除去済みリストを返す"]
358- End([" 終了 "])
359-
360- Start --> Guard
361- Guard -- "True< br /> 空 or 単一ノード" --> GuardTrue
362- Guard -- "False< br /> 複数ノード存在" --> Init
363- GuardTrue --> End
364- Init --> LoopCheck
365- LoopCheck -- "False< br /> current.next が None< br /> ループ終了" --> Return
366- LoopCheck -- "True< br /> 次ノード存在" --> Cache
367- Cache --> DupCheck
368- DupCheck -- "True< br /> 重複あり" --> Skip
369- DupCheck -- "False< br /> 重複なし" --> Advance
370- Skip -- "再チェック< br /> 同じ current で< br /> ループ先頭へ戻る" --> LoopCheck
371- Advance -- "次ノードへ< br /> ループ先頭へ戻る" --> LoopCheck
372- Return --> End
373-
374- style Start fill:#d1fae5,stroke:#10b981,stroke-width:2px,color:#065f46
375- style End fill:#d1fae5,stroke:#10b981,stroke-width:2px,color:#065f46
376- style Guard fill:#e0f2fe,stroke:#0284c7,stroke-width:2px,color:#0c4a6e
377- style GuardTrue fill:#d1fae5,stroke:#059669,stroke-width:2px,color:#065f46
378- style Init fill:#e0f2fe,stroke:#0284c7,stroke-width:2px,color:#0c4a6e
379- style LoopCheck fill:#fef3c7,stroke:#f59e0b,stroke-width:2px,color:#92400e
380- style Cache fill:#f1f5f9,stroke:#64748b,stroke-width:2px,color:#1e293b
381- style DupCheck fill:#fef3c7,stroke:#f59e0b,stroke-width:2px,color:#92400e
382- style Skip fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b
383- style Advance fill:#f1f5f9,stroke:#64748b,stroke-width:2px,color:#1e293b
384- style Return fill:#d1fae5,stroke:#059669,stroke-width:2.5px,color:#065f46
385-
386- linkStyle 0 stroke:#64748b,stroke-width:2px
387- linkStyle 1 stroke:#059669,stroke-width:2px
388- linkStyle 2 stroke:#64748b,stroke-width:2px
389- linkStyle 3 stroke:#059669,stroke-width:2px
390- linkStyle 4 stroke:#64748b,stroke-width:2px
391- linkStyle 5 stroke:#059669,stroke-width:2px
392- linkStyle 6 stroke:#64748b,stroke-width:2px
393- linkStyle 7 stroke:#64748b,stroke-width:2px
394- linkStyle 8 stroke:#dc2626,stroke-width:2px
395- linkStyle 9 stroke:#64748b,stroke-width:2px
396- linkStyle 10 stroke:#a855f7,stroke-width:2px,stroke-dasharray:6 4
397- linkStyle 11 stroke:#a855f7,stroke-width:2px,stroke-dasharray:6 4
398- linkStyle 12 stroke:#059669,stroke-width:2px
347+ flowchart TD Start([" 開始 "]) Guard["ガード節< br /> head is None OR
348+ head.next is None ?"] GuardTrue["return head< br /> 変更なしで即時返却"]
349+ Init["初期化< br /> current = head"] LoopCheck{"current.next< br /> is not None
350+ ?"} Cache["nxt = current.next< br /> 次ノードをキャッシュ"]
351+ DupCheck{"current.val< br /> == nxt.val ?"} Skip["nxt をスキップ< br /> current.next
352+ = nxt.next< br /> ※ current は動かさない"] Advance["current を前進< br /> current
353+ = nxt"] Return["return head< br /> 重複除去済みリストを返す"] End([" 終了 "])
354+ Start --> Guard Guard -- "True< br /> 空 or 単一ノード" --> GuardTrue Guard --
355+ "False< br /> 複数ノード存在" --> Init GuardTrue --> End Init --> LoopCheck
356+ LoopCheck -- "False< br /> current.next が None< br /> ループ終了" --> Return
357+ LoopCheck -- "True< br /> 次ノード存在" --> Cache Cache --> DupCheck DupCheck
358+ -- "True< br /> 重複あり" --> Skip DupCheck -- "False< br /> 重複なし" -->
359+ Advance Skip -- "再チェック< br /> 同じ current で< br /> ループ先頭へ戻る" -->
360+ LoopCheck Advance -- "次ノードへ< br /> ループ先頭へ戻る" --> LoopCheck Return
361+ --> End style Start
362+ fill:#d1fae5,stroke:#10b981,stroke-width:2px,color:#065f46 style End
363+ fill:#d1fae5,stroke:#10b981,stroke-width:2px,color:#065f46 style Guard
364+ fill:#e0f2fe,stroke:#0284c7,stroke-width:2px,color:#0c4a6e style GuardTrue
365+ fill:#d1fae5,stroke:#059669,stroke-width:2px,color:#065f46 style Init
366+ fill:#e0f2fe,stroke:#0284c7,stroke-width:2px,color:#0c4a6e style LoopCheck
367+ fill:#fef3c7,stroke:#f59e0b,stroke-width:2px,color:#92400e style Cache
368+ fill:#f1f5f9,stroke:#64748b,stroke-width:2px,color:#1e293b style DupCheck
369+ fill:#fef3c7,stroke:#f59e0b,stroke-width:2px,color:#92400e style Skip
370+ fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style Advance
371+ fill:#f1f5f9,stroke:#64748b,stroke-width:2px,color:#1e293b style Return
372+ fill:#d1fae5,stroke:#059669,stroke-width:2.5px,color:#065f46 linkStyle 0
373+ stroke:#64748b,stroke-width:2px linkStyle 1 stroke:#059669,stroke-width:2px
374+ linkStyle 2 stroke:#64748b,stroke-width:2px linkStyle 3
375+ stroke:#059669,stroke-width:2px linkStyle 4 stroke:#64748b,stroke-width:2px
376+ linkStyle 5 stroke:#059669,stroke-width:2px linkStyle 6
377+ stroke:#64748b,stroke-width:2px linkStyle 7 stroke:#64748b,stroke-width:2px
378+ linkStyle 8 stroke:#dc2626,stroke-width:2px linkStyle 9
379+ stroke:#64748b,stroke-width:2px linkStyle 10
380+ stroke:#a855f7,stroke-width:2px,stroke-dasharray:6 4 linkStyle 11
381+ stroke:#a855f7,stroke-width:2px,stroke-dasharray:6 4 linkStyle 12
382+ stroke:#059669,stroke-width:2px
399383 </ div >
400384 </ div >
401385
@@ -728,9 +712,7 @@ <h3 class="outfit font-bold text-teal-800 text-lg mb-3">アプローチ比較</h
728712 const BOX = 52 ,
729713 GAP = 16 ,
730714 ARR = 20 ;
731- const totalNodes = nodes . filter ( ( n ) => ! n . skip ) . length ;
732- const allNodes = nodes ;
733- const W = Math . max ( 520 , allNodes . length * ( BOX + GAP + ARR ) ) ;
715+ const W = Math . max ( 520 , nodes . length * ( BOX + GAP + ARR ) ) ;
734716 const H = 120 ;
735717
736718 // compute x positions for all nodes (including skipped)
@@ -745,6 +727,11 @@ <h3 class="outfit font-bold text-teal-800 text-lg mb-3">アプローチ比較</h
745727 < svg
746728 viewBox = { `0 0 ${ W } ${ H } ` }
747729 style = { { width : '100%' , height : 'auto' , display : 'block' , maxWidth : W } }
730+ role = "img"
731+ aria-label = { `連結リストの可視化: ${ nodes
732+ . filter ( ( n ) => ! n . skip )
733+ . map ( ( n ) => n . val )
734+ . join ( ' → ' ) } → None`}
748735 >
749736 { allNodes . map ( ( node , i ) => {
750737 if ( node . skip ) {
@@ -937,6 +924,7 @@ <h3 className="mt-0 mb-3 text-teal-800 text-base font-bold outfit">
937924 < button
938925 key = { step . step }
939926 type = "button"
927+ aria-current = { isActive ? 'step' : undefined }
940928 className = { [
941929 'w-full text-left text-sm rounded-xl border-2 transition cursor-pointer px-3 py-3' ,
942930 'bg-white border-slate-200 hover:border-emerald-400 hover:translate-x-1' ,
@@ -1246,8 +1234,10 @@ <h3 className="mt-0 mb-3 text-teal-800 text-base font-bold outfit">
12461234 }
12471235
12481236 // ─── Mount ────────────────────────────────────────────────────
1249- ReactDOM . createRoot ( document . getElementById ( 'react-steps' ) ) . render ( < StepsSection /> ) ;
1250- ReactDOM . createRoot ( document . getElementById ( 'react-code-tabs' ) ) . render ( < CodeTabs /> ) ;
1237+ const stepsEl = document . getElementById ( 'react-steps' ) ;
1238+ const codeTabsEl = document . getElementById ( 'react-code-tabs' ) ;
1239+ if ( stepsEl ) ReactDOM . createRoot ( stepsEl ) . render ( < StepsSection /> ) ;
1240+ if ( codeTabsEl ) ReactDOM . createRoot ( codeTabsEl ) . render ( < CodeTabs /> ) ;
12511241 </ script >
12521242 < script src ="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js "> </ script >
12531243 < script >
0 commit comments