- 54
- 4 878
CodeCracker
Приєднався 30 жов 2016
3301 Maximize the Total Height of Unique Towers
In this video we will solve today's Biweekly Contest 2nd problem which is "3301. Maximize the Total Height of Unique Towers".
Переглядів: 4
Відео
3300 Minimum Element After Replacement With Digit Sum
Переглядів 35 годин тому
In this video we will solve today's Biweekly Contest 1st problem which is " 3300. Minimum Element After Replacement With Digit Sum".
241 Different Ways to Add Parentheses
Переглядів 4121 годину тому
In this video we will solve today's Leetcode Daily Challenge problem which is "241. Different Ways to Add Parentheses".
179. Largest Number
Переглядів 17День тому
In this video we will solve todays Leetcode Daily Challenge problem which is "179. Largest Number".
539 Minimum Time Difference
Переглядів 21День тому
In this video we will solve today's Leetcode Daily Challenge problem which is "539. Minimum Time Difference".
3290 Maximum Multiplication Score
Переглядів 71День тому
In this video we will solve today's Leetcode Weekly Contest 415 second problem which is "3290. Maximum Multiplication Score".
The Two Sneaky Numbers of Digitville
Переглядів 59День тому
In this video we will solve today's Leetcode Weekly Contest second problem which is "The Two Sneaky Numbers of Digitville".
3286 Find a Safe Walk Through a Grid
Переглядів 21014 днів тому
In this video we will solve today's Biweekly Contest 139 second problem which is "3286. Find a Safe Walk Through a Grid".
Find Indices of Stable Mountains
Переглядів 3614 днів тому
In this video we will solve today's Leetcode Biweekly Contest first problem which is "Find Indices of Stable Mountains".
1310 XOR Queries of a Subarray | 2 Approaches | BruteForce | prefixXOR
Переглядів 1314 днів тому
In this video we will solve today's Leetcode Daily Challenge problem which is "1310. XOR Queries of a Subarray".
1684 Count the Number of Consistent Strings
Переглядів 2514 днів тому
In this video we will solve today's Leetcode Daily Challenge problem which is "1684. Count the Number of Consistent Strings".
Convert string
Переглядів 2514 днів тому
In this video we will solve today's codechef starters's 151 2nd problem which is "Convert string".
2220 Minimum Bit Flips to Convert Number
Переглядів 8014 днів тому
In this video we will be solving today's Leetcode Daily Challenge problem which is "2220. Minimum Bit Flips to Convert Number."
International Gym Day
Переглядів 20814 днів тому
In this video we will solve codechef contest Starter 151 div 3 first problem which is "International Gym Day."
Find the Key of the Numbers
Переглядів 5528 днів тому
In this video we will solve today's Leetcode Biweekly Contest 3rd problem which is "Find the Key of the Numbers".
3266 Final Array State After K Multiplication Operations II
Переглядів 69Місяць тому
3266 Final Array State After K Multiplication Operations II
3264 Final Array State After K Multiplication Operations I
Переглядів 44Місяць тому
3264 Final Array State After K Multiplication Operations I
A Find K Distinct Points with Fixed Center
Переглядів 53Місяць тому
A Find K Distinct Points with Fixed Center
3016 Minimum Number of Pushes to Type Word II
Переглядів 96Місяць тому
3016 Minimum Number of Pushes to Type Word II
Q2 Minimum Number of Flips to Make Binary Grid Palindromic I
Переглядів 37Місяць тому
Q2 Minimum Number of Flips to Make Binary Grid Palindromic I
1460 Make Two Arrays Equal by Reversing Subarrays
Переглядів 69Місяць тому
1460 Make Two Arrays Equal by Reversing Subarrays
2134 Minimum Swaps to Group All 1's Together II
Переглядів 29Місяць тому
2134 Minimum Swaps to Group All 1's Together II
thanks in last i did dry run understand the optimal soln after fucking 1 hr :)
😅yeah DP questions can be frustrating sometimes. glad you understand the concept.
in simple soln when u put in set its means its visited right but when u backstracking then why not removig it ?
I have passed set by value. so while backtracking the s{row, col} is removed from set. If i pass it by reference than i have to keep the track of health. because there could be a possibility that if you marked some index {2, 1} in set , my health is suppose 3 and i didn't find the path. than again using some other path i reach the same index {2, 1} and my health is suppose 6 this time. Than set({2,1}) will return 0 but there could be the possibilty if finding path . That's why it is imp to keep the track of health . so you can track the health by using 2d matrix, using map insead of set or 3d matrix that you have done in your code. You can dry run testcase 3 of the question grid = [[1,1,1],[1,0,1],[1,1,1]] health = 5 This will clear your doubt.
@@NO-nc7hh yeah i use java, dont know how u pass it by value, its always by referncnce
yeah i got the soln if its by value
worst, u spend aall ur engry in order to explain simple things when complex part came then blah blah blah
Which part u didn't understand?
@@NO-nc7hh optmial soln , why u put dp[row][col] >= heath, u just explain it without dry run, in easy step u ddid all dry run
@@sourabhgarg2890ok next time I'll try to put my point in an easier and much understandable way. Did you understand the code?
@@NO-nc7hh i am using 3d visited[m][n][heath] its easy to understand
@@sourabhgarg2890 okay. Is that accepted because using 3d vector might cause memory out of bound.
Thanks for explanation
Nicely explained
A good observation based question
ua-cam.com/video/4QcuS-gBOPE/v-deo.html
Nice optimization bro. So, time complexity in worst case will still be O(N ^ 2) but in most cases, it will take less time than O(N^2), right?
Yes, you've got it right. In the worst case, the complexity is still O(n^2), but the optimization helps it perform better in many cases. Thanks for your comment.🙌
@@NO-nc7hh No issues bro :) Btw, do you know some source for preparing questions/concepts related to prefix-sum?
How the worst case take n^2 complexity? I think it's only take less than n^2 or am I wrong?
@@GamingFlixff I think in the case of 0101010101010, that is alternate ones and zeros it will take worst time compexity.
New subscriber ❤❤🎉