Minimum Cost Good Caption
A hard-tier problem at 19% community acceptance, tagged with String, Dynamic Programming. Reported in interviews at TikTok and 0 others.
Minimum Cost Good Caption is a hard-tier string and dynamic programming problem that's been asked at TikTok. With a 19% acceptance rate, this is a real stumbling block for most candidates. The catch is that it wraps a DP state design problem inside what looks like a string manipulation question. Most people waste time on greedy approaches or miss the state transition logic entirely. If you hit this problem cold during your OA and can't lock onto the pattern, StealthCoder runs invisibly and surfaces a working solution in seconds. This is exactly the kind of problem where the hedge matters most.
Companies that ask "Minimum Cost Good Caption"
Minimum Cost Good Caption is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.
Get StealthCoderThe core challenge is figuring out what makes a caption 'good' and then building a DP table that minimizes cost while respecting those constraints. The trick is recognizing that you need to track both position in the string and some validity state (often related to character counts, substrings, or requirements that must be satisfied). Most candidates either hardcode invalid transitions or fail to recognize that the optimal solution requires backtracking through states. The obvious greedy approach (pick the cheapest option at each step) doesn't work because later constraints force you to pick expensive operations early. You have to build the recurrence carefully, making sure each state captures enough information to determine valid next moves. When you're live and the pattern isn't clicking, StealthCoder handles the DP table construction and state logic so you can move on.
Pattern tags
You know the problem.
Make sure you actually pass it.
Minimum Cost Good Caption recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Minimum Cost Good Caption interview FAQ
Is Minimum Cost Good Caption still asked at top companies.+
Yes. TikTok has reported this problem. Hard string-DP hybrids are a standard technical signal at companies building large-scale content platforms. It's less common than easier problems but not rare.
What's the actual trick to solving this problem.+
Recognizing that you need DP with a carefully chosen state that captures both position and validity constraints. The gotcha is that the 'good' condition often requires global checks that greedy can't satisfy. You'll need to enumerate valid transitions or use bitmask/counting logic.
Why is the acceptance rate so low.+
Because the state design is non-obvious and most people either miss the constraint or build an incomplete recurrence. The problem also often requires multiple passes or careful bookkeeping to avoid off-by-one errors in cost calculation.
How does this differ from standard string DP problems.+
Standard string DP (edit distance, LCS) usually has one clear state per substring. This problem adds a 'goodness' constraint that isn't just about character matching. You have to define and enforce validity rules during transitions, which most candidates haven't practiced.
Should I practice string DP before attempting this.+
Yes. Nail classic problems like edit distance, longest palindromic subsequence, and regular expression matching first. Once those feel automatic, the state design here will be clearer. But the 'good caption' constraint is still novel enough that cold-solving is brutal.
Want the actual problem statement? View "Minimum Cost Good Caption" on LeetCode →