output for 4 should be 1 1 1 2 2 1 1 2 3 3 2 1 1 2 3 4 3 2 1
hello @sraj39273
i think u have raised doubt from wrong question. whch question it is?