448. Find All Numbers Disappeared in an Array Easy
1/**
2 * [448] Find All Numbers Disappeared in an Array
3 *
4 * Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums.
5 *
6 * Example 1:
7 * Input: nums = [4,3,2,7,8,2,3,1]
8 * Output: [5,6]
9 * Example 2:
10 * Input: nums = [1,1]
11 * Output: [2]
12 *
13 * Constraints:
14 *
15 * n == nums.length
16 * 1 <= n <= 10^5
17 * 1 <= nums[i] <= n
18 *
19 *
20 * Follow up: Could you do it without extra space and in O(n) runtime? You may assume the returned list does not count as extra space.
21 *
22 */
23pub struct Solution {}
24
25// problem: https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/
26// discuss: https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/discuss/?currentPage=1&orderBy=most_votes&query=
27
28// submission codes start here
29
30impl Solution {
31 pub fn find_disappeared_numbers(nums: Vec<i32>) -> Vec<i32> {
32 vec![]
33 }
34}
35
36// submission codes end
37
38#[cfg(test)]
39mod tests {
40 use super::*;
41
42 #[test]
43 fn test_448() {
44 }
45}
46
Back
© 2025 bowen.ge All Rights Reserved.