FastPrepLowest-Cost Shirt Color Schedule
Problems/Lowest-Cost Shirt Color Schedule

Lowest-Cost Shirt Color Schedule

ElevenLabs logoElevenLabs● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives three shirt colors, positive costs for each day, the rule that the same color cannot be used on two days in a row, and a guarantee that the best answer is unique. We chose how the cost matrix is passed in and the function signature.

For each day, costs[i][0], costs[i][1], and costs[i][2] are the costs of wearing a blue, green, or red shirt. Choose exactly one shirt per day, and never choose the same color on consecutive days.

Return the unique minimum-cost color sequence using the characters b, g, and r.

Function

lowestCostShirtColors(costs: int[][]) → String

Examples

Example 1

costs = [[1,5,9],[4,2,8],[7,6,1]]return = "bgr"

Choosing blue, green, then red costs 4 and is the unique optimum.

Example 2

costs = [[7,2,5]]return = "g"

With one day, choose the least expensive green shirt.

Constraints

  • 1 <= costs.length <= 10^5.
  • costs[i].length == 3.
  • 1 <= costs[i][j] <= 10^6.
  • The minimum-cost valid sequence is unique.

More ElevenLabs interview questions

  • Minimum Magic Stones After MergesOA · Seen Oct 2026
  • Next Number with Disjoint DigitsOA · Seen Oct 2026
  • Longest Spoken PrefixONSITE INTERVIEW · Seen Nov 2026
  • Dubbing Review Status PropagationONSITE INTERVIEW · Seen May 2025

Similar questions at other companies

  • Maximum Game Score with Fixed Forward JumpsStripe · OA
  • 0/1 KnapsackConfluent · OA
  • Minimum Cost to Tile a Strip with Widths 1, 2, and 3Infosys · OA
  • Maximum Escape Game ScoreMicrosoft · OA
  • Maximum Subarray SumStraive · OA
  • Longest Increasing Price SubsequenceOpenAI · OA
  • Maximum Game Board ScoreJP Morgan Chase · OA
  • API Bandwidth AllocationArista Networks · OA
  • Maximum Points by Deleting ElementsIBM · OA
  • House RobberWalmart · OA
See ElevenLabs hiring insights
Saved
class Solution {
    public String lowestCostShirtColors(int[][] costs) {
        // Write your code here.
    }
}
Checking account…