As reported: Qualcomm Engineer (Bangalore), round 3 on-site (2026): DSA — find the missing elements.
Given an array nums of n integers where each nums[i] is in [1, n], return all integers in [1, n] that do not appear in nums, in increasing order. Aim for O(n) time and no extra space besides the output.
This is LeetCode 448 — Find All Numbers Disappeared in an Array.
Example 1
nums = [4,3,2,7,8,2,3,1] -> [5,6]
Example 2
nums = [1,1] -> [2]
Constraints: 1 ≤ n ≤ 10^5; 1 ≤ nums[i] ≤ n.
Code runner format: one line, nums as JSON. Implement findDisappearedNumbers(nums); the harness prints the list.