Simple Approach - Beats 94.59% | Similar to LCS
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n\u22C5logm)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def longestSquareStreak(self, nums: List[int]) -> int:\n\n        nums_set = set(nums)\n\n        Longest_string = 1\n\n        for num in nums_set:\n\n            square = num**2\n\n            l=1\n\n            while square in nums_set:\n                square=square**2\n                l+=1\n            \n            Longest_string = max(Longest_string,l)\n        \n        return Longest_string if Longest_string>1 else -1\n        \n\n
['Python3']