NeetCode #210LC-2149MediumTwo Pointers
← Back to All Problems#210 · #2149 · Rearrange Array Elements by Sign(按符号重排数组)
📌 Problem Statement & Constraints
Given an integer array
nums with an equal number of positive and negative integers, rearrange it so that positives occupy the even indices and negatives the odd indices, preserving their relative order. Constraints: 2 <= nums.length <= 2 * 10^5, nums.length is even, nums[i] != 0.🔒
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!