lc problem 76 : minimum window substring will help || easy to understand || must see
Code\ncpp []\nclass Solution {\npublic:\n    long long validSubstringCount(string str1, string str2) {\n        unordered_map<char,int>mp;\n        for(int i = 
# Code\n```cpp []\nclass Solution {\npublic:\n    long long validSubstringCount(string str1, string str2) {\n        unordered_map<char,int>mp;\n        for(int i = 0 ; i < str2.length() ; i++)\n        {\n             mp[str2[i]]++;\n        }\n        int count = mp.size();\n\n        int start = 0;\n        int end   = 0;\n        \n        long long int ans = 0;\n\n        while(end < str1.length())\n        {\n             mp[str1[end]]--;\n             if(mp[str1[end]] == 0) count--;\n             else if(mp[str1[end]] < 0) {};\n\n             while(count == 0)\n             {\n                  ans = ans + 1LL + ((str1.length()-1) - (end+1) + 1);\n                  mp[str1[start]]++;\n                  if(mp[str1[start]] > 0) count++;\n                  start++;\n             } \n       \n             end++;             \n        }\n        return ans;\n    }\n};\n```
['Hash Table', 'String', 'Sliding Window', 'C++']