We have a 2D array which is NxN in size .We choose any row and shift it left or right . Like if a row is "3 4 5 6" we can shift this by 1 unit to right to get "6 3 4 5" . So I have to print all possible 2D array from a given array using row shift shown as above.
It gets very tricky combination , I tried iteratively but it became too complex for me so I think it should be easier if we tackle this problem recursively , but I couldn't complete the problem anyways . I have no problem in shift but i run into problem at generating all possible combinations .
This is what I found relating but couldn't apply to my own problem.