Skip to content

Commit f2f91ed

Browse files
authored
Create Array-Array DIV
1 parent ac24bd1 commit f2f91ed

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Array-Array DIV

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
https://www.codingninjas.com/codestudio/contests/codestudio-weekend-contest-53/7079253/problems/23500
3+
4+
5+
6+
7+
8+
public class Solution {
9+
static int arrayDivisibility(int n, int []x, int []y) {
10+
int count = 0;
11+
for(int i =0 ;i<n ; i++){
12+
if(y[i] > x[i]){
13+
count += Math.min ( x[i] % y[i] , y[i] - x[i]);
14+
}
15+
else{
16+
int rem = x[i] % y[i];
17+
count += Math.min(rem , y[i] - rem);
18+
}
19+
}
20+
21+
return count;
22+
}
23+
}

0 commit comments

Comments
 (0)