前10分钟问了简历.
写代码写了15分钟,剩下5分钟提问
下面这题:
Given two integer arrays, find the first starting point of one array in the second array. Basically, second array is a subarray in the first array and you have to return the index of the starting point of the subarray. If subarray doesn’t exist, then return -1.
Example:
Input:
[1,2,4,5,7,8]
[4,5]
Output: 2
Input:
[1,2,2,2,2,2,2,3]
[2,2,2,3]
Output: 4
我只做出来 O(n* m) 解法