We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12d0f1a commit cc291fdCopy full SHA for cc291fd
645. Set Mismatch.java
@@ -0,0 +1,32 @@
1
+// Runtime 3ms
2
+// Beats 81.72%
3
+
4
+// Memory 45.46MB
5
+// Beats 42.36%
6
7
8
9
+class Solution {
10
+ public int[] findErrorNums(int[] nums) {
11
+ boolean[] exist = new boolean[nums.length];
12
+ int d = 0, l = 0;
13
14
+ Arrays.fill(exist, true);
15
16
+ for(int i:nums){
17
+ if(exist[i-1] == false){
18
+ d=i;
19
+ }
20
+ exist[i-1]=false;
21
22
23
+ for(int i = 0; i < nums.length; i++) {
24
+ if(exist[i]) {
25
+ l= i+1;
26
+ break;
27
28
29
30
+ return new int[]{d,l};
31
32
+}
0 commit comments