I have this code snippet in java
int[] arrA = ...;
int[] arrB = ...;
int n = ...;
boolean isPermuting = true;
for(int i = 0, j = arrB.length - 1; i < n; i++, j--) {
if(arrA[i] + arrB[j] < k) {
isPermuting = false;
break;
}
}
I know there is a way to put multiple counters in the same for loop in scala but the end up being nested. For example:
for(i <- 1 to 10 ; j <- 10 to 20) // in scala
is the same as
for(int i = 1; i <= 10 ; i ++){
for(int j = 10; j <= 20; j++){ // in java
but I don't know how to do this for non nested counters