Skip to content

Commit 1823fb5

Browse files
authored
Create Solution2.java
1 parent 2101946 commit 1823fb5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
public class Solution2 {
2+
3+
/**
4+
* 从misNum=1开始假设不存在,循环一遍数组,如果存在则misNum++即可
5+
*
6+
* @param arrs
7+
* @return
8+
*/
9+
private static int findMissFirstNum(int [] arrs){
10+
int misNum = 1;
11+
for(int i:arrs){
12+
if(i==misNum){
13+
misNum++;
14+
}
15+
}
16+
return misNum;
17+
}
18+
19+
}

0 commit comments

Comments
 (0)