Daily LeetCode Challenge (Day 42): Path with Maximum Probability

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

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

  • @EverAfterBreak2
    @EverAfterBreak2 2 หลายเดือนก่อน +1

    4 straight hours lol

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

      Haha yeah… 😵‍💫 I realized my mistake later on, where I had good intuition in that with a correct heap implementation of Dijkstra’s I could reduce the problem from O(n^2) time to O((n+m)logn) time, by keeping at most O(n+m) elements in the heap at a time. The heap implementation is only worse when the graph is dense (i.e. m = O(n^2)), but for this problem we were given that n

    • @EverAfterBreak2
      @EverAfterBreak2 2 หลายเดือนก่อน +1

      Haven’t seen the video yet, but I will after work, I’ll try to learn how you applied Dijkstra and heaps

    • @alejandroill
      @alejandroill  2 หลายเดือนก่อน +1

      Hahaha, it’s always works that gets us 😵‍💫 And sounds good, let me know if there’s anything more I can clarify, I’m always super happy and ready to help when needed 🥰😁