Bloomberg interview question

Q: Write an algorithm to solve Candy Crush on one dimensional axis.