Finding the longest consecutive run in a sequence
This easy coding problem tests your ability to scan through a sequence and track state—a pattern that appears frequently in market-data processing. Quant trading teams ask this kind of question to verify that you can write clean, correct code quickly, even under time pressure.
The core skill is recognizing when to reset a counter and when to accumulate it. You'll need to handle edge cases like empty input, sequences with no heads at all, and runs that extend to the end of the list. Most candidates solve this in a single linear pass without extra data structures.
- Single-pass scanning and state tracking
- Boundary and edge-case handling
- Comparing and updating a running maximum