cswork / libraryOpen practice workspace

Interview questions · Amazon

Find longest common contiguous subarray

This question evaluates a candidate's proficiency in array and substring algorithm design, including concepts such as dynamic programming, hashing, and efficient search techniques.

Given two integer arrays A and B, find the length of the longest contiguous subarray that appears in both arrays. If multiple exist, return any one pair of starting indices as well. Discuss possible approaches (e.g., dynamic programming, binary search with rolling hash) and analyze time and space complexity.

Community answers

Nothing here yet.

Join in on CSWork →