Created
December 21, 2021 02:16
-
-
Save eggplants/9888586db63c639dfb9568996e1de9d8 to your computer and use it in GitHub Desktop.
回文判定 ruby
This file contains hidden or 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
class String | |
def is_kaibun | |
(a=self)[0,_=(a.size/2).to_i]==a[-_,_*2].reverse | |
end | |
end | |
#=> String#is_kaibun |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment