Ingredients of types "fat", "fib" and "carb" arrive one per day over n days. For each day output 1 if a dish can be cooked, else 0: a dish needs 3 ingredients in stock with at least 2 of the same type, and when there are multiple options the earliest-arrived ingredients must be used.
Asked in the Round 1 DSA stage.
Input: ingredients, a list of strings in arrival order. Return a list of 0 and 1 values, one per day. When cooking, choose the valid triple with the earliest arrival-order indices and remove those ingredients from stock.
Example: ['fat', 'fib', 'fat'] returns [0, 0, 1].
def cook_dishes(ingredients):