View difference between Paste ID: tD1zr7xa and q48x53rA
SHOW: | | - or go back to the newest paste.
1
    def balancing(count: Integer, chars: List[Char]): Boolean={
2-
      if (chars.isEmpty)
2+
      if (chars.isEmpty) {
3-
      	if (count==0) true else false
3+
        count == 0
4-
      else{
4+
5-
        val head=chars.head
5+
      } else {
6-
        if (head =='(') count+=1
6+
        val c = chars.head
7-
        else if (head == ')') count-=1
7+
8
        if (c == '(') {
9
            balancing(count+1, chars.tail)
10
        } else if (c == ')') {
11
            balancing(count-1, chars.tail)
12
        } else {
13
            balancing(count, chars.tail)
14
        }
15
    }