Single Number II | leetcode 137 | Hindi

liked this video? Click here / @codebix1096 join our facebook group :- / 258049468776636
problem :- leetcode.com/problems/single-...
code :- github.com/luckykumardev/leet...

Пікірлер: 54

  • @pcvermatipstricks472
    @pcvermatipstricks4722 жыл бұрын

    but sir, this is working only for positive numbers and giving error in case of Negative numbers

  • @DFactoPedia
    @DFactoPedia Жыл бұрын

    Complexity is like sorting, logn is almost = 32 for +ve integers

  • @explorerars4208
    @explorerars4208Ай бұрын

    Very nice explanation sir

  • @udaypandey5659
    @udaypandey5659 Жыл бұрын

    Kya bat h bhai , very simple and clear explanation.

  • @aadil4236
    @aadil4236 Жыл бұрын

    Very well explained.

  • @rohitmahajan3725
    @rohitmahajan37253 жыл бұрын

    Sir, please increase the font size while showing the code. Also thank you so much for the best explanation.

  • @codebix1096

    @codebix1096

    3 жыл бұрын

    Ok Noted Thank you. Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true

  • @rishikeshkumarsingh3283
    @rishikeshkumarsingh32834 жыл бұрын

    finally, understand this problem completely

  • @codebix1096

    @codebix1096

    4 жыл бұрын

    keep learning :)

  • @codebix1096

    @codebix1096

    4 жыл бұрын

    join this facebook group to get updates of upcoming videos and discussions facebook.com/groups/258049468776636/about

  • @prashantsahu6212
    @prashantsahu6212 Жыл бұрын

    sir how it is handling negative numbers i am still confuse little bit

  • @dr.darkfurygaming9174
    @dr.darkfurygaming91744 жыл бұрын

    I found this question is very easy I solved this question by using dictionary (Associated Array) Which is 99.8%faster than others

  • @khushalpujara

    @khushalpujara

    4 жыл бұрын

    The challenge is to solve this in O(1) Space

  • @codebix1096

    @codebix1096

    4 жыл бұрын

    join this facebook group to get updates of upcoming videos and discussions facebook.com/groups/258049468776636/about

  • @ayushkapri9082
    @ayushkapri90823 жыл бұрын

    Awsm..work

  • @codebix1096

    @codebix1096

    3 жыл бұрын

    Glad you think so! please share this channel with your friends and/or colleagues

  • @NirajKumar-nu4lb
    @NirajKumar-nu4lb2 жыл бұрын

    the above solution will not work for negative integers

  • @akshatjain6854
    @akshatjain68544 жыл бұрын

    Gjab bhai ...Bhai tum konsa tool use krte ho for writing on screen . kitne ka khrida

  • @codebix1096

    @codebix1096

    4 жыл бұрын

    i use openboard software it is opensource software

  • @codebix1096

    @codebix1096

    4 жыл бұрын

    and wacom 672 tablet 8-9k ka tha shyad

  • @akshatjain6854

    @akshatjain6854

    4 жыл бұрын

    @@codebix1096 itna mehnga, koi sasta hain kya iss se 1-2k k around

  • @codebix1096

    @codebix1096

    4 жыл бұрын

    @@akshatjain6854 nhi 1-2k ka to shyad koi nhi h

  • @akshatjain6854

    @akshatjain6854

    4 жыл бұрын

    @@codebix1096 ok

  • @rechinraj111
    @rechinraj1114 жыл бұрын

    nums[j] >> i will it give me bits from last in each iteration? How ?

  • @tusharjaiswal3133

    @tusharjaiswal3133

    4 жыл бұрын

    this will shift the bits of nums[j] to the right i times and performing "&1" with this will give whether the bit is 1 or 0

  • @PROTECHRAHUL

    @PROTECHRAHUL

    2 жыл бұрын

    @@tusharjaiswal3133 but how it is setting 1 or 0 in ans at the bottom .

  • @tusharjaiswal3133

    @tusharjaiswal3133

    2 жыл бұрын

    @@PROTECHRAHUL OR operation is being performed at the ans after shifting sum "i" times to the left

  • @PROTECHRAHUL

    @PROTECHRAHUL

    2 жыл бұрын

    @@tusharjaiswal3133 bhai thoda detail me btado please nhi samj aaya ,baaki sab samj aa gya h bus woh last me or wala nhi aaya. Please thoda detail me btado last ans wali line kaise kaam kr rhi h

  • @tusharjaiswal3133

    @tusharjaiswal3133

    2 жыл бұрын

    @@PROTECHRAHUL 1. value of sum will be either 0 or 1 for any case. 2. left shifting 1 "i" times will give 2 ^ i 3. initially ans was 0 (line 3 in the code) 4. when you perform or operation : (ans || 2 ^ i) then i-th bit will be set (line 13) 5. Similarly for all the i values for which the sum is 1 the i-th bit will be set

  • @shivikasharma11
    @shivikasharma114 жыл бұрын

    What about -ve integers? How will you update this code to consider -ve integers as well.

  • @dipanshukumrawal4880

    @dipanshukumrawal4880

    2 жыл бұрын

    Updated code:- int res=0; for(int i=0;ii) & 1) == 1){ sum++; } } sum%=3; if(sum!=0){ res=res|sum

  • @TheBangTelevison
    @TheBangTelevison4 жыл бұрын

    easiest way to solve this prob is by using a hash map then return the key corresponds to value 1: class Solution: def singleNumber(self, nums: List[int]) -> int: d = {} for items in nums: if items not in d: d[items] = 0 d[items] += 1 for k,v in d.items(): if v == 1: return k return 0

  • @codebix1096

    @codebix1096

    4 жыл бұрын

    It is given in the question that we can't use extra space

  • @TheBangTelevison

    @TheBangTelevison

    4 жыл бұрын

    @@codebix1096 ohh sorry i missed that part

  • @dr.darkfurygaming9174

    @dr.darkfurygaming9174

    4 жыл бұрын

    This is mine Your solution same as mine leetcode.com/explore/challenge/card/june-leetcoding-challenge/542/week-4-june-22nd-june-28th/3368/discuss/700141/python3.5-easy-to-understand-plus-beat-99-solution-using-dictionary

  • @dr.darkfurygaming9174

    @dr.darkfurygaming9174

    4 жыл бұрын

    @@TheBangTelevison pls upvote my solution

  • @akshatjain6854

    @akshatjain6854

    4 жыл бұрын

    If that was the soln to this problem , we would have never come here

  • @tusharjaiswal3133
    @tusharjaiswal31334 жыл бұрын

    if any number is negative then this method won't work

  • @codebix1096

    @codebix1096

    4 жыл бұрын

    no i think this should work [2,2,-3,2] [-2,-2,3,-2] [-2,-2,-3,-2] try these testcases on leetcode with same logic

  • @vishalrao3529

    @vishalrao3529

    4 жыл бұрын

    @@codebix1096 yes it is working correctly!!

  • @tusharjaiswal3133

    @tusharjaiswal3133

    4 жыл бұрын

    @@codebix1096 how are we able to handle the parity of the numbers ?

  • @tusharjaiswal3133

    @tusharjaiswal3133

    4 жыл бұрын

    the term sum will always be positive so when we will or the sum after shifting it with the ans then ans will be positive as well

  • @pcvermatipstricks472

    @pcvermatipstricks472

    2 жыл бұрын

    @@codebix1096 in python i wrote the same code, giving wrong answer in case of negative numberss

  • @wrishavbhattacharyya5216
    @wrishavbhattacharyya5216 Жыл бұрын

    But this is worse than NlogN as 32×N is greater than this

  • @jiganeshpatil1472

    @jiganeshpatil1472

    Жыл бұрын

    wrong

  • @abhijitbarik6669
    @abhijitbarik66692 жыл бұрын

    tujse accha mai code explain kar deta hu.a bawasir video type mat bana vai .main portion to tu explain nehi kiya

  • @jiganeshpatil1472

    @jiganeshpatil1472

    Жыл бұрын

    banao phir