I explained how the solution will work in all cases for the second problem