Search⌘ K
AI Features

Solution: Fruit Into Baskets

Solution: Fruit Into Baskets asks you to find the longest contiguous section of a fruit array that can be collected using only two fruit types, taking one from every tree.

Statement

While visiting a farm of fruits, you have been given a row of fruits represented by an integer array, fruits, where fruits[i] is the type of fruit the ithi^{th} ...