What we're doing above is specifying two pointers, start
and end
. start
points to the beginning of the string, and end
is a pointer to the last character. Taking the example input racecar
, as we run through it, these are the comparisons we'll see:
xxxxxxxxxx
racecar
^ ^
racecar
^ ^
racecar
^ ^
racecar
^
True
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment