Skip to content

Commit 5af615e

Browse files
committed
daily
1 parent 444a031 commit 5af615e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

my-submissions/e3516.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
func findClosest(x int, y int, z int) int {
2+
a, b := x - z, y - z
3+
if a < 0 {
4+
a *= -1
5+
}
6+
if b < 0 {
7+
b *= -1
8+
}
9+
10+
if a == b {
11+
return 0
12+
}
13+
if a < b {
14+
return 1
15+
}
16+
return 2
17+
}

my-submissions/e3516.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Solution:
2+
def findClosest(self, x: int, y: int, z: int) -> int:
3+
return 0 if (a := abs(x - z)) == (b := abs(y - z)) else 1 if a < b else 2

0 commit comments

Comments
 (0)