Skip to content

Commit 1562c6b

Browse files
Add short-circuiting operator to first conditional
1 parent 40d369d commit 1562c6b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Algorithms/Strings/PatternMatching/WildCardMatcher.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public static class WildCardMatcher
66
{
77
public static bool MatchPattern(string inputString, string pattern)
88
{
9-
if (pattern.Length > 0 & pattern[0] == '*')
9+
if (pattern.Length > 0 && pattern[0] == '*')
1010
{
1111
throw new ArgumentException("Pattern cannot start with *");
1212
}
@@ -35,7 +35,7 @@ public static bool MatchPattern(string inputString, string pattern)
3535
{
3636
for (var j = 1; j < patternLength; j++)
3737
{
38-
// If the characters match or the pattern has a ., then the result is the same as the previous characters
38+
// If the characters match or the pattern has a ., then the result is the same as the previous positions.
3939
if (inputString[i - 1] == pattern[j - 1] || pattern[j - 1] == '.')
4040
{
4141
dp[i, j] = dp[i - 1, j - 1];

0 commit comments

Comments
 (0)