You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Solution:
def findClosestNumber(self, nums: List[int]) -> int:
min_distance = float("inf")
res = None
for num in nums:
distance = abs(num)
if distance < min_distance or (distance == min_distance and num > res):
min_distance = distance
# res = num
return res
The text was updated successfully, but these errors were encountered:
class Solution:
def findClosestNumber(self, nums: List[int]) -> int:
min_distance = float("inf")
res = None
for num in nums:
distance = abs(num)
if distance < min_distance or (distance == min_distance and num > res):
min_distance = distance
# res = num
return res
The text was updated successfully, but these errors were encountered: