#24 Swapping pairs make sum equal | Data Structures and Algorithms Interview question | Hashing #2

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ส.ค. 2024
  • In this video, we will see how to solve the above question, which is asked in many company interviews.
    Data Structures and Algorithms Interview question playlist:
    • Data Structures and Al...
    You can practise those questions from here: practice.geeks...
    And if this link doesn't work just google "question_name gfg practice".
    Also if you have any doubts, pls mention them in the comment box.

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

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

    But bhaiya here in expected space complexity is constant but you have used map

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

      Good Uday, that you noticed that point.
      HINT
      It can be done in O(1) space, sort both the array and give it a try.
      Some IMP info:
      See Interviewer will not ask you specifically to do it in O(nlogn+mlogm).
      So if you give him even better approach, for ex O(n). Then little increase in space complexity can be accepted.
      So you should be free to play with time and space complexity as per the interviewer requirement.

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

    didnt understood the corner case

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

      Corner case referring to odd number.
      If we divide odd number by 2 then it would come in decimal, causing invalid case.
      So we are taking it to be even number.
      Tanisha let me know if further clarification is needed?

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

    great approach bhaiya , amazing , bhaiya can i get your linkedi n to connect ?