6205. Count Number of Distinct Integers After Reverse Operations
- Contest 315
Python
class Solution:
def countDistinctIntegers(self, nums: List[int]) -> int:
nums = set(nums)
rev_nums = set()
for num in nums:
rev = list(str(num))
rev.reverse()
rev_nums.add(int(''.join(rev)))
return len(nums | rev_nums)