Python Simple Sorting solution
\ndef longestSquareStreak(self, nums: List[int]) -> int:\n\tnums, used, ans = set(nums), set(), 1\n\tfor n in sorted(nums):\n\t\tif n in used:\n\t\t\tcontinue\n
```\ndef longestSquareStreak(self, nums: List[int]) -> int:\n\tnums, used, ans = set(nums), set(), 1\n\tfor n in sorted(nums):\n\t\tif n in used:\n\t\t\tcontinue\n\t\tused.add(n)\n\t\tcur = 1\n\t\twhile(n**2 in nums):\n\t\t\tused.add(n**2)\n\t\t\tn *= n \n\t\t\tcur += 1\n\t\tans = max(cur, ans)\n\treturn ans if ans>1 else -1\n```
[]