Awesome Solution for Awesome Substring
https://leetcode.com/problems/find-longest-awesome-substring/solutions/2217420/c-solution-bit-manipulation-and-hashmaps-explanation/\n\nthis guy\'s solution did
https://leetcode.com/problems/find-longest-awesome-substring/solutions/2217420/c-solution-bit-manipulation-and-hashmaps-explanation/\n\nthis guy\'s solution did it for me\n\n\n\n# Code\n```\nclass Solution {\n    public int longestAwesome(String s) {\n        return util1(s);\n    }\n    // brain melt\n    public int util1(String str) {\n        HashMap<Integer, Integer> hm = new HashMap<>();\n        hm.put(0, -1);\n        int mask = 0, ans = 0;\n        for (int i = 0; i < str.length(); i++) {\n            mask = mask ^ (1 << (str.charAt(i) - \'0\'));\n            // if this conditions comes, that means every number in between has come even\n            // number of times\n            if (hm.containsKey(mask)) {\n                ans = Math.max(ans, (i - hm.get(mask)));\n            } else {\n                hm.put(mask, i);\n            }\n            // if the below conditions work, we know that that only one is odd, rest all\n            // were even\n            for (int j = 0; j < 10; j++) {\n                int newMask = mask ^ (1 << j);\n                if (hm.containsKey(newMask)) {\n                    ans = Math.max(ans, (i - hm.get(newMask)));\n                }\n            }\n        }\n        return ans;\n    }\n}\n```\n\nyou can check out my github repository where i am uploading famous interview questions topic wise with solutions.\nlink-- https://github.com/Abhaydutt2003/DataStructureAndAlgoPractice \nkindly upvote if you like my solution. you can ask doubts below.\xAF\n
['Java']