A-C | Leetcode Weekly Contest 409 Editorials | Shortest Distance After Road Addition Queries

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

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

  • @TanmayKhandelwal-z9v
    @TanmayKhandelwal-z9v 3 หลายเดือนก่อน +5

    The main observation in question 3 was ->There are no two queries such that queries[i][0] < queries[j][0] < queries[i][1] < queries[j][1]. as if there is a query 3,7 then no query will intersect its middle elements...means its like x,y

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

      Kuch doubt ke answer comment me mil jate hai 😃. i tested this 3rd solution in 2nd but wo queries wala samj hi nai aya us chakkar me it was WA.

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

      Yes, right

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

    Very Very Helpful...........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

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

      Glad you loved it, thanks

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

    Thanks for 3rd explanation sir !!

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

      Welcome

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

      ​@@AbhinavAwasthi Great video editorial Sir!! But, what was the intuition of using a set in problem 3 ? The middle nodes are of no use to me for calculating the shortest path, that's OK, but how to proceed from this observation to actually implementing the solution ??

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

      @@priyanshkumar17 because we only want unique paths + the paths are from 0 to n-1 therefore it makes more sense & the most important the way we are erasing the elements in between can only be done by set with small code size , inbuilt functions and without any heavy logic/implementation to perform this logic in comparison to using any other data structure . Simply , set for crispier , clearer & concise soln ; )

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

      @@RajeevCanDev thanks 🙏

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

    Solutions were crisp and concise. easy to understand for a beginner too.

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

    Thank You So Much for this wonderful video...............🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

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

      Glad you loved it, thanks

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

    Tq for the explanation ❤

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

      Glad you loved it, welcome

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

    your approaches intuitive thnx a lot for uploading

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

      Glad you loved it, thanks

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

    what an amazing solution for the third one! your approaches are always intuitive and fresh!

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

      Glad you loved it, thanks

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

    It was very helpful!!

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

      Glad you loved it, thanks

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

    Helpful. keep it bro..very helpful for people like us

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

      Glad you loved it, thanks

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

    Nice Explanation Sir !!

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

    great work

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

      Glad you loved it, thanks

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

    There is one differece between between question2 and 3 is that
    question2 can have overlapping edges in queries but question3 can't
    Thats way question3 solution 3 solution is not working for question2

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

    you are not mention important condition in question3 , what if 2 queries are intersect to each other . this solution is only valid if no queries intersect each other.

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

      If you see the constraints of the problem, it is already mentioned that:
      There are no two queries such that i != j and queries[i][0] < queries[j][0] < queries[i][1] < queries[j][1].

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

    Sir, can we solve the 3rd question using segment tree?

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

      Actually I tried solving, maybe it can be done, but it's not required because better ways are present

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

    why dijkstra, use BFS, as edges are unit weights

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

    Why we are finding lower bound and upper Bound

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

    Can we not solve 2 and 3 using approach for Jump game standard question?
    If not, why?

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

      You can solve it by using DP but the problem is Time complexity. In Jump game problem you just traverse the array only once but here you need to traverse for each queries that has been added new...The nodes are just assumed like index you can indeed traverse..But again time complexity.. Problem 2 can be solved but problem 3 is heavy constraint...

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

      Can you share the complete logic

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

    i was expectiong solutions of 410th contest but i am really disappointed and i am still unable to solve 2nd problem of the contest
    please post solution of the contest if you really want to help the community

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

    I used brute force approach for question 4
    But TLE maar gaya 😂
    #include
    using namespace std;
    class Solution {
    public:
    vector numberOfAlternatingGroups(vector& colors, vector& queries) {
    vector ans;
    int n = colors.size();
    for (const auto& query : queries) {
    if (query[0] == 2) {
    colors[query[1]] = query[2];
    }
    else if (query[0] == 1) {
    int k = query[1];
    int count = 0;
    if (k

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

      Due to n3

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

      Ohh, yeah time complexity is higher

  • @xhortsclub
    @xhortsclub 19 วันที่ผ่านมา

    this is not actual or right explanation for b problem however code is right, and explanation is valid for c problem because question mention "There are no two queries such that queries[i][0] < queries[j][0] < queries[i][1] < queries[j][1]." but for b problem explanation is wrong ,suggests not go through this explanation

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

    sir map toh 3 value ka liya h or dali usme index h
    ki value h 3 value kha dali

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

    How to come up with intuition for q3?

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

      It was an observation based solution, so try to write things on paper and think

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

    The lower and upper bound functions are implemented as follows :
    lower_bound(value): Returns an iterator pointing to the first element in the set that is not less than (i.e., greater or equal to) the given value.
    upper_bound(value): Returns an iterator pointing to the first element in the set that is greater than the given value.
    We aren't finding upper_bound of 8 or lower_bound of 3, instead, if you observe the parameters passed to the functions carefully, we find the upper bound of 7 which is in this case 7, and the lower bound of 4 which is 4 in this case. Please don't encourage students to blindly copy solutions without understanding them. And as an educator, it is your most crucial responsibility to share the correct information. Please do not rob students of an opportunity to deepen their conceptual understanding and learn accurate facts.

    • @AbhinavAwasthi
      @AbhinavAwasthi  3 หลายเดือนก่อน +6

      Hey, I think you watched the incomplete video, I corrected my mistake later in the video
      I think, an educator can also make some mistakes sometimes, but I have fixed it later, can you please watch completely
      Also, I totally understand the meaning of lower and upper bound

    • @TanmayKhandelwal-z9v
      @TanmayKhandelwal-z9v 3 หลายเดือนก่อน

      ​@@AbhinavAwasthi I always see your editorials sir..Your explainations are best..Please dont mind his /her language..You explaination is correct..

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

      watch complete video bro