How to solve this ??

Revision en1, by bhagya.kjain, 2023-11-15 13:16:08

Given a string, compress the string as optimal as possible by removing the consecutive characters if 3 or more consecutive characters .

This is like a candy crush game !

Eg : Input : "aabbbbac", output will be "c" .

First, you can remove all the "bbbb", then string turns to be "aaac".

Then, "aaac" turns to be "c" .

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English bhagya.kjain 2023-11-15 13:16:08 357 Initial revision (published)