cpp implementation of Jump Game