You are given a string that is grouped together by characters. For example a sample input could be: "hhzzzzaaa", and we need to output the most frequently occuring character so for our example we would output 'z'.
I was only asked this question on the phone screen.
Brute Force:
Optimization 1:
I thought Linear time and constant space was the optimal solution, but it turns out the interviewer wanted me to optimize further into Log N time and constant space. This is where I struggled. After a hint I was able to code out the binary search solution.
Still waiting for the results. How do you think I did?
Personally I feel like I could have passed, but on the other hand I feel bad for not getting the binary search solution without a hint...
The interviewer had a poker face the entire time. I could not deduce anything about my interview performance..