Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a6370a6

Browse files
add 2169
1 parent 0fa9be7 commit a6370a6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|2169|[Count Operations to Obtain Zero](https://leetcode.com/problems/count-operations-to-obtain-zero/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2169.java) ||Easy||
1112
|2166|[Design Bitset](https://leetcode.com/problems/design-bitset/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2166.java) ||Medium||
1213
|2165|[Smallest Value of the Rearranged Number](https://leetcode.com/problems/smallest-value-of-the-rearranged-number/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2165.java) ||Medium||
1314
|2164|[Sort Even and Odd Indices Independently](https://leetcode.com/problems/sort-even-and-odd-indices-independently/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2164.java) ||Easy||
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _2169 {
4+
public static class Solution1 {
5+
public int countOperations(int num1, int num2) {
6+
int ops = 0;
7+
while (true) {
8+
if (num1 == 0 || num2 == 0) {
9+
return ops;
10+
}
11+
if (num1 >= num2) {
12+
num1 -= num2;
13+
} else {
14+
num2 -= num1;
15+
}
16+
ops++;
17+
18+
}
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)