← Questions

Longest run of identical consecutive items

0
NetflixCodingLast asked Jul 2026

Given a sequence, such as a string or the list of shows a user watched in order, return the longest run of the same item repeated back to back: its length and the item (and its position if asked). Handle ties and the empty input, in one pass.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding