I have a 2D array as shown below:
array = [ [ 1, 1 ], [ 1, 2 ], [ 1, 1 ], [ 2, 3 ] ]
I am looking to compare the values in the array indexes to check for duplicates. For example
array[0] = [1,1];
array[1] = [1,2];
array[2] = [1,1];
We can see that the values at index 0 and 2 are the same, which is [1,1]. In this case, I want to return a true flag. What is the most efficient way to achieve this? Are there different methods to accomplish this task? Any suggestions or help with explanations would be greatly appreciated. Thank you in advance.