Files
leetcode/apps/docs/public/opposite-direction-monotonic-sum.svg
T

76 lines
4.7 KiB
XML
Raw Normal View History

<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">Opposite Direction: Monotonic Sum</text>
<text x="400" y="75" font-family="Arial, sans-serif" font-size="16" fill="#7f8c8d" text-anchor="middle">Two Sum Sorted: target = 16. Adjust pointers based on sum.</text>
<!-- State 1: Sum too large -->
<g transform="translate(100, 130)">
<text x="0" y="-20" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#2c3e50">1. Sum is too large (2 + 15 = 17)</text>
<!-- Array -->
<g transform="translate(50, 20)">
<!-- Left Pointer (Blue) -->
<rect x="0" y="0" width="60" height="50" fill="#e3f2fd" stroke="#3498db" stroke-width="3" rx="3"/>
<text x="30" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1565c0">2</text>
<polygon points="30,60 25,70 35,70" fill="#3498db"/>
<text x="30" y="85" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#3498db" text-anchor="middle">L</text>
<rect x="70" y="0" width="60" height="50" fill="#ffffff" stroke="#dee2e6" stroke-width="2" rx="3"/>
<text x="100" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#2c3e50">5</text>
<rect x="140" y="0" width="60" height="50" fill="#ffffff" stroke="#dee2e6" stroke-width="2" rx="3"/>
<text x="170" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#2c3e50">8</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">11</text>
<!-- Right Pointer (Orange) -->
<rect x="280" y="0" width="60" height="50" fill="#fff7ed" stroke="#f39c12" stroke-width="3" rx="3"/>
<text x="310" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#8a5a00">15</text>
<polygon points="310,60 305,70 315,70" fill="#f39c12"/>
<text x="310" y="85" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#8a5a00" text-anchor="middle">R</text>
<!-- Elimination Note -->
<text x="400" y="32" font-family="Arial, sans-serif" font-size="14" fill="#ef4444">17 &gt; 16: R must move left.</text>
</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 Right pointer left</text>
</g>
<!-- State 2: Sum too small -->
<g transform="translate(100, 340)">
<text x="0" y="-20" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#2c3e50">2. Sum is too small (2 + 11 = 13)</text>
<!-- Array -->
<g transform="translate(50, 20)">
<rect x="0" y="0" width="60" height="50" fill="#e3f2fd" stroke="#3498db" stroke-width="3" rx="3"/>
<text x="30" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#1565c0">2</text>
<polygon points="30,60 25,70 35,70" fill="#3498db"/>
<text x="30" y="85" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#3498db" text-anchor="middle">L</text>
<rect x="70" y="0" width="60" height="50" fill="#ffffff" stroke="#dee2e6" stroke-width="2" rx="3"/>
<text x="100" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#2c3e50">5</text>
<rect x="140" y="0" width="60" height="50" fill="#ffffff" stroke="#dee2e6" stroke-width="2" rx="3"/>
<text x="170" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#2c3e50">8</text>
<rect x="210" y="0" width="60" height="50" fill="#fff7ed" stroke="#f39c12" stroke-width="3" rx="3"/>
<text x="240" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#8a5a00">11</text>
<polygon points="240,60 235,70 245,70" fill="#f39c12"/>
<text x="240" y="85" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#8a5a00" text-anchor="middle">R</text>
<rect x="280" y="0" width="60" height="50" fill="#e5e7eb" stroke="#94a3b8" stroke-width="2" rx="3"/>
<text x="310" y="32" font-family="monospace" font-size="22" text-anchor="middle" fill="#94a3b8">15</text>
<!-- Elimination Note -->
<text x="400" y="32" font-family="Arial, sans-serif" font-size="14" fill="#3498db">13 &lt; 16: L must move right.</text>
</g>
</g>
</svg>