Gamified challenge · Interval DP
s is a ribbon of lowercase letters. Cut it into consecutive pieces so that every piece is a palindrome (reads the same both ways; a single letter always is). Write minCuts(s) (Python min_cuts) that returns the fewest cuts needed.
A ribbon that is already a palindrome needs 0 cuts, and so does the empty ribbon.
Example: "aab" needs 1 cut (aa | b), and "noonabbad" needs 2 (noon | abba | d).
This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.
Sign in with Google