Introduction
It is my job to make the algorithm learning easy. What I like to do is to read a few ideas through Leetcode 139 Word break, and then write C# practice based on the idea.
First idea
I like to review this idea using breadth first search. The idea is easy to understand and also easy to write. The implementation is to use a queue and also a hash set. The hash set is used to keep track of the visited nodes to avoid repeating the same work.
No comments:
Post a Comment