CDAP Interview Question

2 mid - hard coding problem