We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b8281b5 commit ebb7b79Copy full SHA for ebb7b79
solution/2900-2999/2992.Number of Self-Divisible Permutations/README_EN.md
@@ -106,7 +106,7 @@ class Solution:
106
return 1
107
ans = 0
108
for j in range(1, n + 1):
109
- if (mask >> j & 1) == 0 and (i % j == 0 or j % i == 0):
+ if (mask >> j & 1) == 0 and gcd(i, j) == 1:
110
ans += dfs(mask | 1 << j)
111
return ans
112
@@ -265,7 +265,7 @@ class Solution:
265
for mask in range(1 << n):
266
i = mask.bit_count()
267
268
- if (mask >> (j - 1) & 1) == 1 and (i % j == 0 or j % i == 0):
+ if (mask >> (j - 1) & 1) == 1 and gcd(i, j) == 1:
269
f[mask] += f[mask ^ (1 << (j - 1))]
270
return f[-1]
271
```
0 commit comments