Skip to content

Instantly share code, notes, and snippets.

@ethanmpeterson
Created December 1, 2016 18:11
Show Gist options
  • Select an option

  • Save ethanmpeterson/746807667c9fdb197b38cbcb03601793 to your computer and use it in GitHub Desktop.

Select an option

Save ethanmpeterson/746807667c9fdb197b38cbcb03601793 to your computer and use it in GitHub Desktop.
// 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