
Here's how it works:
You're given the string "?<???????????)??]???????}??"
The task is to find the number of ways to replace each question mark with one of the characters in the string "()<>[]{}" such that the end result is valid parentheses sequence.
For example:
()[]{}<> is valid
([]()){} is valid
]() is not valid
(]{} is not valid
([)) is not valid.
Here are some test cases:
?[?? has 4 completions.
???? has 32 completions.
)??? has 0 complteions.
More formally validity is defined by:
The empty string is valid.
If a string S is valid then a+S+b is valid where "+" is string concatenation. And a,b are open/close brackets of identical type.
If S_1 and S_2 are valid bracket strings then S_1 + S_2 is a valid bracket string.
Market resolves YES if anyone posts the answer in the comments or NO if market closes before that.
Market closes 7th of april.
🏅 Top traders
# | Name | Total profit |
---|---|---|
1 | Ṁ120 | |
2 | Ṁ26 | |
3 | Ṁ20 | |
4 | Ṁ10 | |
5 | Ṁ6 |