scala unfold oneliner
same as "330. Patching Array" ( https://leetcode.com/problems/patching-array )\n\nobject Solution {\n  def getMaximumConsecutive(coins: Array[Int]): Int =\n    
same as "330. Patching Array" ( https://leetcode.com/problems/patching-array )\n```\nobject Solution {\n  def getMaximumConsecutive(coins: Array[Int]): Int =\n    (1 +: LazyList.unfold((1,coins.toList.sorted)){case (num, l) =>\n      //Option.unless(l.headOption.forall(num < _)){(num+l.head,(num+l.head, l.tail))}\n      Option.when(l.headOption.exists(num >= _)){(num+l.head,(num+l.head, l.tail))}\n    }).last\n}\n```
['Greedy', 'Recursion', 'Line Sweep', 'Sorting', 'Scala']