scanLeft and scanRight, a Scala language concept
Last updated
Scala's `scan` functions enable you to do folds like foldLeft and foldRight, while collecting the intermediate results
This is incredibly useful when you need to collect a sequence of states, such as in MaximumSubArraySum.