add 3637 mod + tests
Some checks failed
Binary Search Test / test (push) Failing after 6s

This commit is contained in:
2026-02-17 12:57:43 +03:00
parent b505b8276e
commit e8e085e606
6 changed files with 119 additions and 1 deletions

View File

@@ -12,6 +12,10 @@ public class IntList {
public IntList() {}
public IntList(int[] list) {
this.list = list;
}
public void put(int val) {
if (idx >= list.length) {
list = Arrays.copyOf(list, list.length * 2);
@@ -24,6 +28,16 @@ public class IntList {
return idx;
}
public IntList getReversed() {
IntList reverse = new IntList(new int[idx]);
for (int i = idx - 1; i >= 0; i--) {
reverse.put(list[i]);
}
return reverse;
}
public int get(int index) {
return list[index];
}