mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-02 13:12:44 +00:00
66 lines
3.7 KiB
XML
66 lines
3.7 KiB
XML
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg">
|
|||
|
|
<!-- Background (REQUIRED) -->
|
||
|
|
<rect width="800" height="450" fill="#f8f9fa" rx="10"/>
|
||
|
|
|
||
|
|
<!-- Title and Subtitle -->
|
||
|
|
<text x="400" y="45" font-family="Arial, sans-serif" font-size="26" font-weight="bold" fill="#2c3e50" text-anchor="middle">Sliding Window: Fixed Size</text>
|
||
|
|
<text x="400" y="75" font-family="Arial, sans-serif" font-size="16" fill="#7f8c8d" text-anchor="middle">Window of size K=3 moving through the array.</text>
|
||
|
|
|
||
|
|
<!-- Step 1: Initial window -->
|
||
|
|
<g transform="translate(150, 130)">
|
||
|
|
<text x="0" y="-20" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#2c3e50">1. Current window (Sum = 10)</text>
|
||
|
|
|
||
|
|
<!-- Array -->
|
||
|
|
<g transform="translate(0, 20)">
|
||
|
|
<rect x="0" y="0" width="60" height="50" fill="#d1fae5" stroke="#10b981" stroke-width="3" rx="3"/>
|
||
|
|
<text x="30" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1b5e20">2</text>
|
||
|
|
|
||
|
|
<rect x="70" y="0" width="60" height="50" fill="#d1fae5" stroke="#10b981" stroke-width="3" rx="3"/>
|
||
|
|
<text x="100" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1b5e20">3</text>
|
||
|
|
|
||
|
|
<rect x="140" y="0" width="60" height="50" fill="#d1fae5" stroke="#10b981" stroke-width="3" rx="3"/>
|
||
|
|
<text x="170" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1b5e20">5</text>
|
||
|
|
|
||
|
|
<rect x="210" y="0" width="60" height="50" fill="#ffffff" stroke="#dee2e6" stroke-width="2" rx="3"/>
|
||
|
|
<text x="240" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#2c3e50">1</text>
|
||
|
|
|
||
|
|
<rect x="280" y="0" width="60" height="50" fill="#ffffff" stroke="#dee2e6" stroke-width="2" rx="3"/>
|
||
|
|
<text x="310" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#2c3e50">8</text>
|
||
|
|
|
||
|
|
<!-- Bracket -->
|
||
|
|
<path d="M 0,60 L 0,70 L 200,70 L 200,60" fill="none" stroke="#10b981" stroke-width="2"/>
|
||
|
|
</g>
|
||
|
|
</g>
|
||
|
|
|
||
|
|
<!-- Transition -->
|
||
|
|
<g transform="translate(400, 260)">
|
||
|
|
<path d="M 0,0 L 0,30" stroke="#dee2e6" stroke-width="2" fill="none"/>
|
||
|
|
<text x="10" y="20" font-family="Arial, sans-serif" font-size="14" font-style="italic" fill="#7f8c8d">Slide window: -2, +1</text>
|
||
|
|
</g>
|
||
|
|
|
||
|
|
<!-- Step 2: Slid window -->
|
||
|
|
<g transform="translate(150, 340)">
|
||
|
|
<text x="0" y="-20" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#2c3e50">2. Next window (Sum = 9)</text>
|
||
|
|
|
||
|
|
<!-- Array -->
|
||
|
|
<g transform="translate(0, 20)">
|
||
|
|
<rect x="0" y="0" width="60" height="50" fill="#e5e7eb" stroke="#94a3b8" stroke-width="2" rx="3"/>
|
||
|
|
<text x="30" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#94a3b8">2</text>
|
||
|
|
|
||
|
|
<rect x="70" y="0" width="60" height="50" fill="#d1fae5" stroke="#10b981" stroke-width="3" rx="3"/>
|
||
|
|
<text x="100" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1b5e20">3</text>
|
||
|
|
|
||
|
|
<rect x="140" y="0" width="60" height="50" fill="#d1fae5" stroke="#10b981" stroke-width="3" rx="3"/>
|
||
|
|
<text x="170" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1b5e20">5</text>
|
||
|
|
|
||
|
|
<rect x="210" y="0" width="60" height="50" fill="#d1fae5" stroke="#10b981" stroke-width="3" rx="3"/>
|
||
|
|
<text x="240" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1b5e20">1</text>
|
||
|
|
|
||
|
|
<rect x="280" y="0" width="60" height="50" fill="#ffffff" stroke="#dee2e6" stroke-width="2" rx="3"/>
|
||
|
|
<text x="310" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#2c3e50">8</text>
|
||
|
|
|
||
|
|
<!-- Bracket -->
|
||
|
|
<path d="M 70,60 L 70,70 L 270,70 L 270,60" fill="none" stroke="#10b981" stroke-width="2"/>
|
||
|
|
</g>
|
||
|
|
</g>
|
||
|
|
</svg>
|