Search
⌘K

Leetcode 932. Beautiful Array

Return a permutation of 1..n with the property that no element sitting between two others equals their arithmetic mean (i.e., no i<k<j with 2*nums[k]=nums[i]+nums[j]). The standard approach builds such a permutation recursively using odd/even index mappings (divide-and-conquer).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.