How-to

How to Study for a Coding Interview with Animated Patterns

Most coding interview problems are about fifteen patterns in disguise, and the skill being tested is spotting which one from the wording. Here is a signal-to-pattern table, a four-week plan built on recognition drills, and how to use animations without mistaking watching for practice.
By openCanviz • October 15, 2026

8 min read

To study for a coding interview with animated patterns, learn about fifteen core patterns (sliding window, two pointers, binary search, BFS, DFS, heaps, dynamic programming and a few others) and, for each one, the signal in a problem statement that points to it. Watch or make a short animation of each pattern so you can see the pointers move and the state change, then spend most of your time on recognition drills: read a problem, name the pattern and the reason within two minutes, and only then code it. Interviewers rarely ask a problem you have seen. They ask one whose pattern you have seen, wearing different clothes, and spotting it quickly is most of the battle.

Why pattern recognition is the real skill

Grinding hundreds of problems works for some people, but mostly by accident. After enough problems, you start to see that "longest substring with at most k distinct characters" and "maximum sum subarray of size k" are the same move. The grind is slow pattern recognition training.

You can train recognition directly. The steps are: know the patterns, know what each one looks like in action, and practise mapping problem wording to pattern until it is fast. This post is about that study plan. If you want to make revision videos of the specific problems you got wrong, that is a different job, covered in how to make a coding interview prep video for yourself.

The signal-to-pattern table

This is the table to learn. The left column is what you read in the problem; the right is what you should be thinking within a minute.

Signal in the problemPatternTypical time
Contiguous subarray or substring; "longest", "shortest", "at most k"Sliding windowO(n)
Sorted array; find a pair or triple with a target sum; in-place removalTwo pointersO(n) or O(n squared) for triples
Linked list cycle; middle of a list; "happy number" style repetitionFast and slow pointersO(n)
Sorted input, or a monotonic yes/no question about the answer ("minimum capacity that works")Binary search, including binary search on the answerO(log n) or O(n log n)
Range sums, especially with negative numbers; "subarray sum equals k"Prefix sums with a hash mapO(n)
Shortest path in an unweighted grid or graph; "minimum number of steps"Breadth-first searchO(V + E)
Explore all connected regions; "number of islands"; tree path questionsDepth-first searchO(V + E)
"Top k", "k closest", "kth largest", merge k sorted listsHeap (priority queue)O(n log k)
Overlapping intervals; meeting rooms; merge rangesSort by start, then sweepO(n log n)
"Next greater element", "daily temperatures", largest rectangle in a histogramMonotonic stackO(n)
Dependencies, prerequisites, build orderTopological sortO(V + E)
Are these connected; number of groups; redundant connectionUnion-findNearly O(1) per operation
"All combinations", "all permutations", "all subsets", N-queensBacktrackingExponential
"Number of ways", "minimum cost", choices that reuse subresultsDynamic programmingDepends on the state
Prefix matching, autocomplete, word search over a dictionaryTrieO(length of word)

Two traps are worth learning alongside the table. Sliding window breaks when the array has negative numbers and you are tracking a sum, because growing the window no longer only increases the total; that is when prefix sums take over. And "shortest path" means BFS only when every edge has the same cost; weighted edges need Dijkstra's algorithm.

Why animation helps for this particular subject

Most of these patterns are about state that changes over time: two indices moving, a window growing and shrinking, a queue filling level by level, a stack popping when a bigger element arrives. A static diagram shows you one frame. Code shows you the rules but not the motion. An animation shows you the motion, and the motion is what you have to simulate in your head during the interview.

Take sliding window on the classic problem: longest substring without repeating characters, input "abcabcbb", answer 3.

A good animation of it has these beats.

  1. The string drawn as eight boxes, with a left pointer and a right pointer both on the first "a", and an empty set beside it labelled "in window".
  2. The right pointer moves to "b", then "c". The set fills: a, b, c. A counter reads "best: 3".
  3. The right pointer reaches the second "a". The "a" box flashes, because "a" is already in the set.
  4. The left pointer moves forward one step, removing the first "a" from the set. The window is now "bca", length 3.
  5. The same thing repeats for "b" and "c". The best stays at 3.
  6. At the seventh character, a "b", the window is "abc" and the left pointer has to move two steps, dropping "a" and then "b", before the window is valid again. That multi-step shrink is the moment students most often get wrong in code.
  7. A closing frame with the rule in one line: grow on the right, shrink on the left until the window is valid again, record the best after each step.

Watching that once makes the invariant ("the window never contains a duplicate") visible in a way that reading the code does not. That is the honest use of animation here: it teaches the shape of the pattern quickly. It does not make you able to code it.

The study plan

Four weeks, about an hour a day, assuming you already know one language well.

Week 1: learn the patterns. Three or four patterns a day. For each, watch or make a short animation, then code one easy, canonical problem from scratch without looking. Write the signal from the table on a card.

Week 2: recognition drills. Take a list of 40 to 60 problems you have not solved. For each one, read only the statement, set a two-minute timer, and write the pattern and one sentence of why. Do not code. Then check against a solution. This is the part almost everyone skips and the part that matters most.

Week 3: mixed practice. Solve medium problems in random order, never grouped by pattern. Grouped practice ("today is BFS day") tells you the pattern before you start, which removes the skill you are training. Interleaving is harder and it is what the interview feels like.

Week 4: timed mocks. Two problems in 45 minutes, talking aloud. Start every answer by saying the pattern and the signal: "This is a contiguous substring with a constraint, so I am thinking sliding window." Interviewers hear that sentence as structured thinking, which is a large part of what they score.

Keep a mistakes log throughout. When you miss a pattern in a drill, write the problem, the signal you missed, and the pattern it was. Those entries are the material for your own revision videos.

Make it

  1. 1

    Pick one pattern and one canonical problem

    Sliding window with longest substring without repeating characters is a good first one. Choose a short input you can trace by hand, such as abcabcbb.

  2. 2

    Write the trace as a script

    One short paragraph per step of the trace: where each pointer is, what is in the window, what the best answer is so far. End with the rule in one sentence. Six to eight paragraphs is plenty.

  3. 3

    Paste it into openCanviz

    Choose Keep my wording so the narration says exactly what you traced, and set a target length of about two minutes. Whiteboard style suits this: boxes and arrows drawn as each step is read.

  4. 4

    Check every pointer position

    Pause on each scene and compare with your hand trace. A drafted drawing can put a pointer on the wrong box or skip a step. Fix those scenes in the editor, because a wrong frame teaches the wrong invariant.

  5. 5

    Pause and predict when you review

    Before each scene plays, say where the pointers will move next. If you cannot, you do not know the pattern yet. Then go and code it from a blank file.

What animation will not do for you

It will not give you fluency in your language. Off-by-one errors, forgetting to handle an empty input, and not knowing the standard library's heap API all lose interviews, and only writing code fixes them.

It will not teach complexity analysis by itself. Say the time and space cost out loud for every problem you solve, including the drills.

And it can give you a false sense of mastery. Watching a window slide is pleasant and passive. If you have watched more animations than you have solved problems this week, the balance is wrong.

Common questions

How many patterns do I need to know? The fifteen in the table cover most problems at most companies. Some lists go to twenty or more by splitting variants (cyclic sort, bit manipulation, two heaps). Learn the core first.

Should I memorise solutions? No. Memorise signals and invariants: what tells you it is a sliding window, and what must be true of the window after every step. Solutions follow from those.

Is it worth making my own animations instead of watching other people's? For the two or three patterns you find hardest, yes. Writing the trace is itself a study session, and a narrated version you can rewatch is useful revision. For the others, any clear animation is fine.

How does this apply to system design interviews? The idea transfers (recognise the shape, then apply it) but the patterns are different: caching, sharding, queues, replication. A drawn explainer of a request flow works well there. See how to illustrate abstract ideas for how to pick the right shape.

Can I use this for university algorithms exams too? Yes, the same patterns appear in algorithms courses with more emphasis on proof and complexity. See how to revise computer science theory.

Run one recognition drill today

Open a list of ten problems you have not solved, read only the statements, and give yourself two minutes each to write the pattern and the signal that told you. Check your answers. Your misses are the patterns to animate first. It is free to start.

Made with openCanviz

Turn any concept into an animated explainer

Type an outline, get a narrated, animated whiteboard video in minutes. No design skills, no timeline scrubbing. Free to start.

Start free
Keep reading
How to Make a Nursery Rhyme Video

A home-made nursery rhyme video for a toddler should be slow, short and spoken, with one calm picture per line and the rhyme said twice so a child can join in. How to choose a traditional rhyme, script it, draw it, and use it in a way that fits the screen time advice for under-fives.

How to Make a Kids' Science Video

A good science video for young children answers one question they actually asked, in two or three minutes, with a simplification that is never false, and ends by sending them off to try something. A worked example on why the sky is blue, with the script, scenes and a kitchen experiment.

How to Make a Birthday Video for a Child

A child's birthday video works best as a one to two minute story with the child at the centre: their name, their age, the animals or things they love. A practical plan with a worked animal birthday party script, a scene list, and the privacy checks to make before you share it.

How to Make an Explainer Video for Your Startup Homepage

A homepage explainer has to work muted, make its point in the first five seconds, and not slow the page down. Here is the one-diagram structure for a 60 to 90 second video, the placement and embed settings that matter, and how to tell whether it is helping signups.


All Rights Reserved.