Difficulty : Easy
Pre-requisites : Simple Iteration
We will iterate over the string and keep a counter of maximum obtained upto now and the smallest character corresponding to that maximum number, We will
update this information depending on whether the current number is equal to last number or not. Time complexity of this is O(N).
One possible issue was people were not considering the last part of the string. eg aabbb. In this case, they were not counting bbb part.
Tester’s solution: link