Title: #844 - Backspace String Compare - LeetCode JavaScript Solutions
Open Graph Title: #844 - Backspace String Compare - LeetCode JavaScript Solutions
X Title: #844 - Backspace String Compare - LeetCode JavaScript Solutions
Description: Given two strings `s` and `t`, return true if they are equal when both are typed into empty text editors. '#' means a backspace ch...
Open Graph Description: Given two strings `s` and `t`, return true if they are equal when both are typed into empty text editors. '#' means a backspace ch...
X Description: Given two strings `s` and `t`, return true if they are equal when both are typed into empty text editors. '#' means a backspace ch...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/backspace-string-compare
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/backspace-string-compare","name":"#844 - Backspace String Compare - LeetCode JavaScript Solutions","description":"Given two strings `s` and `t`, return true if they are equal when both are typed into empty text editors. '#' means a backspace ch...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {string} s\n * @param {string} t\n * @return {boolean}\n */\nvar backspaceCompare = function(s, t) {\n return handleBackspaces(s) === handleBackspaces(t);\n};\n\nfunction handleBackspaces(input) {\n return input.split('').reduce((result, char) => {\n if (char === '#') {\n result.pop();\n } else {\n result.push(char);\n }\n return result;\n }, []).join('');\n}","keywords":"LeetCode 844, #844 - Backspace String Compare, Easy, 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/backspace-string-compare |
| 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/backspace-string-compare/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/0844-backspace-string-compare.js |
| String | https://leetcodejavascript.com/tags/string |
| Two Pointers | https://leetcodejavascript.com/tags/two-pointers |
| Simulation | https://leetcodejavascript.com/tags/simulation |
| Stack | https://leetcodejavascript.com/tags/stack |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width,initial-scale=1
Robots: index, follow