Amazon Care Get Minimum Score

Problem Overview

  • Find a subarray that contains both specified numbers and has the fewest distinct integers; return that distinct count.
  • Input: integer array and two target numbers; Output: an integer count; if targets are identical, return 1 if present, else 0.
  • Relevant to data filtering/analytics: minimize category diversity while including both targets.
  • Asked in Amazon interviews: a coding interview problem and interview question.

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: