[python] O(n) solution without sort
Intuition\nSince each subsequence has a smallest number, just count from the smallest to the biggest.\n\n# Complexity\n- Time complexity: O(n)\n\n- Space comple
# Intuition\nSince each subsequence has a smallest number, just count from the smallest to the biggest.\n\n# Complexity\n- Time complexity: $$O(n)$$\n\n- Space complexity:$$O(n)$$\n\n# Code\n```\nclass Solution:\n    def longestSquareStreak(self, nums: List[int]) -> int:\n        s = set(nums)\n        res = -1\n        for item in s:\n            if sqrt(item) in s: continue\n            else: \n                curr = 1\n                while item*item in s:\n                    item*=item\n                    curr+=1\n                res = max(curr, res)\n        return -1 if res <= 1 else res\n        \n```
['Python3']