Course Schedule II | LeetCode 210 | C++, Java, Python
HTML-код
- Опубликовано: 20 окт 2024
- LeetCode Solutions: • LeetCode Solutions | L...
June LeetCoding Challenge: • Playlist
May LeetCoding Challenge: • Playlist
Github Link: github.com/Kno...
*** Best Books For Data Structures & Algorithms for Interviews:*********
1. Cracking the Coding Interview: amzn.to/2WeO3eO
2. Cracking the Coding Interview Paperback: amzn.to/3aSSe3Q
3. Coding Interview Questions - Narasimha Karumanchi: amzn.to/3cYqjkV
4. Data Structures and Algorithms Made Easy - N. Karumanchi: amzn.to/2U8FrDt
5. Data Structures & Algorithms made Easy in Java - N. Karumanchi: amzn.to/2U0qZgY
6. Introduction to Algorithms - CLR - Cormen, Leiserson, Rivest: amzn.to/2Wdp8rZ
*****************************************************************************
July LeetCoding Challenge | Problem 18 | Course Schedule II | 18 July,
Facebook Coding Interview question,
google coding interview question,
leetcode,
Course Schedule II,
Course Schedule II c++,
Course Schedule II Java,
Course Schedule II python,
Course Schedule II solution,
210. Course Schedule II,
#CodingInterview #LeetCode #JulyLeetCodingChallenge #Google #Amazon #CourseSchedule #TopologicalSort
We can take an array of size = numCourses and fill it from last, keeping a track using an index.
Sir your vids are really good, just that next time can you please start with JAVA? Just a personal request.
Will keep in mind.
Dhanyawaad
areee marathi manus bhetla bhava
thank you!
Welcome!
Can u plz have a look on Longest Palindromic substring (leet code 5). I have a doubt on that.
Posted my response there.
"This is not Odd length. Odd and Even cases are for Odd and Even length palindrome and not input. Here palindrome is "bb", which is even."
Do you have any video explaining the basics of topological sorting ?
Not yet. Plan to add this week.
@@KnowledgeCenter Thanks
I wish I could be like you, who are so proficient in three programming languages (probably more) , I am only proficient in Java.
1 language is good enough.
what is the time and space complexity?
why are we setting visited[u] = 2 in dfs?
2 means we are done with that node, and will never visit that again. These will also not be used for cycle detection.
For more explanation check the video on Cycle Detection in Directed Graph, in the Graphs playlist. ruclips.net/video/1CdgY5KTQQE/видео.html
@@KnowledgeCenter oh got it. Thanks
for(int[] courses : prerequisites)
adj[courses[1]].add(courses[0]); Can you explain this loop? Like how to read this?
[a, b] means course a is dependent on b. So, first take course b then course a.
Or, there is an edge from b to a : b --> a
So, a is in adjacency list of b.
Here, a = courses[0], b = courses[1]
@@KnowledgeCenter Thanks alot!
Can't we do using bfs
Yes. Top. sort can be done using BFS also.
The C++ solution results in TLE
Sorry, I forgot to pass the adjancy list with an '&' in the function declaration