Skip to content

Commit ba00786

Browse files
authored
Create Count Operations to Obtain Zero.java
1 parent c029de1 commit ba00786

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
public int countOperations(int num1, int num2) {
3+
int numOfOperations = 0;
4+
while (num1 != 0 && num2 != 0) {
5+
if (num1 >= num2) {
6+
num1 -= num2;
7+
} else {
8+
num2 -= num1;
9+
}
10+
numOfOperations++;
11+
}
12+
return numOfOperations;
13+
}
14+
}

0 commit comments

Comments
 (0)