Base and perf cases failing

Base and perf cases failing in fruit into baskets

Check if you are taking contingous sub array to solve the issue. Use the example to debug :

Input :
5
2 2 1 0 2

Output : 
3