diff --git a/leetcode/p290_word_pattern.cpp b/leetcode/p290_word_pattern.cpp new file mode 100644 index 0000000..3902485 --- /dev/null +++ b/leetcode/p290_word_pattern.cpp @@ -0,0 +1,47 @@ +class Solution { +public: + bool wordPattern(string pattern, string s) { + map map1; + map map2; + vector v1; + // convert s to v1 + int len = s.length(); + string s1; + // this loop converts string s into a vector + for(int i=0;i