This one was a simulation problem; simply keep checking the board for any occurrence of a pattern where an apple would drop, and iterate as long as any change is seen. while (true) { bool changed = false ; for (int i=0; i+1