медленное решение для 10. Regular Expression Matching
This commit is contained in:
29
10. Regular Expression Matching/Program.cs
Normal file
29
10. Regular Expression Matching/Program.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
var solution = new Solution();
|
||||
|
||||
var examples = new (string s, string p, bool expected)[]
|
||||
{
|
||||
("aa", "a", false),
|
||||
("aa", "a*", true),
|
||||
("ab", ".*", true),
|
||||
("aab", "c*a*b", true),
|
||||
("mississippi", "mis*is*p*.", false),
|
||||
("mississippi", "mis*is*ip*.", true),
|
||||
("aaa", "a*a", true),
|
||||
("aaa", "ab*a*c*a", true),
|
||||
("ab", ".*c", false),
|
||||
("", "c*", true),
|
||||
("abcd", "d*", false),
|
||||
("", "", true),
|
||||
("a", ".", true),
|
||||
("", "a*", true),
|
||||
("aa", "b*a*", true),
|
||||
("a", "ab*", true),
|
||||
("abcaaaaaaabaabcabac", ".*ab.a.*a*a*.*b*b*", true),
|
||||
("", "a*b*", true),
|
||||
};
|
||||
|
||||
foreach (var example in examples)
|
||||
{
|
||||
var result = solution.IsMatch(example.s, example.p);
|
||||
Console.WriteLine($"s = \"{example.s}\", p = \"{example.p}\" => {result} (expected {example.expected})");
|
||||
}
|
||||
Reference in New Issue
Block a user