Company: Deshaw_13oct
Difficulty: medium
Maximum Recipes Problem Description Chef Bill has n recipes, labelled 1 to n , and wants to cook as many of them as possible tonight. His sous-chef has left m notes. Note i says that recipe p[i] must be finished strictly before recipe d[i] is started. Bill picks a set of recipes to cook and then cooks them one after another. A note only matters when both of its recipes are in the chosen set; a note that mentions a recipe Bill skips places no restriction on him. (inferred -- the source says that skipping exactly one recipe from every cyclic chain of notes is enough, which only holds if a skipped recipe frees the notes that mention it.) No recipe appears as the "after" recipe of more than one note, so every recipe has at most one recipe that must come directly before it. A note whose two recipes are the same ( p[i] = d[i] ) can never be satisfied, so that recipe can never be cooked. Return the largest number of recipes Bill can cook while respecting every note between the recipes he cook