Most Repetition
Start Timer
0:00:00
Given a string str
of any length, write an algorithm max_repeating
to return which character has the longest string of continuous repetition.
If two characters are tied for most continuous repetition, return the character whose longest continuous repetition occurs earliest in str
.
Example 1:
Input:
str = 'aabbaaccbbbaa'
def max_repeating(str) -> b
Example 2:
Input:
str = 'adccccbbbbc'
def max_repeating(str) -> c
Recommended questions for you
Personalized based on your user activity, skill level, and preferences.
.
.
.
.
.
.
.
.
.
Comments