Advertisement
MiroJoseph

Highest Scoring Word

Apr 19th, 2020
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.23 KB | None | 0 0
  1. My:
  2. object Scoring {
  3.     def high(s: String) = {
  4.     s.split(" ").map(w => (w, w.map(_.toInt - 96).sum)).maxBy(_._2)._1
  5.   }
  6. }
  7.  
  8. Other:
  9. object Scoring {
  10.  
  11.   def high(s: String): String =
  12.     s.split(' ').maxBy(_.map(_ - 96).sum)
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement