NeetCode #154LC-442MediumArrays & Hashing
← Back to All Problems#154 · #442 · Find All Duplicates in an Array(数组中重复的数据)
📌 Problem Statement & Constraints
Given an integer array
nums of length n where every element is in [1, n] and each element appears once or twice, return all elements that appear twice. Constraints: 1 <= n <= 10^5. Solve it in O(n) time with O(1) auxiliary space.🔒
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!