Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,6 @@
|
|||
fn isPalindrome s =
|
||||
(
|
||||
local reversed = ""
|
||||
for i in s.count to 1 by -1 do reversed += s[i]
|
||||
return reversed == s
|
||||
)
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
fn isPalindrome_r s =
|
||||
(
|
||||
if s.count <= 1 then
|
||||
(
|
||||
true
|
||||
)
|
||||
else
|
||||
(
|
||||
if s[1] != s[s.count] then
|
||||
(
|
||||
return false
|
||||
)
|
||||
isPalindrome_r (substring s 2 (s.count-2))
|
||||
)
|
||||
)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
local p = "ingirumimusnocteetconsumimurigni"
|
||||
format ("'%' is a palindrome? %\n") p (isPalindrome p)
|
||||
format ("'%' is a palindrome? %\n") p (isPalindrome_r p)
|
||||
Loading…
Add table
Add a link
Reference in a new issue