Technical interview question:
Given a 2D array A (M rows, N columns) of integers, find if any four elements of A with value V are at the corners of a rectangle.
Example:
Given
A = [[7, 9, 7, 1, 7, 2],
[8, 1, 0, 2, 1, 1],
[7, 0, 1, 0, 7, 3],
[1, 1, 6, 1, 1, 8],
[5, 2, 9, 7, 1, 7],]When V = 1, return true
When V = 7, return true
When V = 6, return false
Inputs are: A, V
Output: Boolean