100% Beats || Sliding Window Approach || JAVA
Intuition\n Describe your first thoughts on how to solve this problem. \n1. 100% BEATS\n2. Sliding Window Approach.\n\n# Approach\n Describe your approach to so
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n1. 100% BEATS\n2. Sliding Window Approach.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n**Here we will use sliding window approach.And for every window we will contain an array of character which will contain the count of alphabets occuring in the substring and if any character appears more than k times we will increase the ans count.**\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n    O(n^2)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(1)\n# Code\n```java []\nclass Solution {\n    public int numberOfSubstrings(String s, int k) {\n        int ans = 0;\n        for(int i = 0 ; i<s.length(); i++){\n            int[] ch = new int[26];\n            for(int j = i ; j < s.length() ; j++){\n                ch[s.charAt(j)-\'a\']++;\n                for(int l : ch){\n                    if(l>=k){\n                        ans++;\n                        break;\n                    }\n                }\n            }\n        }\n        return ans;\n    }\n}\n```
['Java']