Panda Guru LogoPanda
Guru

Amazon SDE Intern OA - London

Round 1

Questions:

  1. Given an array of n integers, there are (n - 2) normal numbers and the sum of the (n - 2) numbers originally in this array. If a number is neither in the original numbers nor is it their sum, it is an outlier. Discover the potential outliers and return the greatest of them.

  2. An Amazon warehouse manager is responsible for managing inventory and ensuring that each product has a unique identifier. There are n products in the warehouse, where the identifier of the i-th item is represented by the array identifier[i]. However, in the inventory management system, some items have the same identifier.

    To make all items in the inventory distinct, the following operation can be used:

    • Remove the first (leftmost) item from the inventory sequence.

    Given n products and the array identifier, find the minimum number of operations required to make all items in the inventory distinct.

    Example: Given:

    n = 6 identifier = [2, 3, 2, 1, 5, 2]

    Operations:

    • Remove the first 2, resulting in [3, 2, 1, 5, 2]
    • Remove the next 3, resulting in [2, 1, 5, 2]
    • Remove the next 2, resulting in [1, 5, 2]

    After 3 operations, identifier = [1, 5, 2], and all the elements of identifier are distinct.

    Hence, the minimum number of operations required to make all the elements of the array distinct is 3.

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.