PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCareers
|Home/Coding & Algorithms/Amazon

Solve three coding tasks: binary search, tree path, subarray

Last updated: Mar 29, 2026

Quick Overview

This set of problems evaluates algorithmic problem-solving across binary search for identifying a unique element in a sorted array, N-ary tree traversal and path matching with non-unique node values, and array algorithms for finding the longest common contiguous subarray.

  • Medium
  • Amazon
  • Coding & Algorithms
  • Software Engineer

Solve three coding tasks: binary search, tree path, subarray

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Solve the following coding tasks: 1) In a sorted array, every value appears exactly twice except for one value that appears once. Find the single value in O(log n) time and O( 1) extra space using a binary-search-based approach. 2) Given the root of an N-ary tree and a sequence of integers representing a path, determine whether this path exists in the tree. Each node may have multiple children and values are not guaranteed to be unique. A valid path must start from the root but does not need to end at a leaf node. Return true/false and analyze time and space complexity. 3) Given two integer arrays, compute the maximum length of a contiguous subarray that appears in both arrays. Discuss multiple approaches (e.g., dynamic programming; binary search on length with rolling hash) and their time/space trade-offs.

Quick Answer: This set of problems evaluates algorithmic problem-solving across binary search for identifying a unique element in a sorted array, N-ary tree traversal and path matching with non-unique node values, and array algorithms for finding the longest common contiguous subarray.

Related Interview Questions

  • Find Valid IP Addresses in Files - Amazon (medium)
  • Implement Optimal Bucket Batching - Amazon (hard)
  • Implement Cache and Rotate Matrix - Amazon (medium)
  • Find Longest Activatable Server Streak - Amazon (hard)
  • Build the Largest Available Sequence - Amazon (medium)
Amazon logo
Amazon
Aug 10, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
2
0

Solve the following coding tasks:

  1. In a sorted array, every value appears exactly twice except for one value that appears once. Find the single value in O(log n) time and O(
  2. extra space using a binary-search-based approach.
  3. Given the root of an N-ary tree and a sequence of integers representing a path, determine whether this path exists in the tree. Each node may have multiple children and values are not guaranteed to be unique. A valid path must start from the root but does not need to end at a leaf node. Return true/false and analyze time and space complexity.
  4. Given two integer arrays, compute the maximum length of a contiguous subarray that appears in both arrays. Discuss multiple approaches (e.g., dynamic programming; binary search on length with rolling hash) and their time/space trade-offs.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Amazon•More Software Engineer•Amazon Software Engineer•Amazon Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • Careers
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.