How to resolve the algorithm Balanced brackets step by step in the Run BASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Balanced brackets step by step in the Run BASIC programming language
Table of Contents
Problem Statement
Task:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Balanced brackets step by step in the Run BASIC programming language
Source code in the run programming language
dim brk$(10)
brk$(1) = "[[[][]]]"
brk$(2) = "[[[]][[[][[][]]]]]"
brk$(3) = "][][]][["
brk$(4) = "[][][]"
brk$(5) = "[][]][]][[]]][[["
brk$(6) = "]][[[[]]]][]]][[[["
brk$(7) = "[[][[[]]][]]"
brk$(8) = "[]][][][[[]]"
brk$(9) = "][]][["
brk$(10) = "[]][][][[]"
for i = 0 to 10
b$ = brk$(i)
while instr(b$,"[]") <> 0
x = instr(b$,"[]")
if x > 0 then b$ = left$(b$,x - 1) + mid$(b$,x + 2)
wend
if trim$(b$) = "" then print " OK "; else print "Not OK ";
print brk$(i)
next i
You may also check:How to resolve the algorithm Catalan numbers/Pascal's triangle step by step in the Zig programming language
You may also check:How to resolve the algorithm Loops/Infinite step by step in the NewLISP programming language
You may also check:How to resolve the algorithm Tau function step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm Hofstadter-Conway $10,000 sequence step by step in the D programming language
You may also check:How to resolve the algorithm Conway's Game of Life step by step in the Batch File programming language