Google | OA | longest substring with all chars of same occurrence
Anonymous User
1888

google OA: given a string with all lowercase english letters, find the longest substring with all characters of same occuurence.
EX: "aabbccmedf", this should return "aabbcc" since all chars(a,b,c) have the same occurrence of 2.

I believe we can find all substrings and for each substring, check if all chars have same occurs, any other better approach ? Looks like it's a sliding window problem, but can't model it.

Comments (7)