Title: #890 - Find and Replace Pattern - LeetCode JavaScript Solutions
Open Graph Title: #890 - Find and Replace Pattern - LeetCode JavaScript Solutions
X Title: #890 - Find and Replace Pattern - LeetCode JavaScript Solutions
Description: You have a list of words and a pattern, and you want to know which words in words matches the pattern. A word matches the pattern if there e...
Open Graph Description: You have a list of words and a pattern, and you want to know which words in words matches the pattern. A word matches the pattern if there e...
X Description: You have a list of words and a pattern, and you want to know which words in words matches the pattern. A word matches the pattern if there e...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/find-and-replace-pattern
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/find-and-replace-pattern","name":"#890 - Find and Replace Pattern - LeetCode JavaScript Solutions","description":"You have a list of words and a pattern, and you want to know which words in words matches the pattern. A word matches the pattern if there e...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {string[]} words\n * @param {string} pattern\n * @return {string[]}\n */\nvar findAndReplacePattern = function(words, pattern) {\n const map = (p, o = {}, count = 0) => p.split('').map(c => o[c] = o[c] || String(count++)).join('');\n return words.filter(word => map(word) === map(pattern));\n};","keywords":"LeetCode 890, #890 - Find and Replace Pattern, Medium, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}
| author | LeetCodeJavascript.com |
| og:type | article |
| og:image | https://leetcodejavascript.com/og-image.jpg |
| og:site_name | LeetCode JavaScript Solutions |
| twitter:card | summary_large_image |
| twitter:url | https://leetcodejavascript.com/solutions/find-and-replace-pattern |
| twitter:image | https://leetcodejavascript.com/og-image.jpg |
| twitter:creator | @joshcrozier |
| theme-color | #1f2937 |
Links:
| LeetCodeJavascript.com | https://leetcodejavascript.com/ |
| Star on GitHub | https://github.com/JoshCrozier/leetcode-javascript |
| Back to all solutions | https://leetcodejavascript.com |
| View on LeetCode | https://leetcode.com/problems/find-and-replace-pattern/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/0890-find-and-replace-pattern.js |
| Array | https://leetcodejavascript.com/tags/array |
| String | https://leetcodejavascript.com/tags/string |
| Hash Table | https://leetcodejavascript.com/tags/hash-table |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width,initial-scale=1
Robots: index, follow