LeetCode 667: Beautiful Arrangement II
Problem Restatement We are given two integers: Variable Meaning n We must use numbers from 1 to n k Required number of distinct adjacent differences We need to construct an array containing every integer from 1 to n exactly once such that the set of absolute differences between neighboring elements contains exactly k distinct values. For an array: arr the adjacent differences are: |arr[i] - arr[i + 1]| for all...