Problem 2741 · Medium

Special Permutations

Count arrangements where neighbours divide one another by a bitmask DP over the used numbers and the last number placed.

Open the interactive visualisation