- 174
- 162 417
Ayush Rao
India
Приєднався 21 лип 2018
Software engineer at JPMORGAN CHASE. I make videos related to Coding, Life, and Meditation.
Connect me on Linkedin: www.linkedin.com/in/ayush-nemmaniwar/
Connect me on Linkedin: www.linkedin.com/in/ayush-nemmaniwar/
3289 The Two Sneaky Numbers of Digitville (Without Extra Space) 🔥 || How to 🤔 || Bit Manipulation 🙂
Question Link: leetcode.com/problems/the-two-sneaky-numbers-of-digitville
Solution Link: leetcode.com/problems/the-two-sneaky-numbers-of-digitville/solutions/5789363/easy-video-solution-without-extra-space-how-to-in-interview-bit-manipulation/
Leetcode Profile : leetcode.com/ayushnemmaniwar12/
Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco
Connect with me on Linkedin: www.linkedin.com/in/ayush-nemmaniwar/
Video Link: ua-cam.com/video/0swpo4yj22k/v-deo.html
Greetings UA-cam Community,
I have created a Code_With_Confidence WhatsApp community. If you are interested, you can join. In this community, we will track consistency (Eg: Leetcode daily challenge, Upsolving Contest problems ) and discuss trending technologies.
Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco
Video Link: ua-cam.com/video/0swpo4yj22k/v-deo.html
In have made a Video on my past learnings and experience, I will be covering the following topics:
1.Consistency: How I solved 550 LeetCode problems in 2023 by dedicating an average of 30 minutes on weekdays and 2 hours on weekends.
2.How many days should you dedicate to studying Data Structures and Algorithms?
3.The importance of system design in interviews.
4.How service-based companies contribute to your early career.
5.How to break down your goals and achieve them step by step (Progressing from Service-Based roles to FAANG companies)
6.FOMO (Fear Of Missing Out).
Video Link: ua-cam.com/video/0swpo4yj22k/v-deo.html
Solution Link: leetcode.com/problems/the-two-sneaky-numbers-of-digitville/solutions/5789363/easy-video-solution-without-extra-space-how-to-in-interview-bit-manipulation/
Leetcode Profile : leetcode.com/ayushnemmaniwar12/
Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco
Connect with me on Linkedin: www.linkedin.com/in/ayush-nemmaniwar/
Video Link: ua-cam.com/video/0swpo4yj22k/v-deo.html
Greetings UA-cam Community,
I have created a Code_With_Confidence WhatsApp community. If you are interested, you can join. In this community, we will track consistency (Eg: Leetcode daily challenge, Upsolving Contest problems ) and discuss trending technologies.
Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco
Video Link: ua-cam.com/video/0swpo4yj22k/v-deo.html
In have made a Video on my past learnings and experience, I will be covering the following topics:
1.Consistency: How I solved 550 LeetCode problems in 2023 by dedicating an average of 30 minutes on weekdays and 2 hours on weekends.
2.How many days should you dedicate to studying Data Structures and Algorithms?
3.The importance of system design in interviews.
4.How service-based companies contribute to your early career.
5.How to break down your goals and achieve them step by step (Progressing from Service-Based roles to FAANG companies)
6.FOMO (Fear Of Missing Out).
Video Link: ua-cam.com/video/0swpo4yj22k/v-deo.html
Переглядів: 765
Відео
3290 Maximum Multiplication Score || How to 🤔 in Interview || DP + Memoization 🔥
Переглядів 6793 місяці тому
Question Link: leetcode.com/problems/maximum-multiplication-score/description/ Solution Link: leetcode.com/problems/maximum-multiplication-score/solutions/5789187/easy-video-solution-how-to-in-interview-dp-memoization/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco Connect with me on Linkedin: www.linkedin.com/in/...
3291 Minimum Number of Valid Strings to Form Target I || How to 🤔 in Interview || Trie + Memo 🥲
Переглядів 1,2 тис.3 місяці тому
Question Link: leetcode.com/problems/minimum-number-of-valid-strings-to-form-target-i/description/ Solution Link: leetcode.com/problems/minimum-number-of-valid-strings-to-form-target-i/solutions/5789298/easy-video-solution-critical-thinking-how-to-in-interview-trie-memo/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3c...
3276 Select Cells in Grid With Maximum Score || How to 🤔 in Interview || Unique || Memo + Bitmasking
Переглядів 2,6 тис.3 місяці тому
Question Link: leetcode.com/problems/select-cells-in-grid-with-maximum-score/description/ Solution Link: leetcode.com/problems/select-cells-in-grid-with-maximum-score/solutions/5718459/simple-solution-using-memo-bitmasking/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco Connect with me on Linkedin: www.linkedin.co...
3275. K-th Nearest Obstacle Queries || How to 🤔 in Interview || Heap || Brute Force to Optimized 🔥
Переглядів 4473 місяці тому
Question Link: Solution Link: leetcode.com/problems/k-th-nearest-obstacle-queries/solutions/5719153/easy-video-solution-how-to-in-interview-heap-brute-force-optimized/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco Connect with me on Linkedin: www.linkedin.com/in/ayush-nemmaniwar/ Video Link: ua-cam.com/video/0swp...
3274 Check if Two Chessboard Squares Have the Same Color || 5 Liners || How to 🤔 in Interview|| Math
Переглядів 4573 місяці тому
Question Link: leetcode.com/problems/check-if-two-chessboard-squares-have-the-same-color/description/ Solution Link: leetcode.com/problems/check-if-two-chessboard-squares-have-the-same-color/solutions/5718177/easy-video-solution-how-to-in-interview-math/3274. Check if Two Chessboard Squares Have the Same Color Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community lin...
3265 Count Almost Equal Pairs I || Critical Thinking 🔥 || How to 🤔 in Interview || Simulation
Переглядів 1 тис.3 місяці тому
Question Link: leetcode.com/problems/count-almost-equal-pairs-i/description/ Solution Link: leetcode.com/problems/count-almost-equal-pairs-i/solutions/5687053/easy-video-solution-critical-thinking-how-to-in-interview-simulation/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco Connect with me on Linkedin: www.linked...
3264 Final Array State After K Multiplication Operations I || O(N*N) to O(K*logN) 🔥|| Priority_queue
Переглядів 4673 місяці тому
Question Link: leetcode.com/problems/final-array-state-after-k-multiplication-operations-i/description/ Solution Link: leetcode.com/problems/final-array-state-after-k-multiplication-operations-i/solutions/5687544/o-n-n-o-k-log-n-video-solution-how-to-in-interview-priority-queue/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923V...
3259 Maximum Energy Boost From Two Drinks || How to 🤔 in Interview || Top Down (Memo) + Bottom Up 🔥
Переглядів 8604 місяці тому
Question Link: leetcode.com/problems/maximum-energy-boost-from-two-drinks/description/ Solution Link: leetcode.com/problems/maximum-energy-boost-from-two-drinks/solutions/5653182/easy-video-solution-how-to-in-interview-top-down-memo-bottom-up/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco Connect with me on Linke...
3258 Count Substrings That Satisfy K Constraint I || How to 🤔 in Interview || O(N^3 to N^2)
Переглядів 5444 місяці тому
Question Link: leetcode.com/problems/count-substrings-that-satisfy-k-constraint-i/description/ Solution Link: leetcode.com/problems/count-substrings-that-satisfy-k-constraint-i/solutions/5653203/easy-video-solution-how-to-in-interview-o-n-3-to-n-2-substrings/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco Connect ...
3250 Find the Count of Monotonic Pairs I || How to 🤔 in Interview || 3D DP || O(50*50*N)
Переглядів 1,3 тис.4 місяці тому
Question Link: leetcode.com/problems/find-the-count-of-monotonic-pairs-i/description/ Solution Link: leetcode.com/problems/find-the-count-of-monotonic-pairs-i/solutions/5619799/easy-video-solution-how-to-in-interview-3d-dp-o-50-50-n/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco Connect with me on Linkedin: www.l...
3249 Count the Number of Good Nodes || How to 🤔 in Interview || Build Graph + DFS || Math
Переглядів 2 тис.4 місяці тому
Question Link: leetcode.com/problems/count-the-number-of-good-nodes/description/ Solution Link: leetcode.com/problems/count-the-number-of-good-nodes/solutions/5619444/easy-video-solution-how-to-in-interview-build-graph-dfs-math/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco Connect with me on Linkedin: www.linked...
3248 Snake in Matrix || How to 🤔 in Interview || Simple Logic 🔥
Переглядів 1854 місяці тому
Question Link: leetcode.com/problems/snake-in-matrix/description/ Solution Link: leetcode.com/problems/snake-in-matrix/solutions/5619454/easy-c-solution-simple-logic/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco Connect with me on Linkedin: www.linkedin.com/in/ayush-nemmaniwar/ Video Link: ua-cam.com/video/0swpo...
3219 Minimum Cost for Cutting Cake || Pictorial Explanation 🔥 || How to 🤔 Interview ||PRIORITY_QUEUE
Переглядів 9225 місяців тому
Question Link: leetcode.com/problems/minimum-cost-for-cutting-cake-i/description/ Question Link : leetcode.com/problems/minimum-cost-for-cutting-cake-ii/description/ Solution Link: leetcode.com/problems/minimum-cost-for-cutting-cake-i/solutions/5474149/easy-priority-solution/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5y...
3217 Delete Nodes From Linked List Present in Array || Linked List 🔥 || Using Temp Node ✅
Переглядів 1,9 тис.5 місяців тому
Question Link: leetcode.com/problems/delete-nodes-from-linked-list-present-in-array/description/ Solution Link: leetcode.com/problems/delete-nodes-from-linked-list-present-in-array/solutions/5473411/using-temp-node/ Leetcode Profile : leetcode.com/ayushnemmaniwar12/ Code_With_Confidence community link: chat.whatsapp.com/HoH1gxu923VG5yfwB3cnco Connect with me on Linkedin: www.linkedin.com/in/ayu...
3216 Lexicographically Smallest String After a Swap || How to 🤔 in Interview || String 🔥
Переглядів 8265 місяців тому
3216 Lexicographically Smallest String After a Swap || How to 🤔 in Interview || String 🔥
3212 Count Submatrices With Equal Frequency of X and Y || Precompute Sum ✅ || Dynamic Programming 🔥
Переглядів 1 тис.5 місяців тому
3212 Count Submatrices With Equal Frequency of X and Y || Precompute Sum ✅ || Dynamic Programming 🔥
3211 Generate Binary Strings Without Adjacent Zeros || Recursion and Simulation 🔥
Переглядів 1,4 тис.5 місяців тому
3211 Generate Binary Strings Without Adjacent Zeros || Recursion and Simulation 🔥
3210 Find the Encrypted String || How to 🤔 in Interview || Cyclic Order (i+k)%n
Переглядів 3695 місяців тому
3210 Find the Encrypted String || How to 🤔 in Interview || Cyclic Order (i k)%n
3200 Maximum Height of a Triangle || How to 🤔 in Interview || Simulation ✅
Переглядів 1,8 тис.5 місяців тому
3200 Maximum Height of a Triangle || How to 🤔 in Interview || Simulation ✅
3201 Find the Maximum Length of Valid Subsequence I || 🤔 in Interview || {0,0},{0,1},{1,0},{1,1} ✅
Переглядів 1,2 тис.5 місяців тому
3201 Find the Maximum Length of Valid Subsequence I || 🤔 in Interview || {0,0},{0,1},{1,0},{1,1} ✅
3196 Maximize Total Cost of Alternating Subarrays || How to 🤔 in Interview || DP ✅ || Memo 🔥
Переглядів 1,1 тис.5 місяців тому
3196 Maximize Total Cost of Alternating Subarrays || How to 🤔 in Interview || DP ✅ || Memo 🔥
3195 Find the Minimum Area to Cover All Ones I || How to 🤔 in Interview || Math 🔥
Переглядів 7225 місяців тому
3195 Find the Minimum Area to Cover All Ones I || How to 🤔 in Interview || Math 🔥
3194 Minimum Average of Smallest and Largest Elements || How to 🤔 in Interview || Sort || 2 Pointer
Переглядів 6535 місяців тому
3194 Minimum Average of Smallest and Largest Elements || How to 🤔 in Interview || Sort || 2 Pointer
3178 Find the Child Who Has the Ball After K Seconds How to 🤔 in Interview || O(N)-O(1) 🔥
Переглядів 5746 місяців тому
3178 Find the Child Who Has the Ball After K Seconds How to 🤔 in Interview || O(N)-O(1) 🔥
3180 Maximum Total Reward Using Operations I || How to 🤔 in Interview || Sort+Recursion+Memoization
Переглядів 1,5 тис.6 місяців тому
3180 Maximum Total Reward Using Operations I || How to 🤔 in Interview || Sort Recursion Memoization
3179 Find the N th Value After K Seconds || How to 🤔 in Interview || Dynamic Programming 🔥
Переглядів 4626 місяців тому
3179 Find the N th Value After K Seconds || How to 🤔 in Interview || Dynamic Programming 🔥
3137 Minimum Number of Operations to Make Word K Periodic || Frequency Count 🔥 || Map + Substring ✅
Переглядів 3897 місяців тому
3137 Minimum Number of Operations to Make Word K Periodic || Frequency Count 🔥 || Map Substring ✅
3138 Minimum Length of Anagram Concatenation || How to 🤔 in Interview || Divisors + Sorting + Map ✅
Переглядів 1,1 тис.7 місяців тому
3138 Minimum Length of Anagram Concatenation || How to 🤔 in Interview || Divisors Sorting Map ✅
3136 Valid Word || How to 🤔 in Interview || Conditional Statements 🔥
Переглядів 2417 місяців тому
3136 Valid Word || How to 🤔 in Interview || Conditional Statements 🔥
nice explanation bro keep going
Wrong time complexity explanation. If you solve it using a queue. You're processing every index just once. Whenever you process an index you send another index at the end, but that takes O(1) time. Overall you're only processing O(1) operations n times. Hence O(n) is the time complexity of the while loop on the queue. Correct, final TC is O(nlogn), but it is because it gets dominated via sorting. If you solve the question using two pointers, then the TC would be nlogn of even the while loop.
Where did we update the string?
Got confused More!
Thanks a lot
Excellent explanation thank you
thank you sir
maxi not required to be same while increasing i. ex: [ 3,2,1,3,4 ] k = 2
2 pointer
its better not to use seive for this question instead use sime check function for the prime number
great explaination... can you go over DP please
Thank you! nicely done explanation!
Great explanation !! Thanks
nice brother
Basically you are doing take not take and max-value among them right ??
what if the number gets repeated, then we need to store both the index of the value in the map?
Nice Explanation, hope to see you in greater heights!
Thank you ☺️
i understand the solution but ... i dont know how to come up with the idea. how can we know to return min(value[node], sum)... what is the idea to that specific value ??
Nice Explanation
Bro can you share how you plugin the BigOmega extension to your leetcode, I am just not able to do that
it will be very helpful if you can do this
Why 1+search() can you please help
Hey, that 1 indicates that you already have taken valid string till i and now you are trying to find the answer of rest of string that starts from i+1 and so 1+ search(i+1)
This time i was able to solve this question.Here is my solution class Solution { public: long long f(int ind,int x,vector<int>& a, vector<int>& b,vector<vector<long long>> &dp) { if(x<0) return 0; if(ind<0) return -1e15; if(dp[ind][x]!=-1) return dp[ind][x]; long long notpick=f(ind-1,x,a,b,dp); long long pick=INT_MIN; if(x >=0) pick=(long long)a[x]*b[ind] + f(ind-1,x-1,a,b,dp); return dp[ind][x]=max(pick,notpick); } long long maxScore(vector<int>& a, vector<int>& b) { int n=b.size(); vector<vector<long long>> dp(n+1,vector<long long>(4,-1)); return f(n-1,3,a,b,dp); } };
the code did not work
it works
Is the brutefore time complexity is #columns^(#rows) ?
Can you please explain timecomplexity for bruteforce approach?
"Tanya" & the smile though 😆. Well explained though!
Sir at 7:19 we are using set to store all the unique elements present in the vector nums which is taking O(N) space in worst case.
Damn this was the 3rd what will the 4th look like
There is no way I can come up with this. Hopefully, it builds with experience
Yeah that’s true, patterns build with the experience. Keep practising 😀
hello bro, Could you make another video about this problem (3276. Select Cells in Grid With Maximum Score). I wrote a backtracking solution and I'm stuck to transform it to dynamic. make a deep explanation if possible about how to to think in term of dynamic. here ici my backtrack solution : # backtracking approach O(n^m) where n = {nombre of column} and m = {nombre of line} def maxScore(self, grid: List[List[int]]) -> int: ans = {"res" : 0} selected = set() n = len(grid) def aux(i,currentSum): if i >= n : return for j in range(len(grid[i])): el = grid[i][j] if el not in selected : selected.add(el) # select this element ans["res"] = max(ans["res"], el + currentSum) aux(i+1, el + currentSum) # go to next line selected.remove(el) # backtracking aux(i+1, currentSum) # go to next line aux(0,0) return ans["res"]
thank you this awesome content
Thank you ☺
good explanation man
Thank you ☺️
startup vs service based company(both offering same package)
Depends on company varun, product based companies allow lot of extra amenities and mostly it has own product. But in service based you may work with other vendors
class Solution { public: int solve(vector<int>&nums, int target, int i, int dp[], int &maxSize, int size){ if(target == 0){ maxSize = max(maxSize, size); return dp[i] = maxSize; } if(i == nums.size()){ return dp[i] = -1; } if(dp[i]!=0) return dp[i]; if(nums[i] <= target){ return dp[i] = solve(nums, target - nums[i], i+1, dp, maxSize, size+1); } return dp[i] = solve(nums, target, i+1,dp, maxSize, size); } int lengthOfLongestSubsequence(vector<int>& nums, int target) { int max_size = 0, size = 0; int i = 0; int dp[1000]; memset(dp, -1, sizeof(dp)); solve(nums, target, i, dp, max_size, size); if(max_size == 0){ return -1; } return max_size; } }; I am applying 1d DP, thinking that i is always changing that is why i chosed 1d DP
How do you get to know which paramater to take in dp? Or whether it is 1d DP or 2d DP?
Hi pawan, we should consider states in recursive function. States are something which is changing on every recursive call
@@Code_With_Confidence Thankyou
Hi sir, The explanation of the approach is clear, but in the solve function why are we taking base case as i==n, because i is not representing the row index, instead isn't it representing the ith max value from the t array, so in case when we not taking the ith max value and moving ahead, it can be the case that the value we skipped was from same row(whose max is already included), so with this we will always be checking the top n max values of the grid instead of values specific to the different row? Can you please clear this doubt.
Hi arnav, ‘i’ is not representing the row index, it’s representing the vector ‘t’ which stores values in descending order
@@Code_With_Confidence Yes Sir, but then why in the base case we are checking that if it is equal to n or not, because it won't be giving us the clear indication that are we done with all the row or not?
@@arnavsingh5846 yes, but it will give us clear indication that we are done with all the elements present in the grid, if there are no more elements left to pick from, doesn't that means it's over?
@@arnavsingh5846 we have to take maximum element which is not in the same row, also we can skip rows as well.
Bro mindBlowing. Actually, what I did in contest is. I iterated over the grid and chose the maximum value. If the maximum value occurred in more than one row, I did backtracking for every row. This solution may potentially lead to TLE but Leet code forgot to add testcases for this soln which gave me a global rank of 1028.
Thank you, Congratulations on getting 1028 👏
bro ur explanation was too good 🫡 but i have a question why use masking when we can use set or a map for checking index
Thank you 😀, if we use set or map we should go for backtracking.
why we didn't take in example 2: 0,1,2,3 and 6 nodes because after taking this 4 and 3 are present in there leaf node so sum will not be zero
i dont know graphs and DP. can i crack big tech job?
Hi varun, you can if interviewer skips that topics just kidding 😀. Don’t take any chances prepare all the topics thoroughly. One day you gonna crack
the intro feels like sriver's intro. cool
Thank you ☺️
Great explanation bro! although I was able to solve the problem during the contest, your approach was way more better and clear. If i may ask, what tool are you using for writing on OneNote, some kind of digital writing pad or on ipad?
Thank you, I am using XP pen
Thank you
You're welcome
should't time be n*n since length of num of digits is not related to n and is at max 7 digits long.
Sorry, That’s right TC should be N*N. Thank you for sharing
@@Code_With_Confidence thx for the vid!
Best explanation I came seeing your solution on leetcode
Thank you 😊
Does this gives TLE in the further part II of this question?
Yes it gives TLE
explained the question very well
Thank you 😊
Bro try to open up words, we have to listen very carefully each of your word..they r not clear..be concise, clear. And explain dry run slow..
Yeah, will improve on this. Thank you for sharing valuable feedback
Why the complexity is not O(n*50*50*50), can you pls tell this?
Thank you, man.
You're welcome!
Nice Explanation!! Thanks!!
Thank you 😊