Playing with bits
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int longestAwesome(string s) {\n        int n = s.size();\n        unordered_map<int,int> mp;\n        mp[0] = -1;\n        int ans = 0;\n        int prev = 0;\n        for(int i = 0; i < n; i++) {\n            int bit = (s[i] - \'0\');\n            int curMask = (prev ^ (1 << bit));\n            if(mp.count(curMask)) {\n                ans = max(ans , i - mp[curMask]);\n            }\n            else {\n                mp[curMask] = i;\n            }\n            for(int j = 0; j < 10; j++) {\n                int newMask = (curMask ^ (1 << j));\n                if(mp.count(newMask)) {\n                    ans = max(ans , i - mp[newMask]);\n                }\n            }\n            prev = curMask;\n        }\n        return ans;\n    }\n};\n```
['Hash Table', 'Bit Manipulation', 'Bitmask', 'C++']