NeetCode #710LC-471Hard1-D Dynamic Programming
← Back to All Problems

#710 · #471 · Encode String with Shortest Length(编码最短长度的字符串)

📌 Problem Statement & Constraints

Given a string s, return its shortest encoded form, where a substring that repeats k times may be written as k[encoded]. If the encoding is not shorter than the original, keep the original. Constraints: 1 <= s.length <= 150, and s consists of lowercase English letters.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!