r/ProgrammerTIL • u/mehdifarsi • Feb 15 '23
Other Implementing a palindrome checker in Ruby
In this video, you'll learn about:
- Regex - POSIX bracket expression
- class reopening
- mixin
- string comparison
Link: https://www.youtube.com/watch?v=LQAxvxsyKLE (there is a link to the ASCII version in the video description).
0
Upvotes
View all comments
Show parent comment
2
u/pain-and-panic Feb 15 '23
Yeah I was thinking something very similar. If you wanted to avoid allocating the memory for an entirely separate copy of the string you could iterate backwards through the string and compare it to the forwards iteration of the string.
Does Ruby have negative array indexes?