Pushing a solution to the geeks for geeks question