28 lines
540 B
Python
28 lines
540 B
Python
'''
|
|
Given three digits a, b, c, where two of them are equal and one is different, return the value that occurs exactly once.
|
|
|
|
Example 1
|
|
Input:
|
|
a = 1; b = 2; c = 2
|
|
Output:
|
|
1
|
|
Example 2
|
|
Input:
|
|
a = 4; b = 3; c = 4
|
|
Output:
|
|
3
|
|
'''
|
|
|
|
class Solution(object):
|
|
def solve(self,a:int, b:int, c:int) -> int:
|
|
print(f"a: {a}, b: {b}, c: {c}")
|
|
if a != b and a != c:
|
|
return a
|
|
elif b != a and b != c:
|
|
return b
|
|
else:
|
|
return c
|
|
|
|
s = Solution()
|
|
print(s.solve(1, 2, 2))
|
|
print(s.solve(4, 3, 4)) |