Add iterative and recursive solutions for Q2