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 25d5f3a commit eafae5cCopy full SHA for eafae5c
src/day17/Main.java
@@ -1,25 +1,16 @@
1
package day17;
2
3
-import java.util.Arrays;
4
-
5
-import org.apache.commons.lang3.ArrayUtils;
6
7
8
public class Main {
9
public static void main(String[] args) {
10
int input = 377;
11
int pos = 0;
12
- int[] list = {0};
13
14
15
- for (int i = 1; i < 5000000; i++) {
16
- pos = ((pos + input) % list.length)+1;
17
18
- list = ArrayUtils.insert(pos, list, i);
19
- }
20
21
- System.out.println(Arrays.toString(list));
+ for (int i = 1; i < 50000001; i++) {
+ pos = ((pos + input) % i) + 1;
22
23
- System.out.println(list[ArrayUtils.indexOf(list, 0)+1]);
+ if (pos == 1) {
+ System.out.println(i);
+ }
24
}
25
0 commit comments