You are given a string s and an array of strings dictionary. You can partition s into one or more non overlapping substrings such that each chosen substring appears in dictionary.
There may be some leftover characters in s that do not belong to any chosen substring.
Return the minimum number of extra characters remaining in s after breaking it up optimally.
Constraints:
s.length
dictionary.length
dictionary[i].length
dictionary[i] and s consist of only lowercase English letters
dictionary contains distinct words
You are given a string s and an array of strings dictionary. You can partition s into one or more non overlapping substrings such that each chosen substring appears in dictionary.
There may be some leftover characters in s that do not belong to any chosen substring.
Return the minimum number of extra characters remaining in s after breaking it up optimally.
Constraints:
s.length
dictionary.length
dictionary[i].length
dictionary[i] and s consist of only lowercase English letters
dictionary contains distinct words