I scan the array once while keeping a set of numbers I have already seen. Whenever I encounter a number that is already in the set, it must be one of the sneaky repeated numbers, so I add it to the result list. Since there are exactly two repeats, I stop once I found both.
class Solution:
def getSneakyNumbers(self, nums: List[int]) -> List[int]: