Ok this one is like my previous array searching challenge but with a twist.
You must build a function to search one 2d array (or suitable equivalent in your language) of 32-bit integers for another, and return the X and Y index that the second array exists within the first. If the second array does not completely and contiguously exist in the first (i know the 1 dimensional term for it is substring, don't know the 2-dimensional term for it), then you must return -1, -1.
Example 1:
20, 30, 40 ,50
60, 70, 80, 90
100, 110, 120, 130
70, 80
110, 120
Expected Output 1: 1, 1
Example 2:
89, 20, 92, 48
58, 29, 63, 21
96, 12, 39, 42
947, 124, 948, 912
92, 48
64, 22
Expected Output: -1, -1
Misc:
- Your function must take any array size of up to an array of the maximum value of a 16 bit signed integer. (in X and/or Y)
- Any references for your function must be included, though other test harness data is not (any sort of main function, etc.)
- No use of internal or external predefined functions that serve this purpose.
- Your function must merely return the argument; how you display it to the user is up to you.
- If there are multiple copies of the second in the first, it must return the starting index who's X + Y value is lowest (Pretty much any criteria here is going to be arbitrary so this is the one i picked). If you have 2 matches with the same value, you may select which to return.