Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def balancing(count: Integer, chars: List[Char]): Boolean={
- if (chars.isEmpty)
- if (count==0) true else false
- else{
- val head=chars.head
- if (head =='(') count+=1
- else if (head == ')') count-=1
- }
Advertisement
Add Comment
Please, Sign In to add comment