Can Rearrange a Binary String Into a Pattern
Asked at Amazon · Coding Questions · Difficulty: Hard
Given a binary string `binary`, the allowed operation is to pick any subsequence and sort it (0s before 1s), repeatable. For each pattern in `arr` (containing `'0'`, `'1'`, `'?'` where `'?'` is a wildcard replaceable by `'0'`/`'1'`), determine whether `binary` can be rearranged into some filling of the pattern. Return a list of `"YES"`/`"NO"`.
Loading the problem…