Orchard Harvest Window

An orchard row contains fruit trees represented by the numbers in fruits. You walk from left to right and may harvest one contiguous stretch of trees. You carry exactly two baskets. Each basket can hold fruit from only one tree type, with no limit on quantity.

Return the greatest number of consecutive trees you can harvest while using at most two fruit types.

Examples
Input: [1,2,1]
Output: 3
Hints

Orchard Harvest Window

An orchard row contains fruit trees represented by the numbers in `fruits`. You walk from left to right and may harvest one contiguous stretch of trees. You carry exactly two baskets. Each basket can hold fruit from only one tree type, with no limit on quantity.