While solving Skibidi Table problem, (problem link: https://mirror.codeforces.com/contest/2093/problem/D ) I was wondering How to Generate the Pattern->
Number of Rows: $$$2^n$$$
Number of Columns: $$$2^n$$$
Number of Cells: $$$2^{2n}$$$
$$$n=1:$$$
$$$1$$$ $$$4$$$
$$$3$$$ $$$2$$$
$$$n=2:$$$
$$$1$$$ $$$4$$$ $$$13$$$ $$$16$$$
$$$3$$$ $$$2$$$ $$$15$$$ $$$14$$$
$$$9$$$ $$$12$$$ $$$5$$$ $$$8$$$
$$$11$$$ $$$10$$$ $$$7$$$ $$$6$$$
$$$n=3:$$$
1 4 13 16 49 52 61 64
3 2 15 14 51 50 63 62
9 12 5 8 57 60 53 56
11 10 7 6 59 58 55 54
33 36 45 48 17 20 29 32
35 34 47 46 19 18 31 30
41 44 37 40 25 28 21 24
43 42 39 38 27 26 23 22
And so on......
An idea of implementing it by Recursion came to my mind Alhamdulillah!
As for each case, we are first entering the $$$1st$$$ cell, then the $$$4th$$$ cell, then the $$$3rd$$$ cell, then $$$2nd$$$ cell. Recursively calling it, we can store the pattern in an array & print it to get the pattern!



