scala onleliner. bitmap suffixes
scala []\nobject Solution {\n  import scala.util.chaining._\n  import collection.immutable.BitSet\n  def smallestSubarrays(nums: Array[Int]): Array[Int] =\n    
```scala []\nobject Solution {\n  import scala.util.chaining._\n  import collection.immutable.BitSet\n  def smallestSubarrays(nums: Array[Int]): Array[Int] =\n    nums.toList.zipWithIndex.reverseIterator.scanLeft((Map.empty[Int,Int],0)){case ((aMap,acc),(num,i))=>\n      (aMap ++ BitSet.fromBitMask(Array(num)).map(_ -> i), acc | num)\n    }.drop(1).toList.reverse.pipe(sfx => (nums.indices.toArray zip sfx).map{case (i,(bMap,mx)) =>\n      if(mx == 0) 1 else BitSet.fromBitMask(Array(mx)).iterator.map(bMap).max - i + 1\n    })\n}\n\n```
['Hash Table', 'Bit Manipulation', 'Prefix Sum', 'Scala']