From 115007b6e38746d68605420ac35e1e8acf7a32bc Mon Sep 17 00:00:00 2001 From: chayan das <110921638+Chayandas07@users.noreply.github.com> Date: Sun, 6 Oct 2024 23:51:44 +0530 Subject: [PATCH] Create 1813. Sentence Similarity III --- 1813. Sentence Similarity III | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 1813. Sentence Similarity III diff --git a/1813. Sentence Similarity III b/1813. Sentence Similarity III new file mode 100644 index 0000000..e27d36e --- /dev/null +++ b/1813. Sentence Similarity III @@ -0,0 +1,54 @@ +class Solution { +public: + bool areSentencesSimilar(string sentence1, string sentence2) { + if(sentence1.length()>sentence2.length()){ + swap(sentence1,sentence2); + } + // cout<v1,v2; + string temp=""; + for(int i=0;i=0 && v1[j]==v2[k]){ + j--; + k--; + } + if(i==v1.size()){ + return true; + } + if(j==-1){ + return true; + } + // cout<=j+1){ + return true; + } + return false; + } +};