Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def findLonely(self, nums: List[int]) -> List[int]:
- nums.sort()
- n = len(nums)
- ans = []
- for i in range(n):
- if (i==0 or nums[i]-nums[i-1] > 1) and (i==n-1 or nums[i+1]-nums[i] > 1):
- ans.append(nums[i])
- return ans
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement