giles
97a8c06690
Test, Build, and Deploy / test-build-deploy (push) Failing after 51s
ocaml: phase 5.1 balance.ml baseline (paren/bracket/brace balance via Stack)
is_balanced walks a string; on each char:
'(', '[', '{' -> Stack.push c
')', ']', '}' -> require stack non-empty AND top = expected opener,
else mark ok = false
others -> skip
At end: !ok && Stack.is_empty stack.
Five test cases:
'({[abc]d}e)' -> true
'(a]' -> false (no matching opener)
'{[}]' -> false (mismatched closer)
'(())' -> true
'' -> true
Sum of (if balanced then 1 else 0) -> 3.
Exercises:
Stack.create / push / pop / is_empty
s.[!i] string indexing
while loop + bool ref short-circuit
multi-arm if/else if/else if dispatch
31 baseline programs total.
2026-05-09 06:59:22 +00:00
..
2026-05-08 19:57:09 +00:00
2026-05-09 06:15:03 +00:00
2026-05-09 06:59:22 +00:00
2026-05-08 21:05:32 +00:00
2026-05-09 02:24:45 +00:00
2026-05-08 17:52:49 +00:00
2026-05-09 00:13:11 +00:00
2026-05-08 16:53:44 +00:00
2026-05-08 13:44:28 +00:00
2026-05-09 01:47:27 +00:00
2026-05-08 13:44:28 +00:00
2026-05-09 06:59:22 +00:00
2026-05-08 15:01:04 +00:00
2026-05-08 13:33:24 +00:00
2026-05-08 17:44:07 +00:00
2026-05-09 06:05:31 +00:00
2026-05-09 01:11:53 +00:00
2026-05-08 19:49:08 +00:00
2026-05-09 00:23:58 +00:00
2026-05-08 13:33:24 +00:00
2026-05-08 19:10:49 +00:00
2026-05-09 05:00:50 +00:00
2026-05-08 13:33:24 +00:00
2026-05-08 18:43:19 +00:00
2026-05-08 13:33:24 +00:00
2026-05-08 20:49:26 +00:00
2026-05-08 19:04:04 +00:00
2026-05-08 13:44:28 +00:00
2026-05-08 23:40:36 +00:00
2026-05-09 00:13:11 +00:00
2026-05-09 06:47:47 +00:00
2026-05-09 02:16:18 +00:00
2026-05-08 13:33:24 +00:00
2026-05-09 05:44:35 +00:00
2026-05-08 16:11:03 +00:00