Count Streaks
 # Intuition  \n\n\n\n\n\n# Complexity\n- Time complexity: O(n * log n)\n\n\n- Space complexity: O(n)\n\n\n# Code\n\n#define has(m, x) m.find(x) != m.end()\ncla
<!-- # 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 * log n)`*\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```\n#define has(m, x) m.find(x) != m.end()\nclass Solution {\npublic:\n    int longestSquareStreak(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        unordered_map<int, int> sqr;\n        double st;\n        for(int num: nums) {\n            st = sqrt(num);\n            if(ceil(st) == floor(st))\n                sqr[num] = max(sqr[num], sqr[st] + 1);\n            else\n                sqr[num] = (sqr[num] == 0) ? 1 : sqr[num];\n        }\n        int streak = -1;\n        for(auto el: sqr) {\n            if(el.second > 1)\n                streak = max(streak, el.second);\n        }\n        return streak;\n    }\n};\n```
['Array', 'Hash Table', 'Sorting', 'C++']