add solution to Q4.7
add test for Q4.7