Created
December 1, 2016 18:11
-
-
Save ethanmpeterson/746807667c9fdb197b38cbcb03601793 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // your code here | |
| func verify(expression : String) -> Bool { | |
| // get all chars in an array | |
| var closeP = 0 | |
| var openP = 0 | |
| for char in expression.characters { | |
| if (char == "(") { | |
| openP += 1 | |
| } else if (char == ")") { | |
| closeP += 1 | |
| } | |
| } | |
| if (closeP == openP) { | |
| return true | |
| } else { | |
| return false | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment