2.94K subscribers
7 photos
4 files
237 links
This channel is all about programming. Happy coding :)
Download Telegram
Happy new year everyone ❀️ May this new year be healthy, prosperous and joyful for you all πŸŽ‰
𝐇𝐒 π‚π¨ππžπ«π¬!!

Is 𝐆𝐑𝐀𝐏𝐇 algorithm your biggest worry in interview prep ?

Do you want to greatly improve and gain confidence in 𝐆𝐑𝐀𝐏𝐇 algorithms ?

If you answer is π˜π„π’, then you should join our 30 π‘‘π‘Žπ‘¦π‘  πΊπ‘Ÿπ‘Žπ‘β„Ž π‘π‘Ÿπ‘œπ‘π‘™π‘’π‘šπ‘  π‘β„Žπ‘Žπ‘™π‘™π‘’π‘›π‘”π‘’ where I will share 1 problem a day with the solution for the same on next day with a brief on the approach used.

.

It will be posted on our π“πžπ₯𝐞𝐠𝐫𝐚𝐦 channel everyday for the 𝑛𝑒π‘₯𝑑 30 π‘‘π‘Žπ‘¦π‘  from π‰πšπ§ 𝟏𝐬𝐭 (evening).


#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Day-2:
Course Schedule-2: https://leetcode.com/problems/course-schedule-ii/
Leetcode #210

Please go through the algorithm from the link below (Please don’t watch the course schedule part in the 2nd half of the video without solving yourself πŸ™‚ )
Algorithm: Topological Sort -> https://youtu.be/qe_pQCh09yU
Solution will be shared tomm evening followed by a new question πŸ™‚

#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Above problem is for Day-6 πŸ™‚
Day-6: Solution
Number of Provinces
Leetcode #547

Algorithm: Disjoint Set
Code Implementation: https://gist.github.com/SuryaPratapK/fe865b1680aceda9594a5160f80fb870
Video for Disjoint Set (Union & Find): https://youtu.be/eTaWFhPXPz4
Video for Disjoint Set (Union by RANK & Find->Path Compression): https://youtu.be/kaBX2s3pYO4

Logic:-
1 Use disjoint set to add all edges
2 DSUF array will have -1 value for only absolute parents
3 No of -1 = No of absolute parents = No of components (because all absolute parents belongs to different tree, hence different components πŸ™ƒ )

Please go through the video to understand Disjoint Set and then implement in the problem πŸ™‚



#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Day-7: Solution
Evaluate Division
Leetcode #399

Algorithm: Disjoint Set
SOLUTION code: https://gist.github.com/SuryaPratapK/b4ea37a86814d08856b4cd4ef41c640f
Video for Disjoint Set (Union & Find): https://youtu.be/eTaWFhPXPz4
Video for Disjoint Set (Union by RANK & Find->Path Compression): https://youtu.be/kaBX2s3pYO4

LOGIC:
1 Build a bidirectional graph with weight as: (If a=4 and b=2 then, a->b (edge wt=4/2) and b->a (edge wt=2/4))
2 For any given a/c, start traversing from a and try reaching c (a/b * b/c = a/c). Keep multiplying values while traversing.


Please go through the video to understand Disjoint Set and then implement in the problem πŸ™‚


#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa