Algorithm · Meta · Medium
Problem: Mouse and Cheese There are n pieces of cheese and two mice. For each piece i, mouse 1 would earn reward1[i] and mouse 2 would earn reward2[i]. Mouse 1 must eat exactly k pieces; the remaining n - k pieces go to mouse 2. Your task is to compute the maximum possible total reward. Function Signature Parameters n: number of cheese pieces. k: number of pieces mouse 1 must eat. reward1: list of n integers – reward for mouse 1 on each piece. reward2: list of n integers –…
Checking your access…