Hi I am Shashwat Tiwari, software engineer at Samsung Research. I enjoy solving problems using coding and other computer science stuff. This channel is for sharing knowledge on programming, computer science fundamentals, data structures and algorithms, and a lot more with touch of motivational talks. You can get free courses, learn how to code, how to start programming, how to prepare for Interviews and everything in between.
Learn to develop in hindi Learn to code in hindi
Btw Hindi is my language , programming language could be java, python, c++, javascipt, go lang.
Feel free to dm me whenever you want: linktr.ee/shashwat_tiwari_st
I Had a slightly different approach to this question . Instead of storing characters in stack , i maintained the index of last opening bracket whenever i encountered a closing one . and used a reverse function and made the recursive calls Below is my Code with Linear TC class Solution { string recur(string s,int idx,string res){ if(idx>=s.length()){ string final_ans = ""; for(char i : res){ if(i=='(' || i == ')') continue; final_ans += i; } return final_ans; } if(s[idx]=='(') { s1.push(idx+1); } if(s[idx]==')') { res = Rev(res,s1.top(),idx-1); s1.pop(); } return recur(s,idx+1,res+s[idx]); } string Rev(string s1,int s,int e){ while(s<=e){ char a = s1[s]; s1[s] = s1[e]; s1[e] = a; s++; e--; } return s1; } public: stack<int> s1; string reverseParentheses(string s) { string res = ""; return recur(s,0,res); } }; Also Ty Very Much i was having hard time learning recursion but this intiution came from your stack and recursion series.
my approach was quite similar with your first approach ,only difference is that i didnt take any list i just considered a dummy string and manipulated it multiple times,but at last shocked by seeing n^2 complexity thatys why i was waiting for your video.
3:30 - Stack Approach 10:11 - Code for stack 13:27 - Approach 2 ( jo mai sapne me thanos ban kr sare infinity stones lekr bhi khud se nahi soch pata ) 23:45 - Code for Approach 2
After solving questions by myself coming here daily to learn a better approach, but I did exactly the same approach today . Gaining confidence to solve questions Thanks.
@@vivekgosai7913 == is used for address comparison, whereas equals is used for value comparison. String a = "sha"; String b = "sha"; a==b will be false. a equals b will be true.. understood? You can watch String lectures in java dsa playlist, that will be helpful 😄
Hey sir can you tell the approach from which video do I need to start with and how can we utilise your channel in beginners manner + from which video can we expect to solve leetcode problems
@@Aranya_-il5nr if you don't know Java, please watch from lecture 1 of Java dsa sheet, after lecture 15, you can start solving leetcode daily challenge videos in parallel, along with Java dsa lectures. If you already know Java, basics then you can start watching from lecture 11 of Java dsa playlist and watch daily challenge problems in parallel.
Sir the way u explain and dry run each and every concept is very clear to me .I know it's Adv DS but seems to be easy. respect for the effort u r putting. thanks for making this Graph series.. Love u and respect.🫡❤
@@shashwat_tiwari_st Sir to fir apan Trie mein jo possible words list mein available haii unhe trie mein insert krke search kr skte na.. If word found we will mark endOfWord false or remove it from trie.. Is it possible??
@@tejas2636 ha woh mai smjha, Tries se kr skte ho but optimization kaha hai, Jaise word generate kra tmhe let's say "aman", Hashset me constant time me pta lag jaega ki present hai ya nhi Tries me string ki length tak traverse krke pta chalega.. So, Tries optimized toh nhi hua yaha pr...
Sir leetcode problem no 2952 ka solution viedo upload kar dijiye bohot confusion hai half test cases hi pass ho rahe hai please sir ❤ bohot try Kara solve karne ka
No, His speed is just fine. If he will make long videos of each question then no one will get interested as every video will be atleast half hour long. I would recommend you to try each and every step yourself and ask doubt on comment section.