Skip to the notes
JSGroundwork
JSGroundwork handwritten · web dev
✎Playground→⌘Problems↻Review🔥Progress

Chapters

20 chapters
⌕
Beginner15›
00Scouting reportR1Screening callR2Machine codingR3JavaScript & TSR3·TSTypeScriptR4React & Next.jsR5Node & NestJSR6Databases & RedisR7DSA roundR8System designR9AWS, Docker, CI/CDR10Resume grillingR11BehaviouralR12HR & the number✓The week before
Advanced5›
50LWhat changes at ₹50L50LHard DSA50LDistributed systems50LRuntime internals50LStaff behavioural
/ search[ ] chaptert top

Ready to read

JSJavaScript⑂Git◎Interview prepΣDSA in JSSDSystem Design
More topics15›
</>HTML{ }CSS⚛ReactNNext.jsNeNest.jsTSTypeScriptNoNode.js🐳DockerDBSQL & Databases✓Testing🔒Web Security☁Cloud & DevOps◈GraphQL◆Redis☸Kubernetes
100%
R7

The DSA round

Length45–60 min
WhoSDE-3 or above
DecidesMid-size product and SaaS loops
Fail modeSilence, or coding before thinking
saasproductserviceagency

Your background shows no competitive programming, so this is your weakest round and the reason to sequence mid-size product companies later in your campaign. The good news: at six years on a full-stack profile they ask easy and medium problems from a narrow set of patterns, not hard graph theory. Pattern recognition beats volume.

If you have three days, not three weeks

Do not attempt breadth. Do the first four patterns only — hash map, two pointers, sliding window, stack — about eight problems each, until recognition is instant. Those four cover the large majority of mediums given to full-stack candidates. Add intervals as a fifth, because your booking-marketplace background means an interviewer may reach for it deliberately.

7.1
The eight patterns that cover most of what you will be asked
What they are really testingRecognition speed. At six years they expect you to name the pattern before you write code.
PatternRecognise it byPractise
Hash map counting"how many", "duplicate", "anagram", "frequency", "seen before"Two Sum · Group Anagrams · Top K Frequent · Valid Anagram · Longest Consecutive Sequence
Two pointersSorted input, a pair or triplet, in-place rearrangementContainer With Most Water · 3Sum · Remove Duplicates · Valid Palindrome · Trapping Rain Water
Sliding window"longest/shortest substring or subarray such that…"Longest Substring Without Repeating Characters · Minimum Window Substring · Max Consecutive Ones III
StackMatching pairs, "next greater", parsing, undoValid Parentheses · Daily Temperatures · Min Stack · Largest Rectangle in Histogram
Binary searchSorted input, or "smallest value that satisfies a monotonic predicate"Search in Rotated Sorted Array · First and Last Position · Koko Eating Bananas
Tree / BFS-DFSAnything with a tree, a grid, or nestingLevel Order · Max Depth · Validate BST · Lowest Common Ancestor · Number of Islands
Intervals your domainStart and end times, booking, calendars, mergingMerge Intervals · Insert Interval · Meeting Rooms II · Non-overlapping Intervals
Basic DP"how many ways", "min cost", overlapping subproblemsClimbing Stairs · House Robber · Coin Change · Longest Increasing Subsequence
7.2
Sliding window — the template to internalise
What they are really testingOne template solves a whole class. Knowing it cold buys you thinking time for the variation.

The shape generalises: expand end every iteration, shrink start while the window is invalid, record the answer. The only thing that changes between problems is what "invalid" means and what state you keep — a count map, a sum, a set.

longest substring without repeating characters
function longest(s) {
  const last = new Map()      // char → last index seen
  let start = 0, best = 0
  for (let end = 0; end < s.length; end++) {
    const c = s[end]
    // only move start forward, never back
    if (last.has(c) && last.get(c) >= start) start = last.get(c) + 1
    last.set(c, end)
    best = Math.max(best, end - start + 1)
  }
  return best
}
// O(n) time, O(min(n, alphabet)) space
They will push with
  • Now do it for at most K distinct characters.
  • What if the string is a stream and you cannot index backwards?
7.3
Intervals — merge, and why this matters for you
What they are really testingYour booking background makes this the problem an interviewer is most likely to pick for you deliberately.

The tie-break in that sort is the whole problem: at the same timestamp, an ending meeting must be processed before a starting one, or a room that just freed up gets double-counted. That is the same half-open [start, end) reasoning from the machine coding round — say so, and connect it to the booking system you built.

function merge(intervals) {
  if (!intervals.length) return []
  intervals.sort((a, b) => a[0] - b[0])        // sort by start — always step one
  const out = [intervals[0]]
  for (const [s, e] of intervals.slice(1)) {
    const last = out[out.length - 1]
    if (s <= last[1]) last[1] = Math.max(last[1], e)   // overlap → extend
    else out.push([s, e])
  }
  return out
}
// O(n log n) — the sort dominates
meeting rooms II — minimum rooms needed
// sweep line: +1 at every start, -1 at every end, take the running max
function minRooms(meetings) {
  const events = []
  for (const [s, e] of meetings) { events.push([s, 1]); events.push([e, -1]) }
  events.sort((a, b) => a[0] - b[0] || a[1] - b[1])   // end before start at equal time
  let cur = 0, best = 0
  for (const [, d] of events) { cur += d; best = Math.max(best, cur) }
  return best
}
They will push with
  • What if meetings can be cancelled dynamically?
  • How would you do this with a heap instead?
7.4
Write an LRU cache with O(1) get and put.
What they are really testingThe most-asked design-flavoured DSA problem, and JavaScript has an elegant answer most candidates miss.

Say out loud why this is O(1): a JavaScript Map guarantees insertion order, and delete plus set is the cheapest way to move a key to the most-recent end. That is language fluency, not a shortcut — but be ready to give the canonical version too, because some interviewers want it.

The canonical answer: a hash map from key to node, plus a doubly linked list with sentinel head and tail. The map gives O(1) lookup; the list gives O(1) move-to-front and O(1) eviction from the tail. The sentinels exist so you never write a null check for the empty case.

the JavaScript answer — Map preserves insertion order
class LRU {
  constructor(cap) { this.cap = cap; this.m = new Map() }

  get(k) {
    if (!this.m.has(k)) return -1
    const v = this.m.get(k)
    this.m.delete(k); this.m.set(k, v)     // re-insert → moves to the end
    return v
  }

  put(k, v) {
    if (this.m.has(k)) this.m.delete(k)
    this.m.set(k, v)
    if (this.m.size > this.cap) {
      this.m.delete(this.m.keys().next().value)   // first key = least recent
    }
  }
}
They will push with
  • Now make it an LFU cache.
  • How would you make it thread-safe? (Trick question in JS — but ask about worker threads.)
  • How does this relate to Redis eviction policies?
7.5
JavaScript-specific implementations they ask senior candidates for
What they are really testingThese are the "DSA" questions a frontend-leaning interviewer actually asks. They are more likely for you than a graph problem.
  • Deep flatten to a given depth, without Array.prototype.flat. Recursive, plus the iterative stack version for when they say "no recursion".
  • Deep clone with circular references — the WeakMap of seen objects from R3.
  • Promise.all from scratch — asked constantly. Index order and the empty array.
  • A promise pool with concurrency N — the highest-value one to have ready.
  • Retry with exponential backoff and jitter.
  • An event emitter with on, off, once, emit. Watch the bug: removing a listener during emit while iterating the live array skips the next one — iterate a copy.
  • memoize with a configurable key resolver and a Map cache.
  • pipe / compose — const pipe = (...fns) => x => fns.reduce((v, f) => f(v), x).
  • Debounce and throttle, with cancel and trailing edge.
  • A deep equality function — handle arrays, dates, NaN, and different key counts.
  • Chunk an array and group by — trivial, but asked as warm-ups.
  • Curry a function of arbitrary arity — fn.length is how you know when it is saturated.
event emitter — with the iteration bug fixed
class Emitter {
  #m = new Map()
  on(e, fn) { (this.#m.get(e) ?? this.#m.set(e, new Set()).get(e)).add(fn); return () => this.off(e, fn) }
  off(e, fn) { this.#m.get(e)?.delete(fn) }
  once(e, fn) { const w = (...a) => { this.off(e, w); fn(...a) }; this.on(e, w) }
  emit(e, ...a) { for (const fn of [...(this.#m.get(e) ?? [])]) fn(...a) }
  //                              ^ copy, so off() during emit is safe
}
7.6
How to run the round when you do not know the answer
What they are really testingThis is the actual skill being assessed at six years. They are hiring your process at least as much as your recall.
  1. Restate the problem and confirm one edge case. Buys thirty seconds and stops you solving the wrong thing.
  2. Give the brute force out loud with its complexity. Never sit in silence — an interviewer cannot score thinking they cannot hear.
  3. Name what makes it slow. "The inner loop re-scans what I have already seen — that is usually a hash map." "The input is sorted and I am scanning linearly — that is usually two pointers or binary search."
  4. State the approach and the complexity before you type, and get agreement. If they say "can you do better than O(n log n)", you have just saved fifteen minutes.
  5. Write it, then dry-run it out loud on a small input — including an empty input and a single element. Finding your own off-by-one is worth more than not having one.

Following that script with a working brute force scores better than a silent optimal solution. And if you are genuinely stuck, say so and ask for a hint — it costs a little, and burning ten minutes in silence costs the round.

2026 note

Complexities you should be able to state without pausing: hash map operations O(1) average; sorting O(n log n); binary search O(log n); BFS/DFS O(V+E); a nested loop O(n²); recursion depth is space. Getting a complexity wrong after solving the problem is a surprisingly common way to lose the round.

←previousDatabases & Redis↑ CovernextSystem design→