Send your feedback or ask for help here!
The longest possible good feast is always 0 is there are not enough good meals and the amount of food when there are enough good meals.
That’s what I read in the statement.
Or maybe not but there should have been more test cases in order to understand the statement, that is not very clear.
The longest possible good feast is only 0 when there is no good food.
You will always have a good feast if you choose the good food only, although that may not necessarily be the longest one. To get the longest one, the bad food may have to be included as well. As per the statement, a feast is good if the number of good food items is greater than the number of bad food items in the selected subarray.
Can you sort the list?
No sorting should be performed.
I still think that there are not enough test cases.
You may leave a comment on the contribution page to request the author to add more? I don’t know why the post created by @CommunityBot here doesn’t include a ping to the author.
Agree there is not enough test cases.
In the process of “adding bad food”, there is not enough tests about how many bad food can be legally added. It is not about counting of good/bad only. The starting and ending positions of the feast is also important.
I also suspect the current cases are not big enough to rule out brute-force.
Tests case are ok using basic brute force but validators are not.
Edit : Brute force is always ok on validators if you separately test no good fruit and one good fruit. I think tests and validators need improvement.