The Overwritten Hour
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- mid
Problem
A fixed-size ring buffer stores tick timestamps in ascending order, but once the writer looped back to the start it overwrote the head, so the values now read as one ascending run that wraps around a single pivot. Given `readings` in that wrapped order and a `target`, return the index where `target` sits, or `-1` if it is not present. The values are distinct, and the buffer is large enough that a probe should lean on its ordering rather than touch every slot.
Summary
The log wrapped on itself. The order is still there, just not where you would look.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.