see title. what's the meaning of this problem if we can just use indexOf()
Using indexOf did return ACCEPTED...
I just did it in this way and it's the simplest way to solve the problem.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.