EXPRESSION ADD OPERATORS | LEETCODE # 282 | PYTHON SOLUTION

  Рет қаралды 7,190

Cracking FAANG

Cracking FAANG

Күн бұрын

Пікірлер: 28
@aminebesbes6202
@aminebesbes6202 2 жыл бұрын
Great explanation! Thank you! Could you please prepare a general video to explain how to set-up a DFS parameters and its stop condition (Many LeetCode problems similar to this but always the toughest thing is to identify what parameters are needed for the DFS)
@vikramramkumar2087
@vikramramkumar2087 4 ай бұрын
Damn.. what a solution!! I was thinking of generating all expressions using recursive backtracking (by inserting operators into num at alternate places), then using the eval() function in python, evaluate the string expression and see if eval(''.join(exp)) == target, append only those exp to res. Sadly, this approach was giving a TLE 🥲 Great solution btw!
@bilalalfakih1017
@bilalalfakih1017 6 күн бұрын
this was my exact solution, and then I got TLE
@drewlee7435
@drewlee7435 5 ай бұрын
@Cracking FAANG Thanks for an AMAZING video. It's super concise and easy to understand. It's been an year but wanted to make a comment on this as I was thinking thru the complexities in the end. I am not too convinced that the Space Complexity is actually O(N), I think it should be at least O(3^N) similar to Time Complexity. I say this because I think the space needed doesn't grow linear with additional input, but rather exponentially to the additional input. Would love to know your thought on this. Thanks
@lavanya_m01
@lavanya_m01 7 ай бұрын
Thanks for the detailed explanation!! I've a query, are we using cur_res as a list instead of a string because strings are immutable and addition of a character to a string takes O(N)?
@user-vt8dd6fj7v
@user-vt8dd6fj7v 2 жыл бұрын
Nice video. I liked the video. Would like to request “Nested List Weight Sum II”. You solve the first version 4 month ago but not the 2nd one
@YT.Nikolay
@YT.Nikolay 2 жыл бұрын
Awesome! Thank you, we missed you!
@sumeetkamat
@sumeetkamat 3 ай бұрын
Amazing explanation! Do you have any link where you post your solutions so we can use it to run through it line by line?
@crackfaang
@crackfaang 2 ай бұрын
I don't currently have a github for the solution code but I really should set one up
@manojamrutharaj9071
@manojamrutharaj9071 2 жыл бұрын
Welcome back. Thanks for the cool explanation...
@45vinitthakkar56
@45vinitthakkar56 4 ай бұрын
good explaination!
@rsKayiira
@rsKayiira 2 жыл бұрын
Great video could you please do Valid Palindrome III LC 1216.
@aneeshakaushal267
@aneeshakaushal267 5 ай бұрын
Thanks. Very well explained :)
@roywastaken
@roywastaken Жыл бұрын
come back G, shit ain't the same without you
@crackfaang
@crackfaang Жыл бұрын
Comeback is planned… sometime later this month 👀
@roywastaken
@roywastaken Жыл бұрын
@@crackfaang hell yea!!! prepping for Meta with your videos atm
@AP-eh6gr
@AP-eh6gr Жыл бұрын
@@roywastaken same lol. Gotta do those 172 for last 6 mo
@Yyyyyyyyhhhhh12342
@Yyyyyyyyhhhhh12342 7 күн бұрын
why not eval at end?
@sudhanshukumar3745
@sudhanshukumar3745 Жыл бұрын
can you explain why in multiplication part of the dfs prev becomes curr_num*prev?
@lesterdelacruz5088
@lesterdelacruz5088 8 ай бұрын
because when something like this happends `1-2*3*2` you need that must be the same as `1-(x*y)` at before the `-`. If you step through the code on `1-2*3*2` it will make sense. That's what i did.
@sudhanshukumar3745
@sudhanshukumar3745 8 ай бұрын
@@lesterdelacruz5088 hey thanks for the explanation
@Yyyyyyyyhhhhh12342
@Yyyyyyyyhhhhh12342 7 күн бұрын
why break when cur_idx is at 0?
@Yyyyyyyyhhhhh12342
@Yyyyyyyyhhhhh12342 7 күн бұрын
nevermind got it!
@cindysu262
@cindysu262 2 жыл бұрын
Awesome!!
@crackfaang
@crackfaang 2 жыл бұрын
Glad you found it helpful! Subscribe if you haven’t already 😃
@ScientistRenzo
@ScientistRenzo 2 ай бұрын
Sick ty
@sauravchandra10
@sauravchandra10 Жыл бұрын
can anyone help me with the c++ code?
@anilrai9401
@anilrai9401 9 ай бұрын
class Solution { public: vector ans; void rec(int cur_idx, string cur_res, long long cur_sum, long long prev, string &num, int target){ if(cur_idx>=num.size()){ if(cur_sum==target){ ans.push_back(cur_res); } return; } string cur_str = ""; for(int j=cur_idx;j
MAKING A LARGE ISLAND | LEETCODE # 827 | PYTHON SOLUTION
22:09
Cracking FAANG
Рет қаралды 8 М.
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 133 МЛН
Real Man relocate to Remote Controlled Car 👨🏻➡️🚙🕹️ #builderc
00:24
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 32 МЛН
Leetcode 282: Expression Add Operators | Master Backtracking | Intuition and Approach
32:20
ROBOT ROOM CLEANER | LEETCODE # 489 | PYTHON BACKTRACK SOLUTION
19:44
Cracking FAANG
Рет қаралды 11 М.
ALIEN DICTIONARY | LEETCODE 269 | PYTHON TOPOLOGICAL SORT DFS SOLUTION
23:41
LARGEST BST SUBSTREE | LEETCODE # 333 | PYTHON POSTORDER DFS SOLUTION
16:28
LeetCode 282. Expression Add Operators
18:37
Happy Coding
Рет қаралды 7 М.
DOT PRODUCT OF TWO SPARSE VECTORS - 3 SOLUTIONS EXPLAINED [PYTHON]
31:06
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 133 МЛН