Company tags on telegram, Discord & Website :) Structured DSA Practice Problems (700 Problems Structured) - codewitharyan.com/cwa-sheet/practice-problems
@bluesteel1Күн бұрын
some feedback - make it a screen share instead of a vidcast a lot of the screen gets hidden - share the code
@keerthivasan138Күн бұрын
instead by changing condition only if(dist[i]+myweight> node[i]){then update the nodes[i] weights works?
@CHILLBRO-e7yКүн бұрын
what about calculating the level for each component individually and adding it to get final answer?
@cripz4203Күн бұрын
For BFS, why can't we start from node with minimum degree and instead have to try BFS from every node?
@jonaskhanwald566Күн бұрын
Excellent observations and Very well explained by breaking down the problems and justifications.
@Jai-Hind-g1uКүн бұрын
Great Job Bro ❤ great explanation for a good problem ..completely understood thanx
@Abhay14Күн бұрын
best explaination bhaiya
@arjunprasad1071Күн бұрын
How we would have the changed the code if the question also demanded to list the maximum grouping? Thanks for the explaination! Simply great as usual! :)
@dharanyuvi6951Күн бұрын
Thanks for the intuition, bro This really helped me much to understand
@sajid7721Күн бұрын
Great explanation brother
@mohammedajmal42642 күн бұрын
very intuitive Explanation
@sanket32362 күн бұрын
There are multiple answers to the same graph like in the same example you can remove (1, 4) edge or (2, 3) or (3, 4) or (1, 2) to remove cycle but for the answer we need to remove the edge which appear at the last that's why answer is (1, 4). in case of dfs this wont work as we are just detecting cycle and remove the edge which causes cycle, in the same graph start dfs with 2 -> 2,1,5,4,3,2 so here 2 is again visited to (2, 3) would be answer but it is not correct. In case of dsu it will give correct answer as we are going in order
DSU dsu(N); for (auto edge : edges) { // If union returns false, we know the nodes are already connected // and hence we can return this edge. if (!dsu.doUnion(edge[0] - 1, edge[1] - 1)) { return edge; } } // Why above code works ? // according to question this should be the implementation right vector<int> lastCycleEdge; for (const auto& edge : edges) { if (!dsu.doUnion(edge[0]-1, edge[1]-1)) { lastCycleEdge = edge; // Store the cycle-forming edge } } return lastCycleEdge;
@prudvim35132 күн бұрын
Good solution. To keep it much simpler, this can be solved using post order traversal as well.
@krishnaagrawal53352 күн бұрын
SYSTEM DESIGN WHEN?????
@Abhinav_20602 күн бұрын
This guy gives the simplest and efficient solution there ever is
@ARYANMITTAL3 күн бұрын
DSU - kzbin.info/www/bejne/d6DWqGuJh9VqsJY My Uber Interview Experience - kzbin.info/www/bejne/jHi8e3yOat6fbZY My Coinbase Interview Experience - kzbin.info/www/bejne/f5uydGRul8SXedk My American Express Inteview Experience - kzbin.info/www/bejne/mWS4mYybm82hp80 My JP Morgan & Chase Interview Experience - kzbin.info/www/bejne/Y5vElIemjppqpNE ..... more coming soon (along with LLD course on Second Channel)
@kbcoder37343 күн бұрын
In the dfs approach, we can avoid using the extra space of a visiting array by changing the value of a grid to zero after adding.
@akashadak29643 күн бұрын
Nice Explanation, Eagerly waiting for 3435. Frequencies of Shortest Supersequences.
@subratamandal29243 күн бұрын
Bad explanation 😢
@prajapati-suraj3 күн бұрын
god level explanation.........
@Algorithmswithsubham4 күн бұрын
@sindhumarch304 күн бұрын
is it live or recorded video
@MikePowell19914 күн бұрын
I'M UNABLE TO SEE YOUR CODE . CAN ANYONE PLEASE HELP ME HOW I CAN I SEE SOLUTION AND SUBMISSIONS SUBMITTED BY HIM?
@Jazzimus4 күн бұрын
this can be solved in O(n + qlogq) by doing lazy updates on all and here and prefix sums + binary search for eliminating overcounting.
@coder61094 күн бұрын
Hi @aryan why cant we solve this by first forming a map of the toposort array (element,level in the toposort) so if for (a,b) if map.get(a) is less this means this comes first in toposort but 1 things is left how will this ensure that a,b are connected or not so can use DSU for that so wont then time complexity by just (n^2) i.e. of toposort and dsu just takes ~ o(1) Please suggest am I correct ?
@AngadSingh974 күн бұрын
very well explained, thank you Aryan
@aryajohary59224 күн бұрын
THIS IS THE BEST EXPLANATION OF THIS QUESTION ON THE WHOLE INTERNET
@praphulyadav25944 күн бұрын
This guy is genius🎉
@VIDITSHRIMALI-l8o4 күн бұрын
Lots of love ,just loved your content watching day and night
4 күн бұрын
brother where is 3435. Frequencies of Shortest Supersequences
4 күн бұрын
brother where is 3435. Frequencies of Shortest Supersequences
4 күн бұрын
brother where is 3435. Frequencies of Shortest Supersequences
@VIDITSHRIMALI-l8o4 күн бұрын
code quality
@aryavyadav93454 күн бұрын
Wow. Best explanation for this problem.
@nikhilprakash7294 күн бұрын
Awesome Explanation ❤❤❤
@aryamukherjee41224 күн бұрын
Topo sort is fine but dfs also works right given the bound is only 100 ?
@BCS-IshtiyakAhmadKhan4 күн бұрын
Yes
@Sahilkumar-jc3yl4 күн бұрын
can anyone provide the C++ code with the same logic?