Hi,
I have a problem with Bank Robbers puzzle. All tests pass but not “submision tests”. I would love to know why. I found several solutions where second test didnt passed and finaly I found solution without any way of anything hardcoded but last 2 dont pass now (reminder - in IDE all tests pass).
In last hours I exhausted all ideas of what could possibly go wrong, but it feels like som bug.
I would appeciate some feedback on this. Cheers!
My code:
class Solution {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int R = in.nextInt();
int V = in.nextInt();
List<Integer> combs = new ArrayList<>();
for (int i = 0; i < V; i++) {
int C = in.nextInt();
int N = in.nextInt();
combs.add((int)(Math.pow(10,N) * Math.pow(5,C-N)));
}
int count = 0;
while(!combs.isEmpty()) {
count++;
for (int j = 0; j < R; j++) {
if(j<combs.size()) combs.set(j,combs.get(j)-1);
}
for (int k =0; k < combs.size(); k++) {
if(combs.get(k) == 0) combs.remove(k);
}
}
System.out.println(count);
}
}