Little Jimmy is going trick or treating. He lives in an odd neighborhood: some houses give out candy, and some give out toothbrushes. Now, Jimmy does not want to get too many toothbrushes. He wants candy! You must help him get some.
Each street in Jimmy's neighborhood has a number. Each house on the street will give out either candy or toothbrushes. However, Jimmy's parents know he gets very hyper if he eats too much candy. To prevent this, they are only letting him go down one street in the neighborhood. Given a list of streets, you must output the street where Jimmy will get the most candy and the fewest toothbrushes. This means that, as said in the comments, even if one street gives out 500 candies and 1 toothbrush, it is worse than one that gives out 1 candy and no toothbrush.
- The list of streets will be 2D. It will never be empty. Each street will be a list of truthy or falsy values. It might be empty. Falsy values represent a house that gives out toothbrushes, truthy ones represent houses that give out candy.
- Your program must output the index of the street with the most truthy values and the fewest falsy ones, or the street that gives the most candy and the fewest toothbrushes. If all the streets have the same amount of candy and toothbrushes, you may output -1. It does not matter if the index is 0-based or 1-based. It can be stored as a string. The integer can be in any base.
Note: In these lists,
True represents a truthy value and
False a falsy one.
0 can be replaced with
1 if your language uses 1-indexing.
Streets: [[False, True],[False,True,True]]
This is code-golf, so shortest code in bytes wins!