/*
Write a function same_char_collapse that takes in a string and
returns a collapsed version of the string. To collapse the string,
we repeatedly delete 2 adjacent characters that are the same until
there are no such adjacent characters. If there are multiple pairs
that can be collapsed, delete the leftmost pair. For example, we take
the following steps to collapse "zzzxaaxy": zzzxaaxy -- zxaaxy -- zxxy -- zy
*/
console.log(sameCharCollapse("zzzxaaxy")); // "zy" === because zzzxaaxy -- zxaaxy -- zxxy -- zy
console.log(sameCharCollapse("uqrssrqvtt")); // "uv" === because uqrssrqvtt -- uqrrqvtt -- uqqvtt -- uvtt -- uv
On this page of the site you can watch the video online JavaScript Coding Challenge/Interview Question: Same Char Collapse with a duration of hours minute second in good quality, which was uploaded by the user Daily Coding Challenges 20 March 2020, share the link with friends and acquaintances, this video has already been watched 183 times on youtube and it was liked by 5 viewers. Enjoy your viewing!