X248: maxBlock

Given a string, return the length of the largest "block" in the string. A block is a run of adjacent chars that are the same.

Examples:

maxBlock("hoopla") -> 2
maxBlock("abbCCCddBBBxx") -> 3
maxBlock("") -> 0

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.