NeetCode #205LC-1968MediumTwo Pointers
← Back to All Problems#205 · #1968 · Array With Elements Not Equal to Average of Neighbors(构造元素不等于两相邻元素平均值的数组)
📌 Problem Statement & Constraints
Given an array
nums, rearrange it so that no element equals the average of its neighbours. Return any valid arrangement. Constraints: 3 <= nums.length <= 10^5, 0 <= nums[i] <= 10^5.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!