[scala] fp + counting + sliding_window + math
Complexity\n- Time complexity: O(m\xB7n)\n- Space complexity: O(m)\n\n# Code\nscala\nobject Solution {\n  def numberOfBeams(bank: Array[String]): Int =\n    ban
# Complexity\n- Time complexity: $$O(m\xB7n)$$\n- Space complexity: $$O(m)$$\n\n# Code\n```scala\nobject Solution {\n  def numberOfBeams(bank: Array[String]): Int =\n    bank\n      .map(_.count(_ == \'1\'))\n      .filter(_ > 0)\n      .appended(0)\n      .sliding(2)\n      .map(_.reduce(_ * _))\n      .sum\n}\n```
['Array', 'Math', 'String', 'Sliding Window', 'Scala']