From 71dabb26827433cc3ce3aaf213bc700fa5fe50c8 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:50:21 +0530 Subject: [PATCH 01/24] Create solution.cpp --- Day-17/Q1:Determine if two strings are close/solution.cpp | 1 + 1 file changed, 1 insertion(+) create mode 100644 Day-17/Q1:Determine if two strings are close/solution.cpp diff --git a/Day-17/Q1:Determine if two strings are close/solution.cpp b/Day-17/Q1:Determine if two strings are close/solution.cpp new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/Day-17/Q1:Determine if two strings are close/solution.cpp @@ -0,0 +1 @@ + From 0a7e51f9a31fdb51e3f5f8c7c7a7a51d4d12760e Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:52:32 +0530 Subject: [PATCH 02/24] Update solution.cpp --- .../solution.cpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Day-17/Q1:Determine if two strings are close/solution.cpp b/Day-17/Q1:Determine if two strings are close/solution.cpp index 8b137891..a86c6567 100644 --- a/Day-17/Q1:Determine if two strings are close/solution.cpp +++ b/Day-17/Q1:Determine if two strings are close/solution.cpp @@ -1 +1,21 @@ - +class Solution { +public: + bool closeStrings(string word1, string word2) { + int cnt1[26]{}; + int cnt2[26]{}; + for (char& c : word1) { + ++cnt1[c - 'a']; + } + for (char& c : word2) { + ++cnt2[c - 'a']; + } + for (int i = 0; i < 26; ++i) { + if ((cnt1[i] == 0) != (cnt2[i] == 0)) { + return false; + } + } + sort(cnt1, cnt1 + 26); + sort(cnt2, cnt2 + 26); + return equal(cnt1, cnt1 + 26, cnt2); + } +}; From 30410dba91a1d100dc44f0ba9f24f5b9ede96249 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:52:57 +0530 Subject: [PATCH 03/24] Update solution.cpp --- Day-17/Q1:Determine if two strings are close/solution.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Day-17/Q1:Determine if two strings are close/solution.cpp b/Day-17/Q1:Determine if two strings are close/solution.cpp index a86c6567..7f8e3216 100644 --- a/Day-17/Q1:Determine if two strings are close/solution.cpp +++ b/Day-17/Q1:Determine if two strings are close/solution.cpp @@ -1,5 +1,4 @@ -class Solution { -public: + bool closeStrings(string word1, string word2) { int cnt1[26]{}; int cnt2[26]{}; @@ -18,4 +17,3 @@ class Solution { sort(cnt2, cnt2 + 26); return equal(cnt1, cnt1 + 26, cnt2); } -}; From 8655bb67bb20291f762c417ac05e79d1c5d3706b Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:54:24 +0530 Subject: [PATCH 04/24] Update solution.cpp --- .../solution.cpp | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/Day-17/Q1:Determine if two strings are close/solution.cpp b/Day-17/Q1:Determine if two strings are close/solution.cpp index 7f8e3216..a07a1883 100644 --- a/Day-17/Q1:Determine if two strings are close/solution.cpp +++ b/Day-17/Q1:Determine if two strings are close/solution.cpp @@ -1,19 +1,18 @@ - - bool closeStrings(string word1, string word2) { - int cnt1[26]{}; - int cnt2[26]{}; - for (char& c : word1) { - ++cnt1[c - 'a']; - } - for (char& c : word2) { - ++cnt2[c - 'a']; - } - for (int i = 0; i < 26; ++i) { - if ((cnt1[i] == 0) != (cnt2[i] == 0)) { - return false; - } +bool closeStrings(string word1, string word2) { + int cnt1[26]{}; + int cnt2[26]{}; + for (char& c : word1) { + ++cnt1[c - 'a']; + } + for (char& c : word2) { + ++cnt2[c - 'a']; + } + for (int i = 0; i < 26; ++i) { + if ((cnt1[i] == 0) != (cnt2[i] == 0)) { + return false; } - sort(cnt1, cnt1 + 26); - sort(cnt2, cnt2 + 26); - return equal(cnt1, cnt1 + 26, cnt2); } + sort(cnt1, cnt1 + 26); + sort(cnt2, cnt2 + 26); + return equal(cnt1, cnt1 + 26, cnt2); +} From 9f60c1376c851358cb8a6e49ef2707bc3de48b4d Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:55:51 +0530 Subject: [PATCH 05/24] Create solution.cpp --- Day-15/q3-Longest Increasing Subsequence/solution.cpp | 1 + 1 file changed, 1 insertion(+) create mode 100644 Day-15/q3-Longest Increasing Subsequence/solution.cpp diff --git a/Day-15/q3-Longest Increasing Subsequence/solution.cpp b/Day-15/q3-Longest Increasing Subsequence/solution.cpp new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/Day-15/q3-Longest Increasing Subsequence/solution.cpp @@ -0,0 +1 @@ + From 84ce528d2543f74610e9b58468d3f000a7dd61d7 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:58:02 +0530 Subject: [PATCH 06/24] Update solution.cpp --- .../solution.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Day-15/q3-Longest Increasing Subsequence/solution.cpp b/Day-15/q3-Longest Increasing Subsequence/solution.cpp index 8b137891..a4cb21cb 100644 --- a/Day-15/q3-Longest Increasing Subsequence/solution.cpp +++ b/Day-15/q3-Longest Increasing Subsequence/solution.cpp @@ -1 +1,17 @@ - +class Solution { +public: + int lengthOfLIS(vector& nums) { + int n=nums.size(); + int lis[n]; + lis[0]=1; + for(int i=1;inums[j] && lis[i] Date: Thu, 25 Jan 2024 23:58:23 +0530 Subject: [PATCH 07/24] Update solution.cpp --- Day-15/q3-Longest Increasing Subsequence/solution.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Day-15/q3-Longest Increasing Subsequence/solution.cpp b/Day-15/q3-Longest Increasing Subsequence/solution.cpp index a4cb21cb..e869e255 100644 --- a/Day-15/q3-Longest Increasing Subsequence/solution.cpp +++ b/Day-15/q3-Longest Increasing Subsequence/solution.cpp @@ -1,5 +1,4 @@ -class Solution { -public: + int lengthOfLIS(vector& nums) { int n=nums.size(); int lis[n]; @@ -14,4 +13,4 @@ class Solution { } return *max_element(lis,lis+n); } -}; + From 59c440bc2d8b515f304daeb38a1eee0e28453a49 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:58:36 +0530 Subject: [PATCH 08/24] Update solution.cpp --- Day-15/q3-Longest Increasing Subsequence/solution.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Day-15/q3-Longest Increasing Subsequence/solution.cpp b/Day-15/q3-Longest Increasing Subsequence/solution.cpp index e869e255..8ac75099 100644 --- a/Day-15/q3-Longest Increasing Subsequence/solution.cpp +++ b/Day-15/q3-Longest Increasing Subsequence/solution.cpp @@ -1,4 +1,3 @@ - int lengthOfLIS(vector& nums) { int n=nums.size(); int lis[n]; From d3537364b1f449d27f4d94eb8e6d9c773a6eb5de Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:59:20 +0530 Subject: [PATCH 09/24] Update solution.cpp --- .../solution.cpp | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Day-15/q3-Longest Increasing Subsequence/solution.cpp b/Day-15/q3-Longest Increasing Subsequence/solution.cpp index 8ac75099..cd3a6298 100644 --- a/Day-15/q3-Longest Increasing Subsequence/solution.cpp +++ b/Day-15/q3-Longest Increasing Subsequence/solution.cpp @@ -1,15 +1,15 @@ - int lengthOfLIS(vector& nums) { - int n=nums.size(); - int lis[n]; - lis[0]=1; - for(int i=1;inums[j] && lis[i]& nums) { + int n=nums.size(); + int lis[n]; + lis[0]=1; + for(int i=1;inums[j] && lis[i] Date: Fri, 26 Jan 2024 00:05:16 +0530 Subject: [PATCH 10/24] Create Shubh_Krishna_solution.cpp --- .../Shubh_Krishna_solution.cpp | 1 + 1 file changed, 1 insertion(+) create mode 100644 Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp diff --git a/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp b/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp @@ -0,0 +1 @@ + From f12c5c4791fef894b557cbd199486e0bad3ef3e1 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:05:31 +0530 Subject: [PATCH 11/24] Update Shubh_Krishna_solution.cpp --- .../Shubh_Krishna_solution.cpp | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp b/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp index 8b137891..c35cf817 100644 --- a/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp +++ b/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp @@ -1 +1,30 @@ +class Solution { +public: + int search(vector& nums, int t) { + + int ans=0,l=0,r=nums.size()-1,mid=0; + int n=nums.size()-1; + + + while(l<=r){ + mid=(l+r)/2; + if(t==nums[mid]){return mid;} + if(nums[mid]>nums[n]){ + if(t>nums[mid]||tnums[n]){ + r=mid-1; + }else{ + l=mid+1; + } + } + } + + return -1; + } +}; From f775470af99e26ebaae37bc8d9b1db64776f6859 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:05:55 +0530 Subject: [PATCH 12/24] Update Shubh_Krishna_solution.cpp --- .../Shubh_Krishna_solution.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp b/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp index c35cf817..e1fb7ef1 100644 --- a/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp +++ b/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp @@ -1,6 +1,5 @@ -class Solution { -public: + int search(vector& nums, int t) { int ans=0,l=0,r=nums.size()-1,mid=0; From e83da9433613a02edfe36f05ff54577d68c61d03 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:06:11 +0530 Subject: [PATCH 13/24] Update Shubh_Krishna_solution.cpp --- .../Shubh_Krishna_solution.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp b/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp index e1fb7ef1..75576c5d 100644 --- a/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp +++ b/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp @@ -26,4 +26,3 @@ return -1; } -}; From 9c904fae53505dee579060bccf90c1c1e3419a8c Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:07:27 +0530 Subject: [PATCH 14/24] Update Shubh_Krishna_solution.cpp --- .../Shubh_Krishna_solution.cpp | 47 +++++++++---------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp b/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp index 75576c5d..8a9f8847 100644 --- a/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp +++ b/Day-18/q2: Search in Rotated Sorted Array/Shubh_Krishna_solution.cpp @@ -1,28 +1,25 @@ - - - int search(vector& nums, int t) { - - int ans=0,l=0,r=nums.size()-1,mid=0; - int n=nums.size()-1; +int search(vector& nums, int t) { + int ans=0,l=0,r=nums.size()-1,mid=0; + int n=nums.size()-1; - while(l<=r){ - mid=(l+r)/2; - if(t==nums[mid]){return mid;} - if(nums[mid]>nums[n]){ - if(t>nums[mid]||tnums[n]){ - r=mid-1; - }else{ - l=mid+1; - } - } - } - - return -1; + while(l<=r){ + mid=(l+r)/2; + if(t==nums[mid]){return mid;} + if(nums[mid]>nums[n]){ + if(t>nums[mid]||tnums[n]){ + r=mid-1; + }else{ + l=mid+1; + } + } } + + return -1; +} From 61f3fc58274eb5908f1246eca109bd7af84bd27f Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:10:04 +0530 Subject: [PATCH 15/24] Rename solution.cpp to Shubh_Krishna_solution.cpp --- .../{solution.cpp => Shubh_Krishna_solution.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Day-15/q3-Longest Increasing Subsequence/{solution.cpp => Shubh_Krishna_solution.cpp} (100%) diff --git a/Day-15/q3-Longest Increasing Subsequence/solution.cpp b/Day-15/q3-Longest Increasing Subsequence/Shubh_Krishna_solution.cpp similarity index 100% rename from Day-15/q3-Longest Increasing Subsequence/solution.cpp rename to Day-15/q3-Longest Increasing Subsequence/Shubh_Krishna_solution.cpp From d46fc4eb833ea412f428d1acb293eff0971fbbd0 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:10:45 +0530 Subject: [PATCH 16/24] Rename solution.cpp to Subh_Krishna_solution.cpp --- .../{solution.cpp => Subh_Krishna_solution.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Day-17/Q1:Determine if two strings are close/{solution.cpp => Subh_Krishna_solution.cpp} (100%) diff --git a/Day-17/Q1:Determine if two strings are close/solution.cpp b/Day-17/Q1:Determine if two strings are close/Subh_Krishna_solution.cpp similarity index 100% rename from Day-17/Q1:Determine if two strings are close/solution.cpp rename to Day-17/Q1:Determine if two strings are close/Subh_Krishna_solution.cpp From 5cafb9611990d88634354f41473b61356919efeb Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:15:40 +0530 Subject: [PATCH 17/24] Create Shubh_Krishna_solution.cpp --- Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp | 1 + 1 file changed, 1 insertion(+) create mode 100644 Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp diff --git a/Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp b/Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp @@ -0,0 +1 @@ + From 141d6ecf96dd8cb25e7148370b0dc764b0358b83 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:16:07 +0530 Subject: [PATCH 18/24] Update Shubh_Krishna_solution.cpp --- .../Shubh_Krishna_solution.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp b/Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp index 8b137891..9d0cd9bd 100644 --- a/Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp +++ b/Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp @@ -1 +1,28 @@ +/** + * Definition for a binary tree node. + * struct TreeNode { + * int val; + * TreeNode *left; + * TreeNode *right; + * TreeNode() : val(0), left(nullptr), right(nullptr) {} + * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} + * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} + * }; + */ +class Solution { +public: + +int sumOfLeftLeaves(struct TreeNode* root){ + if (!root) + return 0; + int sum = 0; + if (root->left && !root->left->left && !root->left->right) + sum += root->left->val; + + sum+=sumOfLeftLeaves(root->left); + sum+=sumOfLeftLeaves(root->right); + + return sum; +} +}; From 0ffcf6c32ac33cdde94467b4b1477f55fa06f8e2 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:16:36 +0530 Subject: [PATCH 19/24] Update Shubh_Krishna_solution.cpp --- .../Shubh_Krishna_solution.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp b/Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp index 9d0cd9bd..77ebd089 100644 --- a/Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp +++ b/Day-22/q2: Sum of Left Leaves/Shubh_Krishna_solution.cpp @@ -1,17 +1,3 @@ -/** - * Definition for a binary tree node. - * struct TreeNode { - * int val; - * TreeNode *left; - * TreeNode *right; - * TreeNode() : val(0), left(nullptr), right(nullptr) {} - * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} - * }; - */ -class Solution { -public: - int sumOfLeftLeaves(struct TreeNode* root){ if (!root) return 0; @@ -25,4 +11,3 @@ int sumOfLeftLeaves(struct TreeNode* root){ return sum; } -}; From 359728e8e48b1fb7dc727aa62f24b0d233916da2 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:25:25 +0530 Subject: [PATCH 20/24] Create Shubh_Krishna_solution.cpp --- Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp | 1 + 1 file changed, 1 insertion(+) create mode 100644 Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp diff --git a/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp b/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp @@ -0,0 +1 @@ + From c62b8b0e2a8cb66232619c736016ce72d5d6fb84 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:25:47 +0530 Subject: [PATCH 21/24] Update Shubh_Krishna_solution.cpp --- .../Shubh_Krishna_solution.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp b/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp index 8b137891..3cb6acf2 100644 --- a/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp +++ b/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp @@ -1 +1,17 @@ - +class Solution { +public: + int scoreOfParentheses(string S) { + stack stack; + int cur = 0; + for (char i : S) + if (i == '(') { + stack.push(cur); + cur = 0; + } + else { + cur += stack.top() + max(cur, 1); + stack.pop(); + } + return cur; + } +}; From c39124f289d21f9e28c1bbbdd0d029c32b096ea6 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:26:06 +0530 Subject: [PATCH 22/24] Update Shubh_Krishna_solution.cpp --- Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp b/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp index 3cb6acf2..c0626250 100644 --- a/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp +++ b/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp @@ -1,5 +1,4 @@ -class Solution { -public: + int scoreOfParentheses(string S) { stack stack; int cur = 0; From ad9b0ab0e5438b84d7c399bf6dc0ac273362681a Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:26:19 +0530 Subject: [PATCH 23/24] Update Shubh_Krishna_solution.cpp --- Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp b/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp index c0626250..38341a88 100644 --- a/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp +++ b/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp @@ -13,4 +13,3 @@ } return cur; } -}; From 6471ccf4a7c311028bb34a7938b8c5a9cfe1d2c4 Mon Sep 17 00:00:00 2001 From: Shubh Krishna <135266175+Shubh-Krishna@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:26:49 +0530 Subject: [PATCH 24/24] Update Shubh_Krishna_solution.cpp --- Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp b/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp index 38341a88..1c218d5a 100644 --- a/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp +++ b/Day-26/q2: Score of Parentheses/Shubh_Krishna_solution.cpp @@ -1,5 +1,4 @@ - - int scoreOfParentheses(string S) { +int scoreOfParentheses(string S) { stack stack; int cur = 0; for (char i : S) @@ -12,4 +11,4 @@ stack.pop(); } return cur; - } +}