simplify jump game 2 algorithm