Add solution to 6th problem