scala sliding window
scala []\nobject Solution {\n  def numberOfSubstrings(s: String, k: Int): Int = {\n    def f(l0: Int, l1: Int, r: Int, aMap: Map[Char,Int], acc: Int): Int =\n  
```scala []\nobject Solution {\n  def numberOfSubstrings(s: String, k: Int): Int = {\n    def f(l0: Int, l1: Int, r: Int, aMap: Map[Char,Int], acc: Int): Int =\n      if(aMap.values.maxOption.getOrElse(0)>=k) g(l0,l1,r,aMap,acc)\n      else if(r >= s.length) acc\n      else f(l0,l1,r+1,aMap+(s(r) -> (aMap(s(r))+1)),acc)\n    def g(l0: Int, l1: Int, r: Int, aMap: Map[Char,Int], acc: Int): Int =\n      if(aMap.values.maxOption.getOrElse(0)<k) f(l1,l1,r,aMap,acc + (s.length-r+1)*(l1-l0))\n      else g(l0,l1+1,r,aMap+(s(l1) -> (aMap(s(l1))-1)),acc)\n    f(0,0,0,Map().withDefaultValue(0),0)\n  }\n}\n```
['Hash Table', 'String', 'Sliding Window', 'Scala']