You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are given a 0-indexed string s and a dictionary of words dictionary.
3
+
You have to break s into one or more non-overlapping substrings such that each substring is present in dictionary.
4
+
There may be some extra characters in s which are not present in any of the substrings.
5
+
6
+
Return the minimum number of extra characters left over if you break up s optimally.
7
+
8
+
Ex. Input: s = "leetscode", dictionary = ["leet","code","leetcode"]
9
+
Output: 1
10
+
Explanation: We can break s in two substrings: "leet" from index 0 to 3 and "code" from index 5 to 8. There is only 1 unused character (at index 4), so we return 1.
0 commit comments