We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
key
boolean
1
nums.length
push
/** * @param {number[]} nums * @return {number[]} */ var findDisappearedNumbers = function(nums) { const map = new Map(), res = [] for (const num of nums) { const val = map.get(num) map.set(num, true) } for (let i = 1; i <= nums.length; i++) { if (!map.get(i)) { res.push(i) } } return res };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
解题思路
key
,用boolean
值标记是否出现过1
到nums.length
遍历一次,每次从哈希表中取key
值,判断该值是否被标记过push
到数组里面代码
The text was updated successfully, but these errors were encountered: