Help in a Leetcode String Problem

On just looking at the problem I feel it uses DP similar to digit-dp. You might want to read some digit dp editorial like ENCODING

2 Likes