Candy crushing question (can be solved using a stack; can have more optimal solutions too). (copy-pasted from a previous description on Glassdoor, was asked the same question) 1-D Candy Crush - Given a string, collapse the characters appearing three or more together; on collapsing the new string must be checked for more collapses. Overall the resultant string must not contain any sequence of three or more characters.