I have a 2D array of ints and I want to check that within this array, only one value of each number 1 through N exist (for example, N being 9, that only 1-9 exist once and only once). I was thinking of approaching this by using some sort of loop and testing each element value against the loop counter. Anyone got some suggestions?
Not sure what you're going after here. The whole array can only have once instance of a specific number? I'll recommend using a 1D array, you can use them the same way as a 2D array, and it's much easier to work with
Off the top of my head, I came up with the following code. It needs some tweaking, so that the loop skips a future location, if it has had a match before.
There's probably a better/cleaner way to do it, but here it is: