Missing Number | Multiple Approaches | Leetcode 268

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

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

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

    Hello, a simple way to solve this is by using the 1st approach sir mentioned in the video: class Solution {
    public:
    int missingNumber(vector& nums) {
    int n=nums.size();
    int sum=n*(n+1)/2;
    int s=0;
    for(int i=0;i

  • @sauravchandra10
    @sauravchandra10 8 หลายเดือนก่อน +1

    We can also use cyclic sort in this problem, which is both time and memory efficient.
    Code:
    class Solution {
    public:
    int missingNumber(vector& nums) {
    int n = nums.size();
    int i = 0;
    for(;i

  • @ugcwithaddi
    @ugcwithaddi 8 หลายเดือนก่อน +1

    Well explained as always

  • @learnwithazhar1703
    @learnwithazhar1703 8 หลายเดือนก่อน +1

    Amazingly explained!

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

    good explanation sir.one correction in java code in 3rd approach int result =n;

  • @oqant0424
    @oqant0424 8 หลายเดือนก่อน +1

    solved on my own using 2 approaches
    came here to learn something new
    Thanks
    POTD DONE[20.2.24] ✅✅

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

    when we do l m){//we are on res idx or res is on left
    r = m;
    }
    else{//everything is fine till this idx,check for next
    l = m+1;
    }
    }
    return l or r doesn't matter;

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

    Thank mik. if you get time, can you please post weekly contest Qn-4 of this week

  • @TheBusaSinger
    @TheBusaSinger 8 หลายเดือนก่อน +1

    Thanks for this!

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

    Bhaiya bit manipulation pe bhi playlist bana do pls

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

    Thanks a lot bhaiya ❤❤

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

    Great video 👌🏻

  • @adik3680
    @adik3680 8 หลายเดือนก่อน +1

    Please make the pending video on delete implementation in trie.

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

    @codestorywithmik. I have a doubt if we store 0 in res instead of n this code is not working why so is any other way to make changes in code if we want to store 0 in res instead of n
    one more how we will come to know in these types of questions whether we have to store n in result or 0 in res
    plz reply bro

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

    Hello bhaiya . Can u please make a video on q no.4 of leetcode biweekly 124...which happened on last saturday. Thanks.

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

    amazing !

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

    Niceee. Thanks

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

    can we solve this question by using hash sets, since one main property of hash sets is we cannot add repeated numbers and that way the time complexity will also be O(1)

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

      Yes but space will become O(n)

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

    can any one tell me when we use sort(v.begin(, v.end()) in c++ which type of sort it is? we take worst case complexity as nlogn then what is best case and average case ?

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

    sir please leetcode ques number 621 (Task Scheduler) bata dejiye

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

    ❤❤

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

    bhaiya jo 3rd approach me code likha h vha O(nlogn) time complexity nhi aaeggi