Beautiful Arrangement
Medium
Backtracking (Advanced)
A permutation of 1..n is beautiful if for every position i (1-based) either perm[i] is divisible by i or i is divisible by perm[i]. Print the number of beautiful arrangements.
Constraints
1 <= n <= 15
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.