Coding Streak
EasyP3Coding
You have N daily logs. Each log is a string over the letters E (eat), S (sleep) and C (code); the i-th character says what you were doing in minute i of that day. A coding streak is a run of consecutive C characters.
Return [X, Y]: X is the longest streak inside a single day, and Y is the longest streak over all days when the logs are joined end to end in order, so a streak can continue from the end of one day to the start of the next.
Example 1
- Input
- logs = ["CCSCC","CEC"]
- Output
- [2,3]
Example 2
- Input
- logs = ["CCC","CCC"]
- Output
- [3,6]
Example 3
- Input
- logs = ["EEE"]
- Output
- [0,0]
Constraints
- 1 <= logs.length <= 100
- 1 <= logs[i].length <= 1440
- Each log contains only 'E', 'S' and 'C'.
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 11. ⌘Enter runs, ⌘⇧Enter submits.