Last active
December 2, 2018 13:23
-
-
Save alexandersazonof/9bcf8105213bafa8893329f48c5e5a33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Дана строка. Необходимо проверить, является ли она палиндромом. | |
str = "kazask" | |
if str == str.reverse | |
puts "#{str} является палиндромом" | |
else | |
puts "#{str} не является палиндромом" | |
end |
А как избежать проблемы букв разной высоты?
class String
def is_palindrome?
self.downcase == self.reverse.downcase
end
end
🥇
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
А как избежать проблемы букв разной высоты?