给你一个含 n 个整数的数组 nums ,其中 nums[i] 在区间 [1, n] 内。请你找出所有在 [1, n] 范围内但没有出现在 nums 中的数字,并以数组的形式返回结果。 进阶:你能在不使用额外空间且时间复杂度为 O(n) 的情况下解决这个问题吗? 你可以假定返回的数组不算在额外 ...
很多朋友在后台留言说,刷 LeetCode 上的数据结构+算法题时难免会遇到困难,想要找一本 答案题解做参考。 其实几个月之前,咱们这里已经分享过一本《LeetCode算法题的PDF版题解》,只不过当时那个是Go语言版本的实现。 今天应大家的要求,分享一本由谷歌大佬 ...
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array. Could ...