Reported September 2026
Kickdrumsimulation

Undo/Redo Timeline State Engine

Reported by candidates from Kickdrum's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Kickdrum OA. Under 2s to a working solution.
Founder's read

Kickdrum reportedly asked this one in September 2026, and the constraints are the whole story. Up to 200000 operations with navigation counts up to 10^9 means you can't walk step by step on every UNDO or REDO. It's a simulation problem dressed up as an editor history. If your OA is in a day or two, the job is to spot that one array and one index handle everything, and that k gets clamped, not looped. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but the idea fits in about ten lines.

The problem

A timeline begins at initialState. Process operations and return the active state after every operation.
"DO state" creates and activates a new state after the current one. It permanently discards every redoable future state.
"UNDO k" moves back by at most k states and stops at the initial state.
"REDO k" moves forward by at most k states and stops at the newest state on the current branch.
"CURRENT" only observes the active state.

Function
runTimeline(initialState: String, operations: String[]) → String[]

Examples
Example 1
initialState = "Origin"
operations = ["DO A","DO B","UNDO 1","CURRENT","REDO 1"]
return = ["A","B","A","A","B"]
Undo moves from B to A, CURRENT leaves A active, and REDO returns to B.
Example 2
initialState = "Basic"
operations = ["DO Soup","DO Curry","UNDO 1","DO Salad","REDO 5"]
return = ["Soup","Curry","Soup","Salad","Salad"]
Doing Salad from Soup discards the old Curry redo branch, so the final REDO stays at Salad.

Constraints
1 <= operations.length <= 200000.
Every state is a unique token of 1 to 30 ASCII letters, digits, or underscores.
Every navigation count satisfies 0 <= k <= 10^9.
Every operation has exactly one of the documented forms.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Keep a list of states and a pointer to the active index. DO state: truncate the list to pointer+1, append the new state, move the pointer to the end. That truncation is the discarded redo branch. UNDO k: pointer = max(0, pointer - k). REDO k: pointer = min(list.length - 1, pointer + k). CURRENT: do nothing. After each operation, push list[pointer] to the output. The brute-force trap is looping k times, which dies at 10^9. Clamp with min and max instead. The second trap is forgetting to drop the future on DO, which breaks Example 2. Truncating is amortized O(1) per op because each state is appended once and removed at most once, so total work is O(n). Parse by splitting on the space. StealthCoder is the hedge if the pointer logic slips under pressure, but you should be able to write this unaided.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Undo/Redo Timeline State Engine cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as design browser history. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Kickdrum's OA.

Kickdrum reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Undo/Redo Timeline State Engine FAQ

How hard is the Kickdrum Undo/Redo Timeline problem really?+

Easy to medium. There's no fancy algorithm, just a list and a pointer. The difficulty is noticing that k up to 10^9 needs clamping instead of looping, and handling the truncation on DO correctly. Most candidates who get that finish quickly.

What's the trick to the Undo/Redo Timeline problem?+

Store states in an array with an active index. UNDO and REDO are just index changes clamped to 0 and the last position. DO cuts the array after the active index, appends the new state, and moves the index to the end.

Why can't I just loop k times for UNDO and REDO?+

With k up to 10^9 and 200000 operations, looping blows up the runtime. You only need the final position, which is a single min or max calculation. The loop adds nothing because stopping at the boundary is the only effect.

What edge cases should I test before submitting?+

Test UNDO 0 and REDO 0, UNDO past the initial state, REDO with nothing to redo, and DO after an UNDO to confirm the old branch is gone. Also check that CURRENT still outputs the active state and that the initial state can be returned.

How do I prepare for this in 48 hours?+

Write this one from scratch twice with a list and a pointer. Then do two or three similar simulation problems like browser history. Focus on boundary clamping and on reading each rule in the statement literally.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Kickdrum.

OA at Kickdrum?
Invisible during screen share
Get it