mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-02 21:22:43 +00:00
80 lines
5.0 KiB
XML
80 lines
5.0 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">Same-Direction Pointers: Compaction</text>
|
||
|
|
<text x="400" y="75" font-family="Arial, sans-serif" font-size="16" fill="#7f8c8d" text-anchor="middle">Building a correct prefix while scanning the input.</text>
|
||
|
|
|
||
|
|
<!-- Before Section -->
|
||
|
|
<g transform="translate(150, 130)">
|
||
|
|
<text x="0" y="-20" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#2c3e50">1. Before copying</text>
|
||
|
|
|
||
|
|
<!-- Array -->
|
||
|
|
<g transform="translate(0, 20)">
|
||
|
|
<!-- Correct Prefix (Green) -->
|
||
|
|
<rect x="0" y="0" width="60" height="50" fill="#d1fae5" stroke="#10b981" stroke-width="2" rx="3"/>
|
||
|
|
<text x="30" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1b5e20">1</text>
|
||
|
|
|
||
|
|
<rect x="70" y="0" width="60" height="50" fill="#d1fae5" stroke="#10b981" stroke-width="2" rx="3"/>
|
||
|
|
<text x="100" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1b5e20">2</text>
|
||
|
|
|
||
|
|
<!-- Write Position (Yellow) -->
|
||
|
|
<rect x="140" y="0" width="60" height="50" fill="#fef3c7" stroke="#f59e0b" stroke-width="3" rx="3"/>
|
||
|
|
<text x="170" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#8a5a00">0</text>
|
||
|
|
<polygon points="170,60 165,70 175,70" fill="#f59e0b"/>
|
||
|
|
<text x="170" y="85" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#8a5a00" text-anchor="middle">write</text>
|
||
|
|
|
||
|
|
<!-- Scanning (Blue) -->
|
||
|
|
<rect x="210" y="0" width="60" height="50" fill="#e3f2fd" stroke="#3498db" stroke-width="3" rx="3"/>
|
||
|
|
<text x="240" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1565c0">4</text>
|
||
|
|
<polygon points="240,60 235,70 245,70" fill="#3498db"/>
|
||
|
|
<text x="240" y="85" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1565c0" text-anchor="middle">read</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">3</text>
|
||
|
|
|
||
|
|
<!-- Prefix label -->
|
||
|
|
<path d="M 0,-10 L 0,-20 L 130,-20 L 130,-10" fill="none" stroke="#10b981" stroke-width="2"/>
|
||
|
|
<text x="65" y="-30" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#10b981" text-anchor="middle">CORRECT PREFIX</text>
|
||
|
|
</g>
|
||
|
|
</g>
|
||
|
|
|
||
|
|
<!-- Transition Label -->
|
||
|
|
<g transform="translate(400, 270)">
|
||
|
|
<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">Copy read value to write position</text>
|
||
|
|
</g>
|
||
|
|
|
||
|
|
<!-- After Section -->
|
||
|
|
<g transform="translate(150, 340)">
|
||
|
|
<text x="0" y="-20" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#2c3e50">2. After copying and advancing</text>
|
||
|
|
|
||
|
|
<!-- Array -->
|
||
|
|
<g transform="translate(0, 20)">
|
||
|
|
<rect x="0" y="0" width="60" height="50" fill="#d1fae5" stroke="#10b981" stroke-width="2" rx="3"/>
|
||
|
|
<text x="30" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1b5e20">1</text>
|
||
|
|
|
||
|
|
<rect x="70" y="0" width="60" height="50" fill="#d1fae5" stroke="#10b981" stroke-width="2" rx="3"/>
|
||
|
|
<text x="100" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1b5e20">2</text>
|
||
|
|
|
||
|
|
<rect x="140" y="0" width="60" height="50" fill="#d1fae5" stroke="#10b981" stroke-width="2" rx="3"/>
|
||
|
|
<text x="170" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1b5e20">4</text>
|
||
|
|
|
||
|
|
<!-- New Write Position -->
|
||
|
|
<rect x="210" y="0" width="60" height="50" fill="#fef3c7" stroke="#f59e0b" stroke-width="3" rx="3"/>
|
||
|
|
<text x="240" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#8a5a00">4</text>
|
||
|
|
<polygon points="240,60 235,70 245,70" fill="#f59e0b"/>
|
||
|
|
<text x="240" y="85" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#8a5a00" text-anchor="middle">write</text>
|
||
|
|
|
||
|
|
<!-- New Scanning Position -->
|
||
|
|
<rect x="280" y="0" width="60" height="50" fill="#e3f2fd" stroke="#3498db" stroke-width="3" rx="3"/>
|
||
|
|
<text x="310" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1565c0">3</text>
|
||
|
|
<polygon points="310,60 305,70 315,70" fill="#3498db"/>
|
||
|
|
<text x="310" y="85" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#1565c0" text-anchor="middle">read</text>
|
||
|
|
|
||
|
|
<path d="M 0,-10 L 0,-20 L 200,-20 L 200,-10" fill="none" stroke="#10b981" stroke-width="2"/>
|
||
|
|
<text x="100" y="-30" font-family="Arial, sans-serif" font-size="12" font-weight="bold" fill="#10b981" text-anchor="middle">PREFIX GREW</text>
|
||
|
|
</g>
|
||
|
|
</g>
|
||
|
|
</svg>
|