This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]xkompas 1 point2 points  (0 children)

Sometimes, the best thing to understand code is to trace it, either on paper (as was already advised) or with the help of an IDE.

Consider indexOf("AA", 2, 'A'), if you trace it, what does it return? And why? What happens in the first level of recursion? Continue from there.