Will anyone post the number of valid bracket string completions of "?<???????????)??]???????}??" using "()<>[]{}"
13
56
250
resolved Apr 1
Resolved
YES

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:

  1. The empty string is valid.

  2. 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.

  3. 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.

Get Ṁ600 play money

🏅 Top traders

#NameTotal profit
1Ṁ120
2Ṁ26
3Ṁ20
4Ṁ10
5Ṁ6
Sort by:
predicted NO

New market

bought Ṁ200 of YES

By (kinda) induction, goal: all valid strings are of even length. Base case: the empty string is of 0 length, which is even. Inductive steps: 2: If S is valid, then the length of the next valid string, a+S+b, has length 2 + length(S), which is also even. 3: If S_1 and S_2 are valid, then the length of S_1 + S_2 is even + even, which is even. So: all valid strings are of even length.

length("?<???????????)??]???????}??") == 27, so any substitution of ?s by brackets will still be of length 27, so no substitution can be of even length, so no substitutions exist

So the number of ways is zero, 0.

note: i'm [private_info], so I'm pretty retarded today, so this might be wrong, as evidenced by several past mistakes today. but i'll be fine in a week so if this is dumb i'll try to solve it later

bought Ṁ100 of YES

also IF i didn't miss anything please do versions with even strings, and with overlapping allowed

predicted NO

@jacksonpolack lol yeah, if it's odd there will always be an unmatched bracket.

oh come on really?

this kind of thing is fun, so i put half an hour into it before i ... actually read the description ... and realized brackets cant cross-nest like ([)] whoops