Can someone please help me with the following question:
Given a string "A B A B C A B A B C D", you have to compress it into the following format:
ABCD
Here till AB* of the output, A B repeats twict, but still ABC, ABABC repeats twice.
This question was asked to me in an interview[Goldman Sachs] and i couldn't come up with a solution.