id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

zbaharav@kehillah.org > parensBalanced
prev  |  next  |  chance

Return true if parentheses in the string are balanced, and false if they are not. Every opening parenthesis '(' needs to correspond to a closing parenthesis ')' later in the string. For example, '()' is balanced, but '(()' is not. For the purposes of this challenge, you may assume there will not be more closing parentheses than opening ones, and the first parenthesis in the string will be an open parenthesis.


parensBalanced("(())") → true
parensBalanced("()()") → true
parensBalanced("(()())") → true

...Save, Compile, Run (ctrl-enter)

public boolean parensBalanced(String str){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Post-solution available

Copyright Nick Parlante 2017 - privacy