about | help | code help+videos | done | prefs |
In a string, a "run" is defined as the same character occurring multiple times consecutively. The length of the run is the number of times the character appears consecutively in that run. For example, in string "xaabcdeeeeax" "aa" which is a run of length 2, and "eeee" which is a run of length 4. We will say that the shortest possible run has length 2 (so, a single character is not considered a run). Given a string, return the length of its longest run. If the string does not contain a run, return 0. longestRun("xaabcdeeeeax") → 4 longestRun("wwwxyyz") → 3 longestRun("www") → 3 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 300
Copyright Nick Parlante 2017 - privacy