GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • All topics
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 20 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
Log inStart free
Gamified challengesRotated Vault Search

Gamified challenge · Modified binary search

Rotated Vault Search

The vault's drawers held distinct codes in increasing order, but the dial was turned: the list was cut at some point and the back part moved to the front. For example [0, 1, 2, 4, 5, 6, 7] may now read [4, 5, 6, 7, 0, 1, 2]. It may also not be turned at all.

Write search(nums, target) that returns the index of target in nums, or -1 if it isn't there. Aim for O(log n) probes: at any midpoint, at least one of the two halves is still sorted.

Example: search([4, 5, 6, 7, 0, 1, 2], 0) is 4, and search([4, 5, 6, 7, 0, 1, 2], 3) is -1.

Sign in to play Rotated Vault Search

This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.

Sign in with Google

or log in with email · create an account