🦚 Simple Approaches || Wise Approach || Slay It !! || Simple & Concise Code || C++ Code Reference
\n\n## " I think and think for months and years. Ninety-nine times, the conclusion is false. The hundredth time I am right. " ~ Albert Einstein\n\n---\n# Intuit
\n\n## " I think and think for months and years. Ninety-nine times, the conclusion is false. The hundredth time I am right. " ~ Albert Einstein\n\n---\n# Intuition\n- Intuition Expire Ho Chuka Hai !\n# Approach\n- Just Iterate The Moment You Find All Are Present, Add Them To Count &  Shrink Window Size From Left To Form New Window, Satisfying Condition.\n- The Wise One !! \n    - Apporach 3. Uses Last Seen. \n\n\n# Code\n\n```cpp [1. Storing Frequency]\n\n    int numberOfSubstrings(string s) {\n        int i=0,j=0,n=s.length(), count=0;\n        int m[3]={0,0,0};\n\n        while(j<n)\n        {\n            m[s[j]-\'a\']++;\n\n            while(m[0] && m[1] && m[2])\n                m[s[i++]-\'a\']--;\n            \n            count+= i;\n            j++;\n        }\n\n        return count;\n    }\n\n```\n```cpp [2. Almost Same As 1. ]\n\n    int numberOfSubstrings(string s) {\n        int i=0,j=0,n=s.length(), count=0;\n        int m[3]={0,0,0};\n\n        while(j<n)\n        {\n            m[s[j]-\'a\']++;\n\n            while(m[0] && m[1] && m[2])\n                count+= n-j,\n                m[s[i++]-\'a\']--;\n            \n            j++;\n        }\n\n        return count;\n    }\n\n```\n```cpp [3. Storing Last Seen !]\n\n    int mini(int a,int b,int c)\n    { return (a<b && a<c)? a : (b<c) ? b : c;  }\n\npublic:\n\n    int numberOfSubstrings(string s) \n    {\n        int n=s.length(), count=0,\n\n        // To store last seen index\n        m[3]={-1,-1,-1};\n        \n        for(int i=0;i<n;i++)\n            m[s[i]-\'a\']=i,\n            count+= 1 + mini(m[0],m[1],m[2]) ;\n        \n        return count;\n    }\n\n```\n# Guy\'s Upvote Pleasee !! (\u02E3\u203F\u02E3 \u035C)\n
['Hash Table', 'String', 'Sliding Window', 'C++']