Find longest common contiguous subarray

Quick Overview

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

Find longest common contiguous subarray

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

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.

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

|Home/Coding & Algorithms/Amazon
Amazon logo
Amazon
Sep 6, 2025, 12:00 AM
mediumSoftware EngineerOnsiteCoding & Algorithms
4
0

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.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...