- Видео 907
- Просмотров 8 360 197
Aryan Mittal
Индия
Добавлен 10 ноя 2012
Maqsad nhi bholna hai🫡
.
Prepare for Interviews like a PRO with Aryan🔥
.
Prepare for Interviews like a PRO with Aryan🔥
3201, 3202. Find the Maximum Length of Valid Subsequence II | | Math | DP | LIS Similar
In this video, I'll talk about how to solve Leetcode 3202. Find the Maximum Length of Valid Subsequence II | 3201. Find the Maximum Length of Valid Subsequence I | Math | DP | LIS Similar
LIS Concept - ruclips.net/video/iavQ4B6a51A/видео.html
Code for top down code (same as what we discussed in video) - leetcode.com/problems/find-the-maximum-length-of-valid-subsequence-ii/submissions/1304676861
[and yeah, as we are having i, j, & prevRem] - thus complexity will be O(n*n*k)
Let's Connect:
📱Discord (Join Community) : discord.gg/vwUAz2pEHZ
📝Linkedin: www.linkedin.com/in/aryan-mittal-0077
📸 Instagram: codeWithAryanBhai
💻 Twitter - aryan_mittal007
🤖 Github: github.com/aryan-00...
LIS Concept - ruclips.net/video/iavQ4B6a51A/видео.html
Code for top down code (same as what we discussed in video) - leetcode.com/problems/find-the-maximum-length-of-valid-subsequence-ii/submissions/1304676861
[and yeah, as we are having i, j, & prevRem] - thus complexity will be O(n*n*k)
Let's Connect:
📱Discord (Join Community) : discord.gg/vwUAz2pEHZ
📝Linkedin: www.linkedin.com/in/aryan-mittal-0077
📸 Instagram: codeWithAryanBhai
💻 Twitter - aryan_mittal007
🤖 Github: github.com/aryan-00...
Просмотров: 693
Видео
3203. Find Minimum Diameter After Merging Two Trees | Diameter of a Tree | Graph
Просмотров 80422 часа назад
In this video, I'll talk about how to solve Leetcode 3203. Find Minimum Diameter After Merging Two Trees | Diameter of a Tree | Graph Diameter of a Binary Tree - ruclips.net/video/e7NorVNKDyc/видео.html Let's Connect: 📱Discord (Join Community) : discord.gg/vwUAz2pEHZ 📝Linkedin: www.linkedin.com/in/aryan-mittal-0077 📸 Instagram: codeWithAryanBhai 💻 Twitter - aryan_mitta...
2192. All Ancestors of a Node in a Directed Acyclic Graph | Topological Sort | Merge Two Sorted List
Просмотров 3,3 тыс.16 часов назад
In this video, I'll talk about how to solve Leetcode 2192. All Ancestors of a Node in a Directed Acyclic Graph | Topological Sort | Merge Two Sorted List Master Leetcode in 2024 - ruclips.net/video/ZbkG8-ifnIk/видео.html Topological Sort - ruclips.net/video/G2i4z3uaO-0/видео.html Detect Cycle by Topological Sort in Directed Graph - ruclips.net/video/Cnj33RLUSEQ/видео.html Toposort Practice Prob...
2285. Maximum Total Importance of Roads | Greedy | Indegree OutDegree | Graph
Просмотров 2,2 тыс.19 часов назад
In this video, I'll talk about how to solve Leetcode 2285. Maximum Total Importance of Roads | Greedy | Indegree OutDegree | Graph Let's Connect: 📱Discord (Join Community) : discord.gg/vwUAz2pEHZ 📝Linkedin: www.linkedin.com/in/aryan-mittal-0077 📸 Instagram: codeWithAryanBhai 💻 Twitter - aryan_mittal007 Github: github.com/aryan-0077 About Me: I am Aryan Mittal - A Soft...
1791. Find Center of Star Graph | Indegree - Outdegree | Microsoft
Просмотров 1,3 тыс.21 час назад
In this video, I'll talk about how to solve Leetcode 1791. Find Center of Star Graph | Indegree - Outdegree | Microsoft Let's Connect: 📱Discord (Join Community) : discord.gg/vwUAz2pEHZ 📝Linkedin: www.linkedin.com/in/aryan-mittal-0077 📸 Instagram: codeWithAryanBhai 💻 Twitter - aryan_mittal007 Github: github.com/aryan-0077 About Me: I am Aryan Mittal - A Software Engine...
1382, 108 Balance a Binary Search Tree | Day-Stout-Warren (DSW) Algorithm | In-Place Balancing
Просмотров 3 тыс.День назад
In this video, I'll talk about how to solve Leetcode 1382. Balance a Binary Search Tree | Day-Stout-Warren Algorithm | In-Place Balancing | Inorder | Greedy | 108. Convert Sorted Array to Binary Search Tree Tree Traversals Morris Traversal - ruclips.net/video/EuhrPsgc0L8/видео.html Let's Connect: 📱Discord (Join Community) : discord.gg/vwUAz2pEHZ 📝Linkedin: www.linkedin.com/in/aryan-mittal-0077 ...
1038. Binary Search Tree to Greater Sum Tree | Recursive | Iterative | Morris Traversal
Просмотров 2,6 тыс.День назад
In this video, I'll talk about how to solve Leetcode 1038. Binary Search Tree to Greater Sum Tree | Recursive | Iterative | Morris Traversal - Super Important Tree Traversal Morris Traversal - ruclips.net/video/EuhrPsgc0L8/видео.html Let's Connect: 📱Discord (Join Community) : discord.gg/vwUAz2pEHZ 📝Linkedin: www.linkedin.com/in/aryan-mittal-0077 📸 Instagram: codeWithAryanBhai 💻 Tw...
995, 3191, 3192 Minimum Number of K Consecutive Bit Flips | Bit Manipulation | Sliding Wind | Greedy
Просмотров 8 тыс.День назад
In this video, I'll talk about how to solve Leetcode 995. Minimum Number of K Consecutive Bit Flips | Bit Manipulation | Prefix Technique | 3191. Minimum Operations to Make Binary Array Elements Equal to One I | 3192. Minimum Operations to Make Binary Array Elements Equal to One II BIT MANIPULATION Crash Course 📈 | All Tricks & Pattern with Intuition for DSA & CP - ruclips.net/video/DDIVTbatu1Y...
3196. Maximize Total Cost of Alternating Subarrays | DP | 0/1 Knapsack
Просмотров 3,1 тыс.День назад
In this video, I'll talk about how to solve Leetcode 3196. Maximize Total Cost of Alternating Subarrays | DP | 0/1 Knapsack Let's Connect: 📱Discord (Join Community) : discord.gg/vwUAz2pEHZ 📝Linkedin: www.linkedin.com/in/aryan-mittal-0077 📸 Instagram: codeWithAryanBhai 💻 Twitter - aryan_mittal007 Github: github.com/aryan-0077 About Me: I am Aryan Mittal - A Software En...
1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | 3 Approaches
Просмотров 4,6 тыс.День назад
In this video, I'll talk about how to solve Leetcode 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | 2 Pointer | Multiset | Priority Queue | Deque | 3 Approaches 2 Pointer Crash Course - ruclips.net/video/ZZ5bOSRxAqM/видео.html Let's Connect: 📱Discord (Join Community) : discord.gg/vwUAz2pEHZ 📝Linkedin: www.linkedin.com/in/aryan-mittal-0077 📸 Instagram: instagr...
3193. Count the Number of Inversions | DP Time Complexity | Two Pointer | DP Space Optimized
Просмотров 2,6 тыс.День назад
In this video, I'll talk about how to solve 3193. Count the Number of Inversions | DP Time Complexity | Two Pointer | DP Space Optimized Let's Connect: 📱Discord (Join Community) : discord.gg/vwUAz2pEHZ 📝Linkedin: www.linkedin.com/in/aryan-mittal-0077 📸 Instagram: codeWithAryanBhai 💻 Twitter - aryan_mittal007 Github: github.com/aryan-0077 About Me: I am Aryan Mittal - ...
1248. Count Number of Nice Subarrays | Prefix Sums | Sliding Window | Same as Leetcode 930
Просмотров 5 тыс.День назад
In this video, I'll talk about how to solve Leetcode 1248. Count Number of Nice Subarrays | Prefix Sums | Sliding Window | Same as Leetcode 930 2 Pointer Crash Course - ruclips.net/video/ZZ5bOSRxAqM/видео.html Let's Connect: 📱Discord (Join Community) : discord.gg/vwUAz2pEHZ 📝Linkedin: www.linkedin.com/in/aryan-mittal-0077 📸 Instagram: codeWithAryanBhai 💻 Twitter - arya...
1052. Grumpy Bookstore Owner | Sliding Window | Walmart Labs | EPAM Systems
Просмотров 4,7 тыс.День назад
In this video, I'll talk about how to solve Leetcode 1052. Grumpy Bookstore Owner | Sliding Window | Walmart Labs | EPAM Systems Let's Connect: 📱Discord (Join Community) : discord.gg/vwUAz2pEHZ 📝Linkedin: www.linkedin.com/in/aryan-mittal-0077 📸 Instagram: codeWithAryanBhai 💻 Twitter - aryan_mittal007 Github: github.com/aryan-0077 About Me: I am Aryan Mittal - A Softwa...
1552. Magnetic Force Between Two Balls | Binary Search on Answer | Greedy
Просмотров 6 тыс.День назад
In this video, I'll talk about how to solve Leetcode 1552. Magnetic Force Between Two Balls | Binary Search on Answer | Greedy Binary Search on Answer - ruclips.net/video/nBchKqaVwd8/видео.html Binary Search Template - ruclips.net/video/UZx_DI4z_l8/видео.html Binary Search Practice Problems - ruclips.net/p/PLEL7R4Pm6EmA-wPsAXrlDVYpIcrJGFwX5 Let's Connect: 📱Discord (Join Community) : discord.gg/...
1482. Minimum Number of Days to Make m Bouquets | Binary Search | Problem Statement 🤡 Problem 🗿
Просмотров 3,3 тыс.День назад
In this video, I'll talk about how to solve Leetcode 1482. Minimum Number of Days to Make m Bouquets | Binary Search | Problem Statement 🤡 Problem 🗿 Let's Connect: 📱Discord (Join Community) : discord.gg/vwUAz2pEHZ 📝Linkedin: www.linkedin.com/in/aryan-mittal-0077 📸 Instagram: codeWithAryanBhai 💻 Twitter - aryan_mittal007 Github: github.com/aryan-0077 About Me: I am Ary...
826. Most Profit Assigning Work | 5 Approaches | Greedy | Binary S | Priority Queue | 2 Pointer | DP
Просмотров 4,9 тыс.День назад
826. Most Profit Assigning Work | 5 Approaches | Greedy | Binary S | Priority Queue | 2 Pointer | DP
633. Sum of Square Numbers | Math | 2 Pointer | Binary Search | Two Sum
Просмотров 3,5 тыс.День назад
633. Sum of Square Numbers | Math | 2 Pointer | Binary Search | Two Sum
3185. & 3184 Count Pairs That Form a Complete Day II | Same as Two Sum | Modulo Operation
Просмотров 2,5 тыс.14 дней назад
3185. & 3184 Count Pairs That Form a Complete Day II | Same as Two Sum | Modulo Operation
3186. Maximum Total Damage With Spell Casting | DP + Binary Search | Same as LIS
Просмотров 3,8 тыс.14 дней назад
3186. Maximum Total Damage With Spell Casting | DP Binary Search | Same as LIS
3187. Peaks in Array | Segment Tree | Range Sum | 2 Line Change in Template | Fenwick Tree
Просмотров 1,8 тыс.14 дней назад
3187. Peaks in Array | Segment Tree | Range Sum | 2 Line Change in Template | Fenwick Tree
330. Patching Array | Greedy | Array | Math | Why not Bitset Trick
Просмотров 6 тыс.14 дней назад
330. Patching Array | Greedy | Array | Math | Why not Bitset Trick
502. IPO | Greedy | Priority Queue | Sorting | Zeta | Salesforce | Amazon
Просмотров 3,9 тыс.14 дней назад
502. IPO | Greedy | Priority Queue | Sorting | Zeta | Salesforce | Amazon
945. Minimum Increment to Make Array Unique | Greedy | Counting Sort
Просмотров 3,8 тыс.14 дней назад
945. Minimum Increment to Make Array Unique | Greedy | Counting Sort
2037. Minimum Number of Moves to Seat Everyone | Greedy | Counting Sort
Просмотров 2,5 тыс.14 дней назад
2037. Minimum Number of Moves to Seat Everyone | Greedy | Counting Sort
75. Sort Colors | 2 Pointers | Super Important Interview Question | 100Days 100K Placements
Просмотров 1,7 тыс.14 дней назад
75. Sort Colors | 2 Pointers | Super Important Interview Question | 100Days 100K Placements
1122. Relative Sort Array | Counting Sort Deep | Map | 2 Approaches | Amazon | Apple | De shaw
Просмотров 2,3 тыс.14 дней назад
1122. Relative Sort Array | Counting Sort Deep | Map | 2 Approaches | Amazon | Apple | De shaw
1051. Height Checker | All form of Sort Complexity | Counting Sort
Просмотров 2 тыс.14 дней назад
1051. Height Checker | All form of Sort Complexity | Counting Sort
3178. Find the Child Who Has the Ball After K Seconds | Math | Cyclic Math Pattern
Просмотров 94821 день назад
3178. Find the Child Who Has the Ball After K Seconds | Math | Cyclic Math Pattern
3179. Find the N-th Value After K Seconds | Pascal's Triangle | DP | Bottom Up Optimised DP
Просмотров 1 тыс.21 день назад
3179. Find the N-th Value After K Seconds | Pascal's Triangle | DP | Bottom Up Optimised DP
3181 & 3180 | BitSet Crash Course | DP | 3181. Maximum Total Reward Using Operations II & I
Просмотров 7 тыс.21 день назад
3181 & 3180 | BitSet Crash Course | DP | 3181. Maximum Total Reward Using Operations II & I
i find all your content helpful. Thank you.
your explainations was very good and really help me to understand the approach, one suggestion is that you could try to calm or maintain you body language which is anoying
suggestion if possible remove top down section as it is so much confusing rest other is awesome
Brilliant Presentation style is superb.
Today's problem to upload karo jaldi Remove Graph edges
check their community post
@@Jazzimus I checked it already in morning but unfortunately I thought it is only hint so I didn't click on it and I couldn't see the video link. Thanks .
optimization of 3202 freezed my brain
i never understand your class why i dont know
What I was thinking in first at the time of contest is using recursive with memoization and it is good to go and solved both Q2 & Q3 but when I used memoization it gives memory limit exceed error i both the cases and My submission is left with just last 10 cases in both the Questions and due to that I was stuck on these Questions in my whole leetcode contest and that actually ruined/fucked up my mind totally. My question is that to you Aryan that how we should think out like these approaches at the time of contest because in my mind apart from memoization no other approached come .
My memoization java code runs -> class Solution { int dp[][]; int kk; public int maximumLength(int[] nums, int k) { int n = nums.length; kk = k; dp = new int[n+1][k+1]; for (int[] d1 : dp) { Arrays.fill(d1, -1); } int ans = 0; for(int i=n-1; i>0; i--){ for(int j=i-1; j>-1; j--){ ans = Math.max(ans , 2 + solve(nums , j , (nums[j] + nums[i]) % kk)); //finding first two elements. } } return ans; } public int solve(int[] nums, int pre, int mod) { if (pre == -1) return 0; if (dp[pre][mod] != -1) return dp[pre][mod]; int ans = 0; for (int i = pre-1; i >= 0; i--) { if ((nums[i] + nums[pre]) % kk == mod) { ans = Math.max(ans, 1 + solve(nums, i, mod)); break; } } dp[pre][mod] = ans; return ans; } }
No Vedio on 1,2,3 ?
Already live on channel sir🫡😮💨
🫡
why for type =3 we are dsu of alice only shouldn't we check for both
because if its not in alice it will surely not in bob , thats why we he sorted the edge list first
please make video on leetcode 3202
Done 🫡🤌🏻
do not put such strong hints in video title, It spoils the question pretty quickly
DSU was very intuitive and I was able to solve it easily using it
My solution failed exactly on the "edge" case mentioned, it cleared my doubt why the answer is 7. Thanks!!!
Why we cannot use median method , it is giving me wrong answer on 453 test case , if i just join two medians of different trees , please reply @ARYANMITTAL
you will need to track individual diameter of both the trees it could be the case that by joining two medians the path length is still smaller than any one of the two diameters
@@nutrinoflash6132 But how it can be , if am taking median , shoudln't the height is eqaul to half of diameter?
Overkill
I guess this one was easier than Problem 3, what do you guys think?
same
Only problem here was to come up with an algo for Diameter 💀💀. Did not get this intuition of using one extreme to another extreme
yess
Good explanation. Thanks for all the knowledge.
GREAT
Can someone tell me whats wrong in my code? @ARYANMITAL please? int n = s.length() , score = 0; map < char , vector < int > > maa; for(int i = 0; i < n; i++){ int x = abs(points[i][0]) , y = abs(points[i][1]); maa[s[i]].push_back(max(x , y)); } int maxi = INT_MAX; //upper_limit -> represent second closest occurence of any character for(auto &[c , v] : maa){ sort(v.begin() , v.end()); if(v.size() > 1) maxi = min(maxi , v[1]); } for(auto [c , v] : maa){ if(v[0] < maxi){ score++; } } return score;
Bro, I forgot that problem you had a editorial which can be solved using multi bfs traversal. Can someone give me that problem name/link.
i didn't understand the 2 consq. sortedAncestors line
100% for your efforts bhai but fir bhi smz nhi aya .....hindi me daloge to jada understanding bethegi and grow bhi jada kr paoge bhai..e.g., love babbar and striver have same content but lovebabbar grow more becuase of his hindi language .
honestly, didnot understand anything.
same hindi me smzane ki kosis kerta to ata bhi yrr
@ARYANMITTAL, Please create a video for this question 3009 leetcode.com/problems/maximum-number-of-intersections-on-the-chart/description/
explain in java. i am sure u r reach and subscribers will be doubled
Awesome explanation, perfectly described, you got a new subscriber!
Bro..sexyyy tbh
thanks for all the efforts
Hi Aryan, I've been working on the same problem you discussed in your video about finding ancestors in a directed graph. Here’s the code I wrote to solve it using a topological sort approach. Could you please check it and let me know if there are any optimizations or improvements I can make? Thanks! class Solution { public: vector<vector<int>> getAncestors(int n, vector<vector<int>>& edges) { unordered_map<int, list<int>> mp; vector<int> indegree(n, 0); for (const auto& edge : edges) { int u = edge[0]; int v = edge[1]; mp[u].push_back(v); indegree[v]++; } queue<int> q; for (int i = 0; i < n; ++i) { if (indegree[i] == 0) { q.push(i); } } vector<set<int>> v(n); // Perform a topological sort while (!q.empty()) { int top = q.front(); q.pop(); for (int x : mp[top]) { indegree[x]--; if (indegree[x] == 0) { q.push(x); } v[x].insert(v[top].begin(), v[top].end()); v[x].insert(top); } } vector<vector<int>> ans; for (const auto& x : v) { ans.push_back(vector<int>(x.begin(), x.end())); } return ans; } };
is it working now???? I am interested
Hello Hello Hello Aryan Good morning
I was waiting for your video😅...thanks a lot!!
Master Leetcode in 2024 - ruclips.net/video/ZbkG8-ifnIk/видео.html
anyone can tell what is wrong in this code and logic #define ll long long class Solution { public: ll helper(int i, int j, vector<int>& nums) { if(i > j) return 0; ll sum = 0; ll maxi = -1e9; for(int k = i;k<=j;k++) { if((k-i) % 2 == 0) sum += nums[k]; else sum -= nums[k]; ll result = sum*pow(-1,k-i) + helper(k+1,j,nums); if(result > maxi) maxi = result; } return maxi; } long long maximumTotalCost(vector<int>& nums) { int n = nums.size(); return helper(0,n-1,nums); } };
this guy is very much irritating, overact very much
3 variants of flip bits leetcode learnt
I did the same except didn't think of the base case as you did. Awesome solution mate!
Java Solution Easy: public long maximumImportance(int n, int[][] roads) { long deg[] = new long[n]; for(int x[]:roads){ deg[x[0]]++; deg[x[1]]++; } Arrays.sort(deg); long sum=0; long val=1; for(long it:deg){ sum+= it*val; val++; } return sum; }
Why used long long?
🙏🙏🙏🙌🙌
i solved only because of you
at 6:48 bro remembered his maksad....
Easy q , solved on my own, took some time to get intuition
priority_queue tag has also been mentioned on leetcode , how to do from that? i myself came up with the solution that u are telling here but i am just curious that how priority_queue will help here ?
class Solution { public: long long maximumImportance(int n, vector<vector<int>>& roads) { unordered_map<long long,long long>mp; for(auto it:roads) { mp[it[0]]++; mp[it[1]]++; } priority_queue<pair<long long,long long>>pq; for(auto it:mp) { pq.push({it.second,it.first}); } long long i = n; unordered_map<long long,long long>mp2; while(!pq.empty()) { long long x = pq.top().second; pq.pop(); mp2[x] = i; i--; } long long ans = 0; for(auto it:roads) { ans+=(mp2[it[0]]+mp2[it[1]]); } return ans; } };
@@AB-cc4km thanks, I was having trouble assigning valuse after getting the degrees, guess priority queue was the most efficient.
Do you daily upload these daily challenge questions of leetcode?.....btw explanation was too good !!
great aryan bhai .... bss tumhara hi sahara h ab to