You are viewing a single comment's thread. Return to all comments →
just adding another approach for reference
let array =[] for (const ch of s) { if (array.length && array[array.length-1]==ch){ array.pop(); } else { array.push(ch) } } return array.join('') || "Empty String"
Seems like cookies are disabled on this browser, please enable them to open this website
Super Reduced String
You are viewing a single comment's thread. Return to all comments →
just adding another approach for reference
let array =[] for (const ch of s) { if (array.length && array[array.length-1]==ch){ array.pop(); } else { array.push(ch) } } return array.join('') || "Empty String"