Subarray Containing Two Values With the Fewest Distinct Numbers
Asked at Amazon · Coding & Leetcode-style Questions · Difficulty: Medium
Given an integer array `array` and two integers `series1` and `series2`, find a contiguous subarray that contains at least one occurrence of `series1` and at least one occurrence of `series2`, and that has as few **distinct** values as possible. Return that number of distinct values.
Loading the problem…