From 704e3b2aae0065880a3e4d2a6ed3b410772eb23a Mon Sep 17 00:00:00 2001 From: ashish01012001 <108181303+ashish01012001@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:06:02 +0530 Subject: [PATCH 1/2] Added word break question --- codes/cpp/word_break.cpp | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 codes/cpp/word_break.cpp diff --git a/codes/cpp/word_break.cpp b/codes/cpp/word_break.cpp new file mode 100644 index 0000000..6cb53ca --- /dev/null +++ b/codes/cpp/word_break.cpp @@ -0,0 +1,50 @@ +#include +#include +#include +#include +using namespace std; + +int dp[301]; +int help(int i,string s ,set&wordDict){ + if(i==s.size()) + return 1; + string temp; + if(dp[i]!=-1) + return dp[i]; + for(int j=i;j& wordDict) { + setst; + memset(dp,-1,sizeof dp); + for(int i=0;i>s; + vectorworddict; + int n; + cin>>n;string word; + for(int i=0;i>word; + worddict.push_back(word); + } + cout< Date: Tue, 10 Oct 2023 15:06:30 +0530 Subject: [PATCH 2/2] Edited README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 953596d..33e7905 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ | Longest Valid Parentheses | [LeetCode](https://leetcode.com/problems/longest-valid-parentheses/) | [YouTube](https://www.youtube.com/watch?v=VdQuwtEd10M) | [Java](./codes/java/LongestValidParentheses.java) | | Rotate Image | [LeetCode](https://leetcode.com/problems/rotate-image/) | [YouTube](https://www.youtube.com/watch?v=Y72QeX0Efxw) | [Java](./codes/java/RotateImage.java) | | Substring with concatenation of all words | [LeetCode](https://leetcode.com/problems/substring-with-concatenation-of-all-words/) | [YouTube](https://www.youtube.com/watch?v=_MGzsJ0F8lE) | [Java](./codes/java/SubstringWithConcatenationOfAllWords.java) | -|Largest rectangular sub-matrix having sum divisible by k| [GFG](https://www.geeksforgeeks.org/largest-rectangular-sub-matrix-sum-divisible-k/) | [YouTube](https://www.youtube.com/watch?v=_MGzsJ0F8lE) | [Python](./codes/python/largest_rectangular_sub_matrix_sum_divisbl_by_k) | +|Largest rectangular sub-matrix having sum divisible by k| [GFG](https://www.geeksforgeeks.org/largest-rectangular-sub-matrix-sum-divisible-k/) | [YouTube](https://www.youtube.com/watch?v=_MGzsJ0F8lE) | [Python](./codes/python/largest_rectangular_sub_matrix_sum_divisbl_by_k) +|Word Break |[LeetCode](https://leetcode.com/problems/word-break/) |[Youtube](https://youtu.be/Sx9NNgInc3A?si=tzljO1p5FRdEaAPf) |[C++](./codes/cpp/word_break.cpp)