Practice Short Encoding of Words
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Encode words using a reference string s ending in # and one starting index for each word. Reading s from a word's starting index up to the next #, excluding #, must reproduce that word exactly. Different words may share characters in s. Return the shortest possible length of s.
Source: Short Encoding of Words on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
words = ["time", "me", "bell"]
Output
10
# Example 2
Input
words = ["t"]
Output
2
Constraints
1 <= words.length <= 2000
1 <= words[i].length <= 7
words[i] consists of only lowercase letters.
Related LeetCode Problems
Practice more problems similar to Short Encoding of Words.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.