Find Minimum Time to Reach Last Room 1 & 2 | Leetcode 3341 and 3342

Поділитися
Вставка
  • Опубліковано 15 лис 2024

КОМЕНТАРІ • 9

  • @anirudh6635
    @anirudh6635 9 днів тому

    the second problem gave me a sleep less night but was finally able to solve them both.

  • @munendragaur4965
    @munendragaur4965 10 днів тому +1

    bhai aap har contest ki isi tarah vedio banao bhai

  • @MrZiyak99
    @MrZiyak99 11 днів тому

    slightly confused here should we not mark the node as visited when we dequeue and not when we enqueue?

    • @techdose4u
      @techdose4u  11 днів тому

      If we reach a node for the first time means Greedily that must be shortest path to reach that node.
      So, it doesnt matter if we reach theough any longer path coz we care about shortest path finding only :)
      This is a greedy algorithm.

  • @GuruDaBandaa
    @GuruDaBandaa 10 днів тому

    I think problem statement is not correct ? This is not mention that if current time is less than the next time, we only move with current time + 1.

    • @techdose4u
      @techdose4u  10 днів тому

      They mentioned whats not allowed.
      Everything else is allowed hence had to derive the logic :)
      It could have been more clearly framed though.

    • @GuruDaBandaa
      @GuruDaBandaa 9 днів тому

      @@techdose4u how can I start thinking in that direction ? Please suggest.