思路
- First one is two loops to find. Two pointers.
- Logic Loopholes
- String s = “z”
- Only compares the i behind is not right. You have to check every one
- not time efficient
- Logic Loopholes
- Second thought, inspired by others, use frequency
- Logic Loophole: after the frequency is got. you have to return the index of the character, not the character itself
- Third thought is the optimization of the second thought. use just one loop
- Forth, use bitMap
- Fifth, Use map and set together