Interview rounds · 26 concepts
Machine coding
How to run a 60–90 minute build round, and the UI patterns that keep coming back, with the details graders check.
Asked in these mock interviews
Part 1 · 4 concepts
Running a machine-coding round
- 01
Plan a 60–90 minute machine-coding round
Spend the first 5–10 minutes clarifying and planning components and state, have one flow working end to end by about a third of the time, add features in priority order…
- 02
Talk while you code, and test as you go
Narrate your decisions in short sentences: what you are building, why this state, which edge case you are handling. Check each step as soon as it exists, ask narrow…
- 03
Vanilla JS vs React rounds
In a vanilla round, keep one state object, write a render step that updates the DOM from state, use event delegation, wrap each widget in a module or class so several…
- 04
State design for UI components
Keep the smallest state that cannot be computed and derive everything else. Give each piece of state one owner, use a status value instead of several booleans, and move…
Part 2 · 3 concepts
Forms and inputs
- 05
Forms with validation (and schema-driven forms)
Keep one values object with errors and touched flags, validate with pure rule functions on blur and on submit, show errors only after a field is touched, and wire every…
- 06
OTP input
An OTP input keeps one array of digits as the single source of truth, moves focus forward on input and back on Backspace, fills every box from a paste, accepts only…
- 07
Star rating
A star rating is a radio group: the value is state, the hover preview is separate state that never overwrites the value, clicking sets the value, arrow keys change it…
Part 3 · 7 concepts
Search, lists and data
- 08
Debounced search with race-condition handling
A search box waits until the user pauses typing (debounce), cancels the previous request with AbortController, ignores any response that is not for the latest query…
- 09
Autocomplete / combobox component
An autocomplete builds on debounced search with an activeIndex for keyboard navigation, the ARIA combobox roles with focus kept on the input, safe highlighting of the…
- 10
Pagination component
A pagination component reads the current page from the URL, computes the page list with ellipses, disables Previous and Next at the ends, marks the current page with…
- 11
Infinite scroll with IntersectionObserver
Infinite scroll puts a sentinel element after the last item, observes it with IntersectionObserver (with a rootMargin so loading starts early), loads the next page only…
- 12
Virtualised list (windowing) by hand
A virtualised list renders only the rows inside the viewport plus a small overscan, inside a container as tall as the whole list, computing the visible range from…
- 13
Data table with sort, filter and pagination
A data table is driven by a column config, keeps sort, filter, page and selection as state, and derives the visible rows in a pipeline—filter, then a stable typed sort…
- 14
Polling with backoff
Polling chains setTimeout calls so requests never overlap, stops when a final state arrives, backs off exponentially (with a cap and jitter) after errors, pauses while…
Part 4 · 4 concepts
Overlays and disclosure widgets
- 15
Modal dialog with a focus trap
A modal dialog renders above everything, labels itself, moves focus inside when it opens, keeps Tab inside, closes on Escape (only the top one), makes the background…
- 16
Tabs and accordion with keyboard support
Tabs use tablist, tab and tabpanel roles with one tab in the Tab order and arrow keys to move between tabs; an accordion uses a heading with a button that toggles…
- 17
Toast / notification queue
A toast system exposes a global API (toast.success('Saved')) backed by a queue that shows at most a few toasts, auto-dismisses each with a timer that pauses on hover or…
- 18
Image carousel
A carousel keeps one index in state, wraps it safely with ((i % n) + n) % n, moves the track with a CSS transform, autoplays with an interval that is cleaned up and…
Part 5 · 3 concepts
Trees, comments and drag and drop
- 19
File explorer tree (recursion)
A file explorer renders a tree with a recursive component, keeps the data (folders and files) separate from UI state (expanded ids as a Set, the selected id), changes…
- 20
Nested comments
Nested comments turn a flat list with parentId into a tree in O(n) with a Map, render it recursively with a depth limit, keep one 'replying to' id in state, soft-delete…
- 21
Drag and drop and a Kanban board
A Kanban board stores columns as ordered lists of card ids, moves cards with one pure moveCard function, implements dragging with HTML5 drag events or pointer events…
Part 6 · 4 concepts
Timers, games and history
- 22
Countdown, stopwatch and timers
A correct timer never counts ticks: it stores when it started and how much time had already passed, computes the display from timestamps, uses the interval only to…
- 23
Progress bars, queues and steppers
Progress-bar rounds escalate from one animated bar, to bars that run one after another, to at most N running at once (a concurrency-limited queue); steppers are the…
- 24
Game state: tic-tac-toe and grid games
Game rounds are state-design tests: keep the board and move history as the only state, derive the current player and the winner, put the rules in pure functions you can…
- 25
Undo and redo
Undo/redo keeps a past stack, the present and a future stack: a new action pushes the present onto past and clears future, undo moves present to future, redo moves it…
Part 7 · 1 concept
What companies ask
- 26
What Indian product companies ask in machine coding
Machine coding is usually the first filter at Indian product companies: Flipkart wants modular vanilla JavaScript apps in 90–180 minutes followed by a code walkthrough…
Your first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.