Course Schedule IV - Leetcode 1462 - Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ก.ย. 2024

ความคิดเห็น • 21

  • @kamila5207
    @kamila5207 8 หลายเดือนก่อน +3

    hey @NeetCodeIO, you ordering pairs in prerequisites from right to left, but in explanation of this task on Leetcode there are direction from left to right, is it mistake of Leetcode platform or yours?

    • @paras9392
      @paras9392 6 หลายเดือนก่อน

      Here neetcode's explanation A -> B does not indicate that A is a prerequisite of B (like what this notation meant e.g. in course schedule I and II problem) instead the arrow here indicates all the nodes which are (direct) prerequisites of A. So here we are analyzing the inverted relationship i.e. instead of looking for all the nodes which are prerequisite of a node, we are looking for all the direct prerequisite nodes of a particular node .

  • @chair_smesh
    @chair_smesh ปีที่แล้ว +3

    Is there a method to which new problems you upload? Or do you just upload whatever problem you’re practicing at the time?

  • @monicawang8447
    @monicawang8447 หลายเดือนก่อน

    What's the space complexity? Is it the same as the time complexity?

  • @ray811030
    @ray811030 9 หลายเดือนก่อน

    Once you use hashmap to store what nodes that current node can reach, time complexity of running DFS can be O(N+E) instead O(N(N+E))?

  • @cooltomcatty
    @cooltomcatty ปีที่แล้ว +1

    I have been following these course schedule problems but one thing i didn't understand is how is the time complexity O(P+N)?? Can someone explain??

    • @theJasin
      @theJasin ปีที่แล้ว +1

      You’re only visiting the nodes and edges once which makes it O(V+E)

  • @theJasin
    @theJasin ปีที่แล้ว +5

    I think Kahns is more straightforward

  • @sambro890
    @sambro890 ปีที่แล้ว

    Hey NeetCode … you know what? You are the best…

  • @cosepeter2197
    @cosepeter2197 ปีที่แล้ว

    Hey Neet,
    can you make video on how to stay ahead with rise of AI as a programmer?

  • @cocodinary
    @cocodinary 2 หลายเดือนก่อน

    Help: looking for solution of leetcode 1203: sort-items-by-groups-respecting-dependencies

  • @yang5843
    @yang5843 ปีที่แล้ว +1

    class Solution {
    Map set = new HashMap();

    public List checkIfPrerequisite(int numCourses, int[][] prerequisites, int[][] queries) {
    List list = new ArrayList();
    Map map = new HashMap();
    for (int i=0;i

  • @yang5843
    @yang5843 ปีที่แล้ว +2

    Today's problem can be found here: th-cam.com/video/K-RYzDZkzCI/w-d-xo.html

  • @aaditya_87
    @aaditya_87 5 หลายเดือนก่อน

    can we use union find ?

    • @bluesteel1
      @bluesteel1 3 หลายเดือนก่อน +1

      You cannot use union find in directed graphs

  • @wallyyu5426
    @wallyyu5426 6 หลายเดือนก่อน

    made it so easy

    • @wallyyu5426
      @wallyyu5426 6 หลายเดือนก่อน

      interviewing amazon intern tomorrow, this video will help me get that offer!