Word Break Problem using Backtracking

Given a valid sentence without any spaces between the words and a dictionary of valid English words, find all possible ways to break the sentence in individual dictionary words.



i love ice cream and man go
i love ice cream and mango
i love icecream and man go
i love icecream and mango

This article is contributed by Nimit Jain. If you like liesbeek and would like to contribute, you can also write an article and mail your article to online.nimit@gmail.com. See your article appearing on the liesbeek main page and help other Geeks.

Leave a Reply

Your email address will not be published. Required fields are marked *