Back to problems

Lowest Cost Shirts

Algorithm · OpenAI · Medium

Over the coming n days you must purchase precisely one shirt per day, choosing among blue, green and red. The price of each color on day i is blue_costs[i], green_costs[i] and red_costs[i] respectively. Two consecutive days may never have the same color. Implement the function below: It should return a list of length n giving the color bought on each day so that the overall amount spent is as small as possible. Encode blue as 'b', green as 'g' and red as 'r'. You may rely on…

Loading the rest of the question…