-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumbersDisappeared.java
More file actions
34 lines (32 loc) · 913 Bytes
/
NumbersDisappeared.java
File metadata and controls
34 lines (32 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<<<<<<< HEAD
//448. Find All Numbers Disappeared in an Array
class Solution {
public List<Integer> findDisappearedNumbers(int[] nums) {
int n = nums.length;
int freq[] = new int[n + 1];
List<Integer> list = new ArrayList<>();
for(int i=0;i<n;i++){
freq[nums[i]]++;
}
for(int i=1;i<=n;i++){
if(freq[i] == 0) list.add(i);
}
return list;
}
=======
//448. Find All Numbers Disappeared in an Array
class Solution {
public List<Integer> findDisappearedNumbers(int[] nums) {
int n = nums.length;
int freq[] = new int[n + 1];
List<Integer> list = new ArrayList<>();
for(int i=0;i<n;i++){
freq[nums[i]]++;
}
for(int i=1;i<=n;i++){
if(freq[i] == 0) list.add(i);
}
return list;
}
>>>>>>> be6ce0b427078b1421d5dd74adb2300dc02daeec
}