The One-Way Street
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L3
Problem
You're profiling a numeric column pulled from a metrics export, hunting for the longest stretch where the readings only ever move one way. Given `arr`, return the length of the longest contiguous run that stays entirely non-decreasing or entirely non-increasing.
Summary
The longest stretch that never turns around.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.