Jam City interview question

Do you know some algorithm?