...

/

Solution: Fruit Into Baskets

Solution: Fruit Into Baskets

Let’s solve the Fruit Into Baskets problem using the Sliding Window pattern.

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} tree produces. You have to collect fruits, but there are some rules that you must follow while collecting fruits:

  • You are given only two baskets, each capable of holding an unlimited quantity of a single type ...

Access this course and 1400+ top-rated courses and projects.