C++ || Very easy approach using unordered_set
```\nint longestSquareStreak(vector& nums) {\n        long long n=nums.size();\n        unordered_setst;\n        sort(nums.begin(), nums.end());\n        for(a
```\nint longestSquareStreak(vector<int>& nums) {\n        long long n=nums.size();\n        unordered_set<long long>st;\n        sort(nums.begin(), nums.end());\n        for(auto x:nums){\n            st.insert(x);\n        }\n        vector<int>vec;\n        long long ans=0;\n        if(nums[0]>316){\n            return -1;\n        }\n        for(int i=0;i<n;i++){\n            if(nums[i]>316){\n                break;\n            }\n            long long temp=1;\n            if(st.find(nums[i]*nums[i])!=st.end()){\n                long long curr=nums[i]*nums[i];\n                temp++;\n                while(true){\n                    if(st.find(curr*curr)!=st.end()){\n                        temp++;\n                        curr=curr*curr;\n                    }                    \n                    else{\n                        break;\n                    }\n                }\n            }\n            ans=max(ans, temp);\n        }\n        if(ans==1){\n            return -1;\n        }\n        return ans;\n    }\n\t*Sort the input vector and insert all items of the vector into an unordered_set.\n\t*Then traverse over all the items in the input vector and for each element check if it\'s square is present. \n\t*keep in mind that if element exceeds 316 then square of it will not be present as 317*317 \n\texceeds the constraints of the elements of the input \n\t*even though you will be using two loops in this approach the time complexity will be o(nlogn) \n\tthat\'s because of the sorting as search in an unordered_set is an O(1) operation and at max \n\tthe traversal will go to 316th element of the vector only.\n\t\n\tPS: hope this makes sense thank you :)
['Hash Table', 'C']