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 256c015 commit 8e06ca7Copy full SHA for 8e06ca7
2018.11.30-leetcode890/GatesMa.md
@@ -0,0 +1,25 @@
1
+# C++
2
+```
3
+class Solution {
4
+public:
5
+ bool strMatch(string str, string pattern){
6
+ int len = str.length();
7
+ for(int i=0;i < len;i++){
8
+ for(int j=i+1;j < len;j++){
9
+ if((str[i] == str[j]) && (pattern[i] != pattern[j])) return false;
10
+ if((str[i] != str[j]) && (pattern[i] == pattern[j])) return false;
11
+ }
12
13
+ return true;
14
15
+ vector<string> findAndReplacePattern(vector<string>& words, string pattern) {
16
+ vector<string> set;
17
+ for(int i=0;i < words.size();i++){
18
+ if(strMatch(words[i], pattern)){
19
+ set.push_back(words[i]);
20
21
22
+ return set;
23
24
+};
25
0 commit comments