[C++] O(n) solution with 2 pointer approach | 95% in memory
I am using a map(f) for storing the frequency of the characters.\nl and r are the left and right pointers each.\nOnce we reach a point where frequency of all th
I am using a map(`f`) for storing the `frequency` of the characters.\n`l` and `r` are the left and right pointers each.\nOnce we reach a point where frequency of all the characters `>0` then the number of substrings possible are `size(s) - r`. Now shifting the left pointer and calculating the answer for each case while the condition holds that `f[a], f[b], f[c] > 0`\n\n```\nint numberOfSubstrings(string s) {\n        map<char, int> f;\n        int l=0, r=0, cnt=0;\n        int n = s.size();\n        while(r < n) {\n            f[s[r]]++;\n            while(f[\'a\'] && f[\'b\'] && f[\'c\']) {\n                cnt += n-r;\n                f[s[l++]]--;\n            }\n            r++;\n        }\n        return cnt;\n    }\n\t```
['Two Pointers', 'Sliding Window']