Fruit Into Baskets
A row of trees has fruit types given by an array. You have two baskets, each holding one type of fruit without limit. Starting at any tree you pick one fruit from each tree moving right and must stop when a tree's fruit does not fit. Print the maximum number of fruits you can collect.
Constraints
1 <= n <= 10^5 0 <= type < n
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.