Solve a problem in stack