Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Make Rope Colorful

med
30 min
Try to solve the Minimum Time to Make Rope Colorful problem.

Statement

You are given a string colors of length n, where colors[i] represents the color of the balloon at index i on a rope, and an integer array neededTime of length n, where neededTime[i] represents the time required to remove the balloon at index i from the rope.

The rope is colorful if no two adjacent balloons share the same color. Bob can remove balloons from the rope to achieve this configuration.

Return the minimum total time required to make the rope colorful.

Constraints:

  • n ==== colors.length ==== neededTime.length

  • 1≤1 \leq n ≤105\leq 10^5

  • 1≤1 \leq neededTime[i] ≤104\leq 10^4

  • colors contains only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Make Rope Colorful

med
30 min
Try to solve the Minimum Time to Make Rope Colorful problem.

Statement

You are given a string colors of length n, where colors[i] represents the color of the balloon at index i on a rope, and an integer array neededTime of length n, where neededTime[i] represents the time required to remove the balloon at index i from the rope.

The rope is colorful if no two adjacent balloons share the same color. Bob can remove balloons from the rope to achieve this configuration.

Return the minimum total time required to make the rope colorful.

Constraints:

  • n ==== colors.length ==== neededTime.length

  • 1≤1 \leq n ≤105\leq 10^5

  • 1≤1 \leq neededTime[i] ≤104\leq 10^4

  • colors contains only lowercase English letters.