Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,9 @@
isBalanced = function(str)
level = 0
for c in str
if c == "[" then level = level + 1
if c == "]" then level = level - 1
if level < 0 then return false
end for
return level == 0
end function

View file

@ -0,0 +1,15 @@
examples = [
"",
"[]",
"[][]",
"[[][]]",
"][",
"][][",
"[]][[]",
"[[[]"]
for str in examples
balanced = isBalanced(str)
if balanced then outcome = "is OK" else outcome = "NOT OK"
print """" + str + """ " + outcome
end for