cswork / OAOpen practice workspace

DeloitteOA #4

Count Divisible Permutations

Estimated MediumStatement and editorial — judging is being prepared

Topics (AI-labelled)PruningTree & Game DP

SDE-1

Constraints

1 ≤ n ≤ 15

Example 1

Input:

n = 2

Output:

2

Explanation: The first Divisible Permutation is [1,2]: permutation[1] = 1 is divisible by i = 1 permutation[2] = 2 is divisible by i = 2 The second Divisible Permutation is [2,1]: permutation[1] = 2 is divisible by i = 1 i = 2 is divisible by permutation[2] = 1

Editorial

Loading solution…