Minimum String Length After Removing Substrings | 3 Approaches | Leetcode 2696 | codestorywithMIK
Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 55th Video of our Playlist "Leetcode Easy : Popular Interview Problems" by codestorywithMIK In this video we will try to solve an easy String based Problem : Minimum String Length After Removing Substrings | 3 Simple Approaches | Leetcode 2696 | codestorywithMIK I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY. We will do live coding after explanation and see if we are able to pass all the test cases. Also, please note that my Github solution link below contains both C++ as well as JAVA code. Problem Name : Minimum String Length After Removing Substrings | 3 Simple Approaches | Leetcode 2696 | codestorywithMIK Company Tags : will update soon My solutions on Github(C++ & JAVA) - https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/strings/Easy%20Tagged/Minimum%20String%20Length%20After%20Removing%20Substrings.cpp Leetcode Link : https://leetcode.com/problems/minimum-string-length-after-removing-substrings My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w My Recursion Concepts Playlist : https://www.youtube.com/watch?v=pfb1Zduesi8&list=PLpIkg8OmuX-IBcXsfITH5ql0Lqci1MYPM My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo Instagram : https://www.instagram.com/codestorywithmik/ Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/ Twitter : https://twitter.com/CSwithMIK Subscribe to my channel : https://www.youtube.com/@codestorywithMIK ╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗ ║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣ ╠╗║╚╝║║╠╗║╚╣║║║║║═╣ ╚═╩══╩═╩═╩═╩╝╚╩═╩═╝ Summary : Approach-1: Brute Force Time Complexity (T.C): O(n2) Space Complexity (S.C): O(1) Description: This approach repeatedly searches for "AB" or "CD" substrings and removes them until none are left in the string. The find and erase operations are performed in each iteration, leading to quadratic time complexity due to repeated string modifications. Approach-2: Using Stack Time Complexity (T.C): O(n) Space Complexity (S.C): O(n) Description: This approach uses a stack to track characters. As each character is processed, it checks for the patterns "AB" or "CD". If found, it removes the matching pairs from the stack; otherwise, it adds the character to the stack. The final stack size gives the minimum length of the modified string. Approach-3: Two Pointers Time Complexity (T.C): O(n) Space Complexity (S.C): O(1) Description: This approach uses two pointers, i (write) and j (read). It iterates through the string once, checking for "AB" or "CD" patterns. If a match is found, it rewinds the i pointer to remove the pattern, otherwise, it moves forward. This method achieves optimal space usage since it modifies the string in place. ✨ Timelines✨ 00:00 - Introduction #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #coding #programming #100daysofcode #developers #techjobs #datastructures #algorithms #webdevelopment #softwareengineering #computerscience #pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview #interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #hindi #india #hindicoding #hindiprogramming #hindiexplanation #hindidevelopers #hinditech #hindilearning #helpajobseeker #jobseekers #jobsearchtips #careergoals #careerdevelopment #jobhunt #jobinterview #github #designthinking #learningtogether #growthmindset #digitalcontent #techcontent #socialmediagrowth #contentcreation #instagramreels #videomarketing #codestorywithmik #codestorywithmick #codestorywithmikc #codestorywitmik #codestorywthmik #codstorywithmik #codestorywihmik #codestorywithmiik #codeistorywithmik #codestorywithmk #codestorywitmick #codestorymik #codestorwithmik
Download
0 formatsNo download links available.