Runtime beats 91.89%, memory beats 51.33% [EXPLAINED]
Intuition\nFind the longest sequence in the array where each number is the square of the previous one. This means if we start with a number, the next number in 
# Intuition\nFind the longest sequence in the array where each number is the square of the previous one. This means if we start with a number, the next number in the sequence must be its square, and we keep going as long as we can find the next square in the array.\n\n# Approach\nSort the array, use a dictionary to track the length of each sequence we start, and for each number, keep squaring it until it\u2019s not in the array, updating the longest sequence found if it\u2019s at least two.\n\n# Complexity\n- Time complexity:\nO(n log n) because we sort first and then check each number once.\n\n- Space complexity:\nO(n) because we store the length of each sequence in a dictionary.\n\n# Code\n```python3 []\nclass Solution:\n    def longestSquareStreak(self, nums: list[int]) -> int:\n        num_set = set(nums)\n        max_streak = -1\n\n        for num in nums:\n            streak_len = 0\n            current = num\n\n            # Count the length of the streak by squaring each number\n            while current in num_set:\n                streak_len += 1\n                current *= current  # Square the current number\n\n            # Only consider streaks of length >= 2\n            if streak_len >= 2:\n                max_streak = max(max_streak, streak_len)\n\n        return max_streak\n\n```
['Array', 'Hash Table', 'Sorting', 'Python3']