C++ || SET
\nclass Solution {\npublic:\n    int longestSquareStreak(vector<int>& nums) {\n        set<long long> st(nums.begin(),nums.end());\n        long long  ans=-1;\n
```\nclass Solution {\npublic:\n    int longestSquareStreak(vector<int>& nums) {\n        set<long long> st(nums.begin(),nums.end());\n        long long  ans=-1;\n        for(auto it : nums){\n            if(st.find((long long)it*it)!=st.end()){\n                long long  cnt=2,val=(long long)it*it;\n                while(st.find(val*val)!=st.end()){\n                    cnt += 1;\n                    val = val*val;\n                }\n                if(ans<cnt) ans = cnt;\n            }\n        }\n        return ans;\n    }\n};\n```
['C', 'Ordered Set', 'C++']