Created
March 2, 2020 14:01
-
-
Save vitkarpov/0d1fa4f76934808bfee8b286c38f823a to your computer and use it in GitHub Desktop.
Valid Parentheses LeetCode grader
This file contains 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
#include <stdexcept> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
class Solution { | |
public: | |
bool isValid(string s) { | |
// твой код здесь | |
} | |
}; | |
int main() { | |
vector<pair<string, bool>> tests = {{"()", true}, | |
{"()[]{}", true}, | |
{"(]", false}, | |
{"([)]", false}, | |
{"{[]}", true}}; | |
Solution solution; | |
for (auto v : tests) { | |
assert(solution.isValid(v.first) == v.second); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment