Longest Awesome Substring easy solution 100% beats using bitmask
include \n\nint longestAwesome(char* s) {\n    int n = strlen(s);\n    int seen[1024];  // To store the earliest index at which a bitmask is seen\n    for (int 
#include <string.h>\n\nint longestAwesome(char* s) {\n    int n = strlen(s);\n    int seen[1024];  // To store the earliest index at which a bitmask is seen\n    for (int i = 0; i < 1024; ++i) {\n        seen[i] = n;\n    }\n\n    int mask = 0;\n    int result = 0;\n\n    seen[0] = -1;\n\n    for (int i = 0; i < n; ++i) {\n        mask ^= 1 << (s[i] - \'0\');\n\n        if (__builtin_popcount(mask) <= 1) {\n            result = i + 1;\n        }\n\n        for (int j = 0; j < 10; ++j) {\n            int new_mask = mask ^ (1 << j);\n            result = result > i - seen[new_mask] ? result : i - seen[new_mask];\n        }\n\n        if (seen[mask] > i) {\n            seen[mask] = i;\n        }\n    }\n\n    return result;\n}
['C', 'Bitmask']