Company: Chubb_India_26nov
Difficulty: medium
Beautiful Arrangements Problem Description There is a list of consecutive numbers beginning with 1. An arrangement of these numbers is called "beautiful" if at least one of the following is true for each position i using 1-based indexing: The number at position i is divisible by i . i is divisible by the number at position i . Determine how many beautiful arrangements are possible for a given integer n . Examples Example 1: Input: n = 2 Output: 2 Explanation: The two beautiful arrangements are [1, 2] and [2, 1]. For the arrangement [1, 2]: - At position i=1, the number is 1. 1 is divisible by 1. - At position i=2, the number is 2. 2 is divisible by 2. For the arrangement [2, 1]: - At position i=1, the number is 2. 2 is divisible by 1. - At position i=2, the number is 1. 2 is divisible by 1. Example 2: Input: n = 3 Output: 3 Explanation: The 3 beautiful arrangements are [1, 2, 3], [2, 1, 3], and [3, 2, 1]. Example 3: Input: n = 4 Output: 8 Constraints 1 < n < 20 ```