Same Both Ways
Return True if word reads the same from left to right as from right to left, and False otherwise. The empty string and any single character read the same both ways.
For example, "level" gives True and "levels" gives False.
Example 1
word "level"
returns true
Reversed, level is still level.
Example 2
word "levels"
returns false
Reversed, levels becomes slevel, which is different.
Constraints
0 <= len(word) <= 60wordhas lowercase letters only
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Recursion problems
- Suffix ChainBeginner
- Wheels in the RowBeginner
- Deep ReverseEasy
- Depth-Weighted SumEasy
- Digit Product StepsEasy
- Downhill SpillEasy
- Every ArrangementEasy
- Every Riffle ShuffleEasy