Files
leetcode/apps/docs/public/same-direction-relative-speed.svg
T

90 lines
4.9 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: Relative Speed</text>
<text x="400" y="75" font-family="Arial, sans-serif" font-size="16" fill="#7f8c8d" text-anchor="middle">Fast pointer moves at 2x speed to find the midpoint.</text>
<!-- State 1 -->
<g transform="translate(100, 150)">
<text x="0" y="-30" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#2c3e50">1. After one move</text>
<!-- List -->
<g transform="translate(50, 20)">
<!-- Pointers -->
<polygon points="80,5 75,-5 85,-5" fill="#3498db"/>
<text x="80" y="-10" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#3498db" text-anchor="middle">slow</text>
<polygon points="160,5 155,-5 165,-5" fill="#ef4444"/>
<text x="160" y="-10" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#ef4444" text-anchor="middle">fast</text>
<!-- Nodes -->
<circle cx="0" cy="25" r="22" fill="#ffffff" stroke="#94a3b8" stroke-width="2"/>
<text x="0" y="31" font-family="monospace" font-size="18" text-anchor="middle" fill="#2c3e50">1</text>
<circle cx="80" cy="25" r="22" fill="#e3f2fd" stroke="#3498db" stroke-width="3"/>
<text x="80" y="31" font-family="monospace" font-size="18" text-anchor="middle" fill="#2c3e50">2</text>
<circle cx="160" cy="25" r="22" fill="#fee2e2" stroke="#ef4444" stroke-width="3"/>
<text x="160" y="31" font-family="monospace" font-size="18" text-anchor="middle" fill="#2c3e50">3</text>
<circle cx="240" cy="25" r="22" fill="#ffffff" stroke="#94a3b8" stroke-width="2"/>
<text x="240" y="31" font-family="monospace" font-size="18" text-anchor="middle" fill="#2c3e50">4</text>
<circle cx="320" cy="25" r="22" fill="#ffffff" stroke="#94a3b8" stroke-width="2"/>
<text x="320" y="31" font-family="monospace" font-size="18" text-anchor="middle" fill="#2c3e50">5</text>
<!-- Connectors -->
<line x1="22" y1="25" x2="58" y2="25" stroke="#94a3b8" stroke-width="2"/>
<line x1="102" y1="25" x2="138" y2="25" stroke="#94a3b8" stroke-width="2"/>
<line x1="182" y1="25" x2="218" y2="25" stroke="#94a3b8" stroke-width="2"/>
<line x1="262" y1="25" x2="298" y2="25" stroke="#94a3b8" 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">Move: slow +1, fast +2</text>
</g>
<!-- State 2 -->
<g transform="translate(100, 340)">
<text x="0" y="-30" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#2c3e50">2. Reached the middle</text>
<!-- List -->
<g transform="translate(50, 20)">
<!-- Pointers -->
<polygon points="160,5 155,-5 165,-5" fill="#3498db"/>
<text x="160" y="-10" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#3498db" text-anchor="middle">slow</text>
<polygon points="320,5 315,-5 325,-5" fill="#ef4444"/>
<text x="320" y="-10" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#ef4444" text-anchor="middle">fast</text>
<!-- Nodes -->
<circle cx="0" cy="25" r="22" fill="#ffffff" stroke="#94a3b8" stroke-width="2"/>
<text x="0" y="31" font-family="monospace" font-size="18" text-anchor="middle" fill="#2c3e50">1</text>
<circle cx="80" cy="25" r="22" fill="#ffffff" stroke="#94a3b8" stroke-width="2"/>
<text x="80" y="31" font-family="monospace" font-size="18" text-anchor="middle" fill="#2c3e50">2</text>
<circle cx="160" cy="25" r="22" fill="#e3f2fd" stroke="#3498db" stroke-width="3"/>
<text x="160" y="31" font-family="monospace" font-size="18" text-anchor="middle" fill="#2c3e50">3</text>
<circle cx="240" cy="25" r="22" fill="#ffffff" stroke="#94a3b8" stroke-width="2"/>
<text x="240" y="31" font-family="monospace" font-size="18" text-anchor="middle" fill="#2c3e50">4</text>
<circle cx="320" cy="25" r="22" fill="#fee2e2" stroke="#ef4444" stroke-width="3"/>
<text x="320" y="31" font-family="monospace" font-size="18" text-anchor="middle" fill="#2c3e50">5</text>
<!-- Connectors -->
<line x1="22" y1="25" x2="58" y2="25" stroke="#94a3b8" stroke-width="2"/>
<line x1="102" y1="25" x2="138" y2="25" stroke="#94a3b8" stroke-width="2"/>
<line x1="182" y1="25" x2="218" y2="25" stroke="#94a3b8" stroke-width="2"/>
<line x1="262" y1="25" x2="298" y2="25" stroke="#94a3b8" stroke-width="2"/>
</g>
<text x="400" y="45" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#3498db">Midpoint found!</text>
</g>
</svg>