Title: #722 - Remove Comments - LeetCode JavaScript Solutions
Open Graph Title: #722 - Remove Comments - LeetCode JavaScript Solutions
X Title: #722 - Remove Comments - LeetCode JavaScript Solutions
Description: Given a C++ program, remove comments from it. The program source is an array where source[i] is the i-th line of the source code. This repre...
Open Graph Description: Given a C++ program, remove comments from it. The program source is an array where source[i] is the i-th line of the source code. This repre...
X Description: Given a C++ program, remove comments from it. The program source is an array where source[i] is the i-th line of the source code. This repre...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/remove-comments
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/remove-comments","name":"#722 - Remove Comments - LeetCode JavaScript Solutions","description":"Given a C++ program, remove comments from it. The program source is an array where source[i] is the i-th line of the source code. This repre...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {string[]} source\n * @return {string[]}\n */\nvar removeComments = function(source) {\n return source.join('\\n').replace(/\\/\\*.*?\\*\\/|\\/\\/[^\\n]+/gs, '').split(/\\n/).filter(Boolean);\n};","keywords":"LeetCode 722, #722 - Remove Comments, 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/remove-comments |
| 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/remove-comments/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/0722-remove-comments.js |
| Array | https://leetcodejavascript.com/tags/array |
| String | https://leetcodejavascript.com/tags/string |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width,initial-scale=1
Robots: index, follow