sliding window |  C++ || beginner || Easy Explains
Intuition   -> \n  \nthere are 3 thing notice  in any sliding window question\n\n1. string /Arry type question \n2. output type length of substring or max and m
# Intuition   -> \n  \nthere are 3 thing notice  in any sliding window question\n\n1. string /Arry type question \n2. output type length of substring or max and min size of substring /subarry \n3.  subtring / subarry size fixed  or may be not fixed size \n\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nin this question we apply sliding window --->  varible window size \n\n\n\n\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)  becuase every time map size is 3 .\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int numberOfSubstrings(string s) {\n        int i=0;\n        int j=0;\n        int count=0;\n        map<char,int>mp;\n\n        while(j<s.size()){\n             mp[s[j]]++;            //calculation part\n             if(mp.size() <3){     //window size is not hit so increase j\n                 j++;\n             }\n              else if(mp.size()==3){      //hit the window size\n\n                  while(mp.size()==3){       // here we try to find answer from calcuation \n                      count+=s.size()-j;\n                      mp[s[i]]--;           // reduce count from map\n                      if(mp[s[i]]==0){       // map is emtpy then we remove from map\n                          mp.erase(s[i]);     \n                      }\n                     \n                      i++;\n                  }\n                  j++;\n             }      \n        }\n       \n        return count;         \n        \n    }\n};\n```
['Ordered Map', 'Sliding Window', 'C++']