Example result illustrating this prompt's visual direction. Actual results may vary by model, reference image and settings.
Sliding Window Running Sum from Sequence Notes
Transform fixed-window notes into overlapping ranges with outgoing and incoming updates.
Prompt
Transform the uploaded photo of handwritten algorithm notes into a clean, readable visual walkthrough. Treat the photo as the source of truth: preserve its algorithm, legible input values and stated conventions; remove glare, skew and paper clutter while retaining a small source-note inset. Do not invent unreadable values or silently repair contradictory logic; ask one focused question if an essential detail cannot be read. Use the optional example below only when the source has no worked example and label it "Illustrative example". Use a fixed window size k with 1<=k<=n. Show the first sum in full, then update by subtracting the outgoing value and adding the incoming value; keep window sum distinct from best sum. Optional labeled example: [2, 1, 5, 1, 3, 2], k=3; window sums 8, 7, 9, 6; maximum 9 for zero-based indices 2..4. Initialize the best sum to the first valid window, so all-negative arrays work. State O(n) time and O(1) auxiliary space. Do not turn this into a variable-length window algorithm. Layout: Use four aligned rows with a constant-width window frame; an outgoing coral marker and incoming teal marker clarify each update. Use an off-white canvas, dark high-contrast sans-serif labels and spacious cells. Include the algorithm title, input, numbered steps, final result and the stated complexity note. Pair colors with labels or outlines so meaning does not depend on color alone. Keep all values and state changes consistent across panels. If space is tight, simplify decoration rather than omitting essential steps. Output one polished educational image; treat it as a visual explanation, not executable code. Before finalizing, check the trace and all visible labels against the source.
How to use it
- Upload a clear photo of the relevant handwritten algorithm notes.
- Paste this prompt and specify any required input or indexing convention.
- Check the rendered values and labels against your source before publishing.
Common failure fixes
- If window width changes, keep exactly k elements inside every valid window.
- If the running sum drifts, subtract the outgoing value before adding the incoming one.
- If negative inputs return zero incorrectly, initialize the best from the first window.