Skip to content

Commit d607cf2

Browse files
authored
Create Find Closest Person.java
1 parent 6c82d5e commit d607cf2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Easy/Find Closest Person.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution {
2+
public int findClosest(int x, int y, int z) {
3+
int diffOne = Math.abs(x - z);
4+
int diffTwo = Math.abs(y - z);
5+
return diffOne == diffTwo ? 0 : (diffOne < diffTwo ? 1 : 2);
6+
}
7+
}

0 commit comments

Comments
 (0)