adaptatron's blog

By adaptatron, 5 weeks ago, In English

Given a permutation, compute the unique MEX across all subarrays. Then, reverse the problem, given a binary string where a $$$1$$$ at index $$$i$$$ means that a subarray with MEX $$$i$$$ exists (and $$$0$$$ means it doesn't), compute the number of permutations that satisfy these constraints.

I created a video discussing the ideas to solve both the problem in $$$O(N)$$$. Practice Problem

Video https://youtu.be/78N9JfaQ72g

  • Vote: I like it
  • 0
  • Vote: I do not like it