I am having doubt in solving pattern number 12 please help in understanding the algorithm for the pattern