From 13a6ee2305db66e88327355df7e4d7a18b85766b Mon Sep 17 00:00:00 2001 From: chayan das Date: Mon, 15 Sep 2025 23:59:11 +0530 Subject: [PATCH] Create 12 --- 12 | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 12 diff --git a/12 b/12 new file mode 100644 index 0000000..fc8a5b6 --- /dev/null +++ b/12 @@ -0,0 +1,36 @@ +class Solution { + public: + bool stringStack(string &pat, string &tar) { + // code here + int n= pat.size(); + int m= tar.size(); + + int i=n-1; + int j=m-1; + int count =0; + while (i>=0 && j>=0){ + + if (pat[i]==tar[j]){ + if (count%2==0) { + j--; + count=0; + i--; + } + else{ + i--; + count++; + + } + + } + + else{ + i--; + count++; + } + } + if (j<0) return true; + else return false; + } +}; +