A palindrome reads the same forwards and backwards. Compare opposite ends until they meet.
A palindrome reads the same forwards and backwards. You compare the first letter to the last, then step inward. If every pair matches, the word is a palindrome. level is yes; hello is no.
ok
ok
middle
output
Each step highlights the matching C line. Program output appears only when a line that prints actually runs.
Five questions. Pick one answer each, then Check answers. The correct choice turns green.
1. level prints:
All pairs match.
2. hello would print:
h != o.
3. The middle letter of odd length:
i < n-1-i stops at the middle.
4. ok starts as 1 meaning:
Flag.
5. You could also reverse into another buffer and strcmp. That would:
Two algorithms, one question.