Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
27
Task/Balanced-brackets/OxygenBasic/balanced-brackets.basic
Normal file
27
Task/Balanced-brackets/OxygenBasic/balanced-brackets.basic
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
function CheckBrackets(string s) as bool
|
||||
'=======================================
|
||||
sys co, le=len s
|
||||
byte b at strptr s
|
||||
indexbase 0
|
||||
for i=0 to <le
|
||||
select b(i)
|
||||
case "[" : co++
|
||||
case "]" : co--
|
||||
end select
|
||||
if co<0 then return 0
|
||||
next
|
||||
if co=0 then return 1
|
||||
end function
|
||||
|
||||
|
||||
'TEST
|
||||
'====
|
||||
|
||||
print CheckBrackets "" '1
|
||||
print CheckBrackets "[" '0
|
||||
print CheckBrackets "]" '0
|
||||
print CheckBrackets "[]" '1
|
||||
print CheckBrackets "[[]" '0
|
||||
print CheckBrackets "[]]" '0
|
||||
print CheckBrackets "[][]"'1
|
||||
print CheckBrackets "][" '0
|
||||
Loading…
Add table
Add a link
Reference in a new issue