Longest substring without repeats
one step at a time.
Grow the window to the right; when a letter repeats, jump the left edge just past its last copy, and never move it back.
Free to use. Step forward and back at your pace, and share a link to the exact step you are stuck on.
What you actually watch.
The part a dry run on paper loses: the state, at every step.
Grow the window to the right; when a letter repeats, jump the left edge just past its last copy, and never move it back. That sentence is easy to agree with and hard to hold in your head on step nine, which is where most people lose the thread.
So the visualiser keeps it in front of you: the window growing and shrinking, with the running total inside it. The line of code being executed is highlighted as the picture changes, so the drawing and the code never drift apart. Step forward, step back, or let it play.
Put your own input in. Longest substring without repeats on a clean example teaches you the shape; longest substring without repeats on an empty input, a single element, or one with duplicates teaches you the thing an interviewer asks about.
How it runs, step by step.
The same order the visualiser moves in, so the list and the picture match.
- 1Grow the window by taking in the element on the right.
- 2Update the running total or count for what just entered.
- 3While the window breaks the rule, drop elements from the left.
- 4Record the best window seen so far. The left edge never moves back.
Where people get this one wrong.
These are not made up. Each one is a switch in the tool: turn it on, run the same input, and watch the state go wrong.
- Bug: window never shrinksNotices the repeat but never moves left, so the window keeps a duplicate and the length keeps counting. Try "abba".
- Bug: left moves backDrops the "last[c] >= left" check, so an old copy outside the window drags left backwards. Try "abba" or "tmmzuxt".
Inputs worth trying.
The cases that teach something. Each one is a preset in the tool, with the reason it is there.
- abbaThe second a is already outside the window. Run both bugs here.
- One letter repeatedleft jumps on every letter; the answer is 1.
- No repeatsThe window never shrinks, so both bugs get this one right.
- Answer in the middleThe answer "wke" starts after the double w.
- dvdfleft jumps to 1, just past the first d, not all the way to 2. The answer is "vdf".
- Old copy far behindAt the last t, the first t is long gone. Run "Bug: left moves back" here.
What it costs.
The two numbers an interviewer will ask for, and what they mean here.
- Time
- O(n)counted as real operations while it runs, not quoted from a table
- Space
- O(k)what the algorithm holds besides the input itself
- Pattern
- Sliding windowGrow the right edge, shrink the left, never look back.
Once you can see it, go and use it.
Watching is the first ten minutes. The pattern sticks when you solve with it.
Everything in the app, in one place.
Practice, interviews and the tools, all free to start. Swipe to see the rest.
DSA practice
Problems filed under the pattern that solves them, not a sheet.
352 problemsOpenCompany sets
Practise what one company actually asks, the week before the round.
463 companiesOpenCoding interview
Pick the role, write in a real editor, and answer while you type.
scored reportOpenMock interviews, spoken
You answer out loud, it follows up on what you said.
36 topicsOpenDatabase round
DBMS asked the way a panel asks it: indexes, joins, normal forms.
in Core CSOpenOOP round
Inheritance, polymorphism and the follow-up you never rehearse.
in Core CSOpenSystem design
How real systems are built, from the primitives to the AI stack.
27 chaptersOpenSQL practice
Real schemas, your query, the rows it returns, and an honest verdict.
39 questionsOpenAptitude
Quant, logical, verbal, DI and technical, timed like the real test.
280 questionsOpenOnline assessment
A clock, marks per question and hidden tests, like a company's judge.
37 papersOpenAlgorithm visualiser
Watch it run on your own input, one step at a time.
26 algorithmsOpenAI that helps, not solves
Hints one at a time, AI review before a mentor reads it.
100 free creditsOpenResume builder
Build it inside the app, next to the work you practised.
in the appOpenProgress and readiness
One score, and the axis you are weakest on.
tracked dailyOpen
Free to start: 100 AI credits when you sign up and 100 every month. Start free in the app
About longest substring without repeats.
Open it in the app and the answers are easier to see than to read.
Open the visualiserWhat does the longest substring without repeats visualiser show?
Every step of the algorithm on input you choose: the window growing and shrinking, with the running total inside it, with the line of code being executed highlighted beside it. You can step forward, step back, or let it play. Spelled visualizer or visualiser, it is the same tool.
What is the time complexity of longest substring without repeats?
O(n) time and O(k) space. The visualiser counts the real operations as it runs, so you can watch the number grow instead of taking the formula on trust.
Why does my longest substring without repeats code fail on some inputs?
Usually one of the known traps. The visualiser ships the real ones for this algorithm (window never shrinks, left moves back), so you can switch the bug on, run it, and watch exactly where the state goes wrong.
Can I use my own input?
Yes. Type your own array, string or graph and the algorithm runs on that, including the edge cases that break a solution in an interview.
Is it free?
Yes. The app is free to start, with 100 AI credits when you sign up and 100 every month, and watching an algorithm costs no credits.