Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.32 KB | None | 0 0
  1.     def balance(chars: List[Char]): Boolean = {
  2.       def innerBalance(chars: List[Char], counter: Int) : Boolean = {
  3.         if (counter < 0) return false
  4.         if (chars.isEmpty) return counter == 0
  5.         return innerBalance(chars.tail, counter + smth(chars.head))
  6.       }
  7.       return innerBalance(chars, 0)
  8.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement