Pointer Patterns, step by step

🏦 Interview rounds →

🧭 Step 1: Answer the questions

⏱ Step 2: The 60-second routine (tap through it on each problem)

🃏 Step 3: Pattern cards (scan the clue tags)

⏱ What is Big O?

Time complexity answers: "If the input gets 10× bigger, how much more work is there?"
Space complexity answers: "How much extra memory do I need?" (the input itself doesn't count).
We drop constants and keep only the fastest-growing term, so 3n + 5 becomes O(n).

📈 Drag to grow n

n = 10
Each bar shows how many steps it takes, on a log scale so they all fit. At n = 1000, O(n²) is already 1,000,000 steps.

🔎 How to spot it from code shape

💾 How to spot space

📋 The patterns at a glance

🔤 What the letters mean
n is the size of the input, for example how many numbers are in the list.
k is a second number the problem gives you. In "find the top k" or "a window of size k", k = 3 means you only keep 3 things around.
V (vertices) is the number of points or cells, and E (edges) is the number of connections between them. In a 3×4 grid, V = 12 cells and each cell has up to 4 neighbours, so it's O(rows × cols).
states (in DP) is how many different dp[i] values you fill in, like the 7 boxes in the Climbing Stairs demo.

🗣 How to say it in the interview

"This runs in O(n) time because each element is visited once, and O(n) space for the dict. If memory mattered, I could sort first and use two pointers, which is O(n log n) time and O(1) space."

🔍 Look inside