Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,9 +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
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ examples = [
|
|||
"[[[]"]
|
||||
|
||||
for str in examples
|
||||
balanced = isBalanced(str)
|
||||
if balanced then outcome = "is OK" else outcome = "NOT OK"
|
||||
print """" + str + """ " + outcome
|
||||
balanced = isBalanced(str)
|
||||
if balanced then outcome = "is OK" else outcome = "NOT OK"
|
||||
print """" + str + """ " + outcome
|
||||
end for
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue