Skip to content
playdsa
Preferences

Make yourself comfortable.

Saved on this browser. Your device’s reduced-motion preference is always respected.

Theme
Advanced settings

The Matrix Staircase

Learn
Play
Prove
Problem context and objectives
Mission briefing

Signal rescue operator · A beacon is hidden inside an ordered frequency band

Lock onto the signal without testing every frequency: The Matrix Staircase.

Each probe costs precious time; searching the wrong half moves the rescue team farther away.

How you win

  1. 1Recognize when Binary search on a virtual matrix matches the clues
  2. 2Keep this true after every move: if the target exists, its virtual flat index remains in the live interval
  3. 3Reach the result within O(log(rows times cols))

Rules and pressure

  • Target cost: O(log(rows times cols))
  • State rule: if the target exists, its virtual flat index remains in the live interval
Lesson 1 of 3

Do not copy the matrix into a flat array. Choose a flat index, then use division and remainder to address that exact cell.

Your call · Where is flat index 5 in a four-column matrix?

Help shape PlayDSA

Something confusing, broken, or missing? Leave a quick note without leaving your lesson.

Please leave out passwords, payment details and other private information.

Page included: /

Sign in to save feedback here, or send it with your email app. Your draft stays here while you sign in.

Open email instead