In a grid of NXN, you have to find if an element appears k times consecutively (up, down, left, right, diagonal). If yes, return the element else return -1.
If multiple elements exist, return the smallest number.
input1- The value of N input, A 2-d array representing the grid (all elements ) input3: The value of k
Returns the smallest element which appears k times consecutively (up. down, left, right, diagonal). If no such element exists, return -1.
in this grid,3 is available for 3 times in the diagonal