Minimum-Cost Color Sequence
Problem statement
For each day i, costs[i][0], costs[i][1], and costs[i][2] are the costs of choosing blue, green, or red.
Choose exactly one color per day, and never choose the same color on consecutive days. Return the unique minimum-cost color sequence as a string using b, g, and r.
Function
minimumCostColorSequence(costs: int[][]) → StringExamples
Example 1
costs = [[1,5,9],[4,2,8],[7,6,1]]return = "bgr"Choosing blue, green, then red costs 1 + 2 + 1 = 4, which is the unique minimum.
Example 2
costs = [[7,2,5]]return = "g"With one day, the least expensive choice is green.
Constraints
1 <= costs.length <= 100000.costs[i].length == 3.1 <= costs[i][j] <= 1000000.- The minimum-cost valid sequence is unique.