✅✅Simple Best Approach #C++ #Sliding Window ✅✅
Intuition\nif any substr having at lest 1 a,b and c then it will form substr with all element neext to it till the last element in given string\nso we will chec
# Intuition\nif any substr having at lest 1 a,b and c then it will form substr with all element neext to it till the last element in given string\nso we will check the frequecny of a , , and c if it is greater than or equal to 1 then ans will increase to( size- pointer where we got substr ) \n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n$$O(n)$$ \n\n- Space complexity:\n. $$O(1)$$ \n\n# Code\n```\nclass Solution {\npublic:\n    int numberOfSubstrings(string s) {\n       int i=0,j=0,ans=0;\n       map<char,int>mp;\n       int n=s.size();\n       while(j<n){\n           mp[s[j]]++;\n           while(mp[\'a\']>=1 &&mp[\'b\']>=1 && mp[\'c\']>=1 && i<=j){\n               mp[s[i]]--;\n               ans+=n-j;\n               i++;\n           }\n           j++;\n       }\n       return ans;\n\n    }\n};\n```
['C++']