GoLang Solution For LeetCode Problem: Beautiful Arrangement
Solving Beautiful Arrangement in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.
Now given N, how many beautiful arrangements can you construct?
Input: 2 Output: 2 Explanation: The first beautiful arrangement is [1, 2]: Number at the 1st position (i=1) is 1, and 1 is divisible by i (i=1). Number at the 2nd position (i=2) is 2, and 2 is divisible by i (i=2). The second beautiful arrangement is [2, 1]: Number at the 1st position (i=1) is 2, and 2 is divisible by i (i=1). Number at the 2nd position (i=2) is 1, and i (i=2) is divisible by 1.
See the full details of the problem Beautiful Arrangement at LeetCode
Originally posted at: @github.com/halfrost/LeetCode-Go