Make All Elements Distinct (Amazon London)

Problem Overview

  • Given an array of product identifiers, find the minimum number of leftmost removals needed so all remaining identifiers are distinct.
  • Input: n and identifier[n]; Output: an integer for the minimal operations.
  • Real-world context: Amazon warehouse inventory where duplicate IDs must be eliminated by trimming the start of the sequence.
  • Amazon London interview question: a coding interview problem asked in Amazon interviews, suitable for a coding interview practice.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: