Fruit Into Baskets — Longest Two-Distinct Subarray

Asked at Amazon · Coding Questions · Difficulty: Easy

Given `fruits` where `fruits[i]` is a fruit type, return the maximum length of a contiguous subarray containing at most two distinct values.

Loading the problem…