Course 4, Week 4, Assignment 2, Exercise 3

The solution is discussed on your other thread about this.