solution to shift problem in place