We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
leetcode/src/wordBreak/wordBreak.II.cpp
Line 143 in 0858fdb
Your DP solution is not really efficient.
I can provide two test cases:
unordered_set<string> dict = {"a","aa","ab"}; string s = "babaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
unordered_set<string> dict = {"a","aa","ba"}; string s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabab";
The text was updated successfully, but these errors were encountered:
You are right, the DP is not efficient. Actually, the recursive solution is more efficient than that DP solution.
Sorry, something went wrong.
yes,i think the dp is not efficient , it will lead Memory Limit Exceeded, could you have any solution to solve it .
@yqtaowhu Sure, just visit the leetcode forum. 😉
No branches or pull requests
leetcode/src/wordBreak/wordBreak.II.cpp
Line 143 in 0858fdb
Your DP solution is not really efficient.
I can provide two test cases:
The text was updated successfully, but these errors were encountered: