We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent df2fda3 commit 6a642a0Copy full SHA for 6a642a0
0020-valid-parentheses.cpp
@@ -16,10 +16,10 @@ class Solution {
16
if (c == '(' || c == '[' || c == '{') { // opening parentheses
17
stack.push_back(c);
18
} else if (stack.empty() ||
19
- stack.back() != (c == ')' ? '(' : // cursed mapping using
20
- c == ']' ? '[' : // ternary operators
21
- c == '}' ? '{' : // with fallback
22
- c)) { // condition
+ stack.back() != (c == ')' ? '(' : // matching closing
+ c == ']' ? '[' : // parentheses with
+ c == '}' ? '{' : // open parentheses
+ c)) {
23
return false;
24
} else {
25
stack.pop_back();
0 commit comments