✅ One Line Solution
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1.1 - One Line\nTime complexity: O(n*max
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1.1 - One Line\nTime complexity: $$O(n*maxStreakLen)$$. Space complexity: $$O(maxStreakLen)$$. maxStreakLen - a small number depending on constraints.\n```python3\nclass Solution:\n    def longestSquareStreak(self, a: List[int]) -> int:\n        return (-1,r:=max(map(f:=lambda v:1+(v*v in a and f(v*v)),a:={*a})))[r>1]\n```\n\n# Code #1.2 - Unwrapped\n```python3\nclass Solution:\n    def longestSquareStreak(self, a: List[int]) -> int:\n        def f(v):\n            return 1 + (v*v in a and f(v*v))\n\n        a = {*a}\n        r = max(map(f, a))\n        if r > 1:\n            return r\n        return -1\n```\n\n(Disclaimer 2: code above is just a product of fantasy packed into one line, it is not claimed to be \'true\' oneliners - please, remind about drawbacks only if you know how to make it better)
['Array', 'Hash Table', 'Dynamic Programming', 'Recursion', 'Memoization', 'Python', 'Python3']