All Challenges

Virtualized Long List Renderer (10,000 Rows)

JavaScriptHardGoogleFlipkartSlack
45:00

Problem Brief

Render a 10,000-row dataset inside a fixed-height scroll container while keeping fewer than 30 DOM row nodes mounted at any scroll offset.

Requirements

  • Total dataset size is `10000` rows (`Row #0` .. `Row #9999`), each `40px` tall.
  • Scroll container `[data-testid="vlist-viewport"]` has height `320px` and mounts only visible rows + overscan (`< 30` `.vrow` nodes).
  • Scrolling `viewport.scrollTop = 20000` mounts rows near `Row #500` cleanly.
Progressive Hints (1)
  • Calculate `start = Math.floor(scrollTop / ROW_H)` and `end = start + Math.ceil(VIEW_H / ROW_H) + OVERSCAN`; position slice via `translateY(start * ROW_H px)`.
Reference Solution

Stuck? Load the verified reference code into your editor.

Automated Test Suite

2 Test Cases Ready
  • Keeps DOM node count under 30 for 10,000 rowsOnly visible slice + small overscan mounted in DOM
  • Updates rendered rows dynamically on scrollTop changeScrolling to 20000px renders Row #500
solution.html
Live Sandboxed Previewiframe sandbox
Starter template loaded — add your <script> logic in the editor (or open Reference Solution) to make the widget interactive.