Interview rounds · 30 concepts
DSA in JavaScript
The data structures and patterns coding rounds ask, written and tested in JavaScript, with the frontend-flavoured problems at the end.
Asked in these mock interviews
Part 1 · 4 concepts
JavaScript foundations for coding rounds
- 01
Big-O in JavaScript
Big-O says how time or memory grows when the input size n grows, keeping only the biggest term. In JavaScript, many built-ins hide a loop (includes, indexOf, shift…
- 02
JavaScript gotchas in coding rounds
In JavaScript, sort() compares strings unless you pass a comparator, all numbers are 64-bit floats with no integer type, Map keeps insertion order, and deep recursion…
- 03
Arrays and strings in JavaScript
Most array and string problems are one pass with a few running variables, a prefix sum or a write pointer. In JavaScript, strings cannot be changed in place, so edit an…
- 04
Map and Set in JavaScript
A Map or Set turns 'have I seen this?' and 'how many of these?' into O(1) average lookups, which is the move behind two-sum, grouping, counting and removing duplicates…
Part 2 · 6 concepts
Linear patterns
- 05
Two pointers in JavaScript
Two pointers walk a sorted array or a string from both ends (or at two speeds), so a pair search drops from O(n²) to O(n) with O(1) extra space. In JavaScript, sort…
- 06
Sliding window in JavaScript
A sliding window keeps a range [left, right] and updates its state as right grows and left shrinks, so best-substring and best-subarray problems run in O(n). In…
- 07
Stacks and queues in JavaScript
A stack (last in, first out) matches nested or 'most recent' things like brackets, undo and expression parsing, and a queue (first in, first out) drives BFS. In…
- 08
Binary search in JavaScript
Binary search halves a sorted range (or a range of possible answers) each step, giving O(log n). JavaScript has no built-in binary search (indexOf and includes are…
- 09
Sorting and intervals in JavaScript
Sort intervals by start, then one pass merges overlaps, and sorting start and end times separately (a sweep line) tells how many overlap at once; in JavaScript the…
- 10
Linked lists in JavaScript
A linked list is nodes with next pointers, so problems are about re-wiring pointers safely. JavaScript has no built-in linked list: write a small node class, keep a…
Part 3 · 5 concepts
Recursion, trees and heaps
- 11
Recursion in JavaScript
A recursive function solves a small base case directly and calls itself on a smaller input. In JavaScript every call waits on the call stack, deep calls throw…
- 12
Backtracking in JavaScript
Backtracking builds a solution step by step: try a choice, recurse, then undo it. It lists subsets, permutations and combinations, and pruning cuts branches that cannot…
- 13
Trees and the DOM in JavaScript
A tree is visited depth-first (pre-, in- or post-order, with recursion or a stack) or breadth-first level by level with a queue. The DOM is such a tree (children…
- 14
Heaps and priority queues in JavaScript
JavaScript has no built-in heap, so you write a small binary heap in an array (the parent of i is (i − 1) >> 1) with a comparator. It gives O(log n) push and pop, and…
- 15
Tries for autocomplete
A trie stores words character by character in a tree of Maps, so 'all words with this prefix' costs O(length of prefix) to find the node plus the size of the results…
Part 4 · 3 concepts
Graphs and grids
- 16
Graph basics in JavaScript
Store a graph as an adjacency list: an array of arrays for numbered nodes, or a Map from id to neighbours for string ids. Use BFS for shortest paths when edges have no…
- 17
Matrix and grid BFS in JavaScript
A grid is a graph where each cell links to its 4 (or 8) neighbours, so islands, flood fill and 'spread' problems are BFS or DFS with bounds checks and a visited mark…
- 18
Union-find (light) in JavaScript
Union-find keeps groups of connected items in a parent array: find walks to the group's root (with path compression) and union joins two roots, so 'are these…
Part 5 · 2 concepts
Dynamic programming
- 19
Dynamic programming in JavaScript: the intro
Dynamic programming builds the answer from smaller overlapping sub-problems, top-down with memoised recursion or bottom-up with a table, once you can write the…
- 20
Two-dimensional DP in JavaScript (strings and grids)
When the state needs two indices (a cell, or a position in each of two strings), dp[i][j] is filled from its top, left and diagonal neighbours: grid paths, longest…
Part 6 · 2 concepts
Bits and string matching
- 21
Bit tricks in JavaScript
JavaScript bitwise operators work on 32-bit signed integers, and a few tricks—x & (x − 1) clears the lowest set bit, XOR cancels pairs, masks store sets of flags—solve…
- 22
String matching: indexOf, KMP and safe regex
Finding a pattern in text is O(n·m) done naively, O(n + m) with KMP's prefix function, and in UI code it usually means indexOf or a RegExp built from user input, which…
Part 7 · 8 concepts
Frontend-flavoured problems
- 23
DOM tree problems
DOM questions are tree questions with DOM details: walk element.children (not childNodes) with DFS or BFS, match classes by token, and for 'find the same node in a…
- 24
Flatten nested arrays and objects
Flattening walks a nested structure and emits leaves, with recursion or an explicit stack, and the senior details are the depth limit, holes, key paths for objects, and…
- 25
Deep equal and JSON diff
Deep equality and JSON diff both walk two structures together: equal types, then equal keys, then recurse, and a diff records add, remove and replace operations with…
- 26
LRU and LFU cache design
An LRU cache evicts the least recently used key in O(1): in JavaScript a Map already keeps insertion order, so get is delete-then-set and eviction removes…
- 27
Event scheduling: overlapping calendar events
To lay out a calendar day, sort events by start, group events that overlap into clusters, give each event the first free column in its cluster, and make every event in…
- 28
Rate limiters: token bucket and sliding window
A rate limiter decides whether an action may happen now: a token bucket refills tokens at a fixed rate and allows bursts up to its capacity, and a sliding-window log…
- 29
Promise task scheduler with concurrency and priorities
A task scheduler keeps a queue of async functions, runs at most limit at once, starts the highest-priority waiting task whenever one finishes, and gives each caller a…
- 30
Virtual DOM diff and keyed list reconciliation
A virtual DOM diff compares two trees of plain objects with cheap rules—different type means replace the subtree, same type means patch props and diff children—and keys…
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.