Beautiful permutations
A permutation perm of 1..n is 'beautiful' if for every 1-indexed position i, either perm[i] is divisible by i or i is divisible by perm[i]. Return the number of beautiful permutations of 1..n. 1 <= n <= 12.
Implement
beautiful_arrangement(n: int) → intExamples
in
[2]out2What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 22 min
solution.py
InputExpectedGot
[2]2not run yetsample