File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 52
52
| 02 | | [ Codility-Lesson2 OddOccurrencesInArray] ( ./src/Array/OddOccurrencesInArray ) | |
53
53
| 03 | | [ Codility-Lesson4 FrogRiverOne] ( ./src/Array/FrogRiverOne ) | |
54
54
| 04 | | [ Codility-Lesson4 PermCheck] ( ./src/Array/PermCheck ) | |
55
+ | 05 | | [ Codility-Lesson4 MissingInteger] ( ./src/Array/MissingInteger ) | |
55
56
56
57
### Stack
57
58
Original file line number Diff line number Diff line change
1
+ package Array .MissingInteger ;
2
+
3
+ public class Main {
4
+ public static void main (String [] args ) {
5
+ Solution sol = new Solution ();
6
+ System .out .println (sol .solution (new int []{1 , 2 , 3 }));
7
+ }
8
+ }
9
+
10
+ class Solution {
11
+
12
+ static boolean [] check = new boolean [1000001 ];
13
+
14
+ public int solution (int [] A ) {
15
+ for (int value : A ) {
16
+ if (value > 0 ) check [value ] = true ;
17
+ }
18
+ int ans = 1 ;
19
+ while (check [ans ]) ans ++;
20
+ return ans ;
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+ ## [ Codility - Lesson 4 Counting Elements] MissingInteger
2
+
3
+ > Detected time complexity : ** O(N) or O(N * log(N))**
4
+
5
+ ![ image] ( https://user-images.githubusercontent.com/22045163/104467349-9205bf80-55f9-11eb-9944-5a0ce4077b19.png )
You canโt perform that action at this time.
0 commit comments