Low Complexity / TS 4.5+

valid_parentheses.ts

Solves LeetCode's Valid Parentheses entirely in the type system: characters are streamed off a template-literal string while a tuple acts as a stack, pushing openers and matching closers to decide VALID πŸ‘ or INVALID πŸ‘Ž.

Edit the source on the left. As you type, the type checker re-evaluates and prints the fully-resolved value of each concrete type alias on the right.

valid_parentheses.ts
TS 5.9
Compiler Output View
β€”
Booting TypeScript…