Hello!
I have an assignment in which I have to check if an entered 2D array is a latin square, such as
1234
4321
2413
3142
I know that I need to make a bool function in which every row is sorted and and check if it then is the same as an array[n]{1;2;3;4;...;n}.
I have never dealt with 2D arrays so my problem is - how can I sort every row vertically and horizontally AND then check if it is the same as this array[n]?
Any help is gladly appreciated!
In one sense do not think of the array as a 2D array, but multiple 1D arrays. I do not see any reason to deal with the 2D array vertically, horizontally will work just fine.
I have not tried any code yet, so see what you can come up with and we can go from there.