Advertisement
Guest User

Untitled

a guest
Jul 12th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.20 KB | None | 0 0
  1. // Assuming that there is no Nil (it's a smell in Scala)
  2. def maxBidAndEffectivePrice(list: List[Int]): Option[Int] = {
  3.   list match {
  4.     case l if list.nonEmpty => Some(l.max)
  5.     case _ => None
  6.   }
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement