Loading
Loading
A build system records the version numbers it has cached, in no particular order and possibly with duplicates.
Find the length of the longest run of consecutive version numbers present in the cache.
versions = [100, 4, 200, 1, 3, 2]set{100, 4, 200, 1, 3, 2}1 has no 0 before itrun start — count 1,2,3,4100 has no 99run of length 1longest44Sign in to keep a note here. It is free, and nobody else can see it.
Sign inExample 1
Sign in to open hints.
Struggling is where the learning happens. Open this once you have genuinely tried, or once the hints have run out.
O(n) time · O(n) space
Input. Run your code to watch it work on this input, one line at a time.
Running code is turned off on this deployment. You can still read the problem, write code, use hints and the visualizer.
Tab moves focus out of the editor. Press Ctrl+M to let Tab indent instead.
No results yet
Run your code against the sample tests, or submit to run the full suite.
1, 2, 3, 4.
Example 2