Different Ways to Add Parentheses | Simple Story To Code | Leetcode 241 | codestorywithMIK

  Рет қаралды 11,295

codestorywithMIK

codestorywithMIK

Күн бұрын

Пікірлер: 72
@psychologyfact2320
@psychologyfact2320 2 ай бұрын
Sir contest ke solution bhi upload krna start krdo ager possible ho yo boht help hogi🙏🙏🙏
@tanyasingh4023
@tanyasingh4023 2 ай бұрын
Always waiting for your explanation videos
@robot3.077
@robot3.077 2 ай бұрын
itne achhe tarike se koi kaise samjha sakta hai 💌💌
@BombSquadHindiTipsTricks
@BombSquadHindiTipsTricks 2 ай бұрын
savior of stucked questions
@akshaychavan5511
@akshaychavan5511 2 ай бұрын
After seeing this problem I definitely knew that it would be a recursive solution. However, I could not visualize the recursion for this problem which made it super tough for me. But thanks to MIK, now it's become super easy to understand.
@aizad786iqbal
@aizad786iqbal 2 ай бұрын
nice, as per your suggestions earlier, we didn't need the solve functions, and I tried it worked with the given func itself only
@priya_k98
@priya_k98 2 ай бұрын
Very well explained..!
@aws_handles
@aws_handles 2 ай бұрын
Crystal clear explanation man.
@AryanVats603
@AryanVats603 2 ай бұрын
Best explanation sir
@priyobrotokarmakar6564
@priyobrotokarmakar6564 2 ай бұрын
Hello MIK first of all I want to thank you for your amazing teaching skill, the way you taught its really amazing.❤❤❤❤❤❤❤❤ and could you please tell what software you are using to teach us , it will really help me to take notes ❤❤
@AshutoshAnand-o5l
@AshutoshAnand-o5l 2 ай бұрын
Great explaination mik!!!
@Playvish
@Playvish 2 ай бұрын
Nice explaination
@UmmeKNeha
@UmmeKNeha 2 ай бұрын
I always wait for your explanation. pls try to release the video early.
@abhinay.k
@abhinay.k 2 ай бұрын
thank you
@focusman8801
@focusman8801 2 ай бұрын
Solved using i,j in solve Thank you bhaiya class Solution { List solve(String s,int start,int end) { List res = new ArrayList(); for(int i = start;i< end;i++) { char ch = s.charAt(i); if(ch == '-' || ch =='+' || ch =='*'){ List left = solve(s,start,i); List right = solve(s,i+1,end); for(int l : left) { for(int r : right) { if(ch == '+') { res.add(l + r); } else if(ch == '-') { res.add(l - r); } else{ res.add(l * r); } } } } } if(res.size() == 0) { res.add(Integer.valueOf(s.substring(start,end))); } return res; } public List diffWaysToCompute(String expression) { return solve(expression,0, expression.length()); } }
@gauravbanerjee2898
@gauravbanerjee2898 2 ай бұрын
Thanks a lot bhaiya ❤❤
@piyushgupta5044
@piyushgupta5044 2 ай бұрын
Bhot hi bhdiya bhai
@thekindspill
@thekindspill 2 ай бұрын
Guruji 👌🏻
@ago7506
@ago7506 2 ай бұрын
daku for reason!!!!
@Its_Shubham_Negi
@Its_Shubham_Negi 2 ай бұрын
GOAT !!
@anubhavsharma398
@anubhavsharma398 2 ай бұрын
bhaiya which mic you use for recording? Your voice is so clear.
@footballcreativeeverywhere260
@footballcreativeeverywhere260 2 ай бұрын
love you bhai
@KavyaGupta-cc5vp
@KavyaGupta-cc5vp 2 ай бұрын
class Solution { public List diffWaysToCompute(String exp) { return solve(0,exp.length()-1,exp); } public List solve(int stIdx,int endIdx,String exp){ List list=new ArrayList(); for(int i=stIdx;i
@dayashankarlakhotia4943
@dayashankarlakhotia4943 2 ай бұрын
class Solution { public: mapdp; vectordiffWaysToCompute(string exp){ vectorans; if(dp.find(exp)!=dp.end()){ return dp[exp]; } for(int i=0;i
@SujalMahalaha
@SujalMahalaha 2 ай бұрын
inside first for loop in every time two inner for loop is running so time complexity will be o(n)*(2^n)*(n^2), is it right ?
@sujayvikramgs8588
@sujayvikramgs8588 2 ай бұрын
when i was trying to come up with an idea the ideas i had was of using a stack of sorts and I realised ki that wont be feasible the other was about maybe storing it as expression trees and all, again was too complex lol idk fi thats right even
@BatttttMan
@BatttttMan 2 ай бұрын
same, i too was thinking of stack, sort.... 😕
@vBlxzeYT
@vBlxzeYT 2 ай бұрын
Bhaiya I dont understand how result.push_back(x + y) is pushing an integer in the array as we didnt convert it to int cuz last case will only work if the whole string doesnt contain any operator plz help
@BatttttMan
@BatttttMan 2 ай бұрын
bro don't be sad, I will make it crystal clear for you 🙂 Basically, for any expression, the base case will be an expression without any operator , cuz we keep Splitting the expression whenever we are seeing operator so obv. at the end, it will be an expression without any operator. Since There will be No operator at the base, WE WILL NOT GO INTO THE LOOP and Return The Expression (no operand will be there) in the form INT (using stoi) to the Result Vector and It will be Returned to 'Left-Result' or 'Right - Result' Vector, Hence We Will Be Getting Vector of INT.
@vBlxzeYT
@vBlxzeYT 2 ай бұрын
@@BatttttMan thx a lot bro ❤️
@codestorywithMIK
@codestorywithMIK 2 ай бұрын
Thank you 😇❤️
@anshror2583
@anshror2583 2 ай бұрын
Bhai biweekly 139 k contest k 3 and 4 p bna do
@rasish6749
@rasish6749 2 ай бұрын
please do rotten oranges
@jeehub041
@jeehub041 2 ай бұрын
Sir vo har pairs ko check kar rahe uska bhi toh Time complexity hoga na and koi base case bhi nahi ha kyu?
@nileshsinha7869
@nileshsinha7869 2 ай бұрын
I have one question. How the +, - and * is happening with string and getting added in integer vector
@codestorywithMIK
@codestorywithMIK 2 ай бұрын
Notice that in the end when you only have digits (no operator), you will not enter for loop and in the end you will return the integer (stoi)
@nileshsinha7869
@nileshsinha7869 2 ай бұрын
But let’s suppose in line 15 the x and y will be character right ? And they are getting stored in integer vector
@rohitaggarwal8776
@rohitaggarwal8776 2 ай бұрын
Yeh question hard mai aayega not medium
@rev_krakken70
@rev_krakken70 2 ай бұрын
Was using dp for this.. is it even necessary?
@prathmeshkakde3731
@prathmeshkakde3731 2 ай бұрын
as always nice explanation mik bhaiya
@shobhitsingh8695
@shobhitsingh8695 2 ай бұрын
I created separate array for numbers and operators Very similar to Unique BST 2 class Solution { public: vector numbers; vector op; map mp; vector solve(int l, int r){ if(l == r) { return {numbers[l]}; } if(mp.find({l , r}) != mp.end()){ return mp[{l , r}]; } vector res; for(int i=l;i
@harshupadhyay2422
@harshupadhyay2422 2 ай бұрын
can this be done using mcm?
@RohitKumar-dz8dh
@RohitKumar-dz8dh 2 ай бұрын
Pattern to ussi k jesa lag raha
@RishabhChatterjee-fg2gz
@RishabhChatterjee-fg2gz 2 ай бұрын
Pehele question mein all possible ways keyword dekh Kar mere dimag mein backtracking aaya tha, fir koi approach nehi aaya dimag mein, to topics tag dekha woha dp tha par mujhe dp nehi aata, isiliye solve nehi hua, and options nehi samajh ayya question mein to recursion se kyese hoga ye bhi nehi hua. So solved after watching explanation and approach. How to find options from a recursion based question? Pls say bhaiya
@omkarawasthi402
@omkarawasthi402 2 ай бұрын
Hello bhaiya, jo left and right ka recursion call kar rhe hai usme 'string' se 'int' me kaise le rha hai.
@prathmeshkakde3731
@prathmeshkakde3731 2 ай бұрын
wo call jab tak chalega ki for loop se koi element add nahi hua aur jo last me check karega reslut.isEmpty() tab wo string to int convert kar lega
@anammofazzaldurjoy7970
@anammofazzaldurjoy7970 2 ай бұрын
need dp approach as well bro
@yashnatholia2332
@yashnatholia2332 2 ай бұрын
class Solution { public: unordered_mapmp; vector diffWaysToCompute(string expression) { vectorans; int n = expression.size(); for(int i=0;i
@cosmicthor7330
@cosmicthor7330 2 ай бұрын
Bhaeeya sab soch ney key baad code nhi likh pata any tips plz 😢
@Coder_Buzz07
@Coder_Buzz07 2 ай бұрын
Practice
@madhurgupta9575
@madhurgupta9575 2 ай бұрын
Bhaiya, Chummi lelo, Kya video banayi h. 10 video dekh li kasam se, but this explanation was best....
@udaysingh2929
@udaysingh2929 2 ай бұрын
😅😅
@sidhantmalik3288
@sidhantmalik3288 2 ай бұрын
bhaiya ko toh m bhi dungaa bhaiya if possible plz dbms p video bnadoo meri job lg jyegi
@varunpalsingh3822
@varunpalsingh3822 2 ай бұрын
😂
@aws_handles
@aws_handles 2 ай бұрын
😂
@Himanshhhhxu
@Himanshhhhxu 2 ай бұрын
Control bhai control
@the_only_one9415
@the_only_one9415 2 ай бұрын
Hello sir, why u didnt used dp in this problem?
@codestorywithMIK
@codestorywithMIK 2 ай бұрын
Definitely you can. Memoize it.
@the_only_one9415
@the_only_one9415 2 ай бұрын
@@codestorywithMIK ok sir, Thank you
@BatttttMan
@BatttttMan 2 ай бұрын
Constraints in the Question were Light....
@saarvikjaiswal3458
@saarvikjaiswal3458 2 ай бұрын
Hello MIK bhai, I’m new to your channel and I saw great response from people watching you. I have always faced difficulties in Dsa like understanding the concept and problem related to it is not the tougher job but whenever I’ve tried solving on my own it just doesn’t happen to be. I’m requesting you to provide a sheet/combined playlist starting from basic concepts and their problems to slowly climbing the difficulty ladder to advance or med-hard problems. Please take this into consideration 🥺
@jeehub041
@jeehub041 2 ай бұрын
Ist view as always ❤
Lexicographical Numbers | Simple DFS | Leetcode 386 | codestorywithMIK
16:15
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,5 МЛН
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 87 МЛН
Different Ways to Add Parentheses - Leetcode 241 - Python
15:14
NeetCodeIO
Рет қаралды 14 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 736 М.
Why Didn't He Get the Job? Let's Find Out! // Code Review
27:25
The Cherno
Рет қаралды 148 М.
Rotating the Box | Brute Force | Optimal | Leetcode 1861 | codestorywithMIK
34:16
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 197 М.
Different Ways to Add Parentheses | Leetcode 241
22:25
Techdose
Рет қаралды 1,1 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 834 М.
Arpit Bhayani talks about real engineering for 1 hour straight
1:16:23
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,5 МЛН