Minimum Word Break

Given a string s, break s such that every partition can be found in the dictionary. Return the minimum number of breaks needed.

Example:

Given a dictionary ["Cat", "Mat", "Ca", "tM", "at", "C", "Dog", "og", "Do"] and string "CatMat", the output should be 1 since we can partition the string as ["Cat", "Mat"].

Contributed by Berkan Teber