/*
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
Sur cette page du site, vous pouvez voir la vidéo en ligne JavaScript Coding Challenge/Interview Question: Same Char Collapse durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Daily Coding Challenges 20 mars 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 183 fois et il a aimé 5 téléspectateurs. Bon visionnage!