137. Single Number II | Bit Manipulation

leetcode.com/problems/single-...
0:00​ - Question Understanding
1:50 - Approach
6:25 - Code
#coding #dsa #leetcode #daily #programming #cpp #tutorial

Пікірлер: 13

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

    If each one was repeated only two times it would be easier, since in that case I believe XORing the entire array together would give you the single number

  • @deepcodes

    @deepcodes

    Жыл бұрын

    Yes, absolutely!

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

    i did this one before but didnt got any clue of how to do it with constant space now i know

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

    Very well explained

  • @deepcodes

    @deepcodes

    Жыл бұрын

    Thanks for liking

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

    you can use ans = ans | (setBits

  • @deepcodes

    @deepcodes

    Жыл бұрын

    Yes, good thought!

  • @md.marufurrahmanremon3095
    @md.marufurrahmanremon30957 ай бұрын

    Could you please explain why you took ans as long?

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

    Instead of calculating pow every time, we can maintain long long shift and multiply it by 2 each time in the loop. It will save time,ig.

  • @deepcodes

    @deepcodes

    Жыл бұрын

    Yeah, we can.

  • @sarvagyasingh924
    @sarvagyasingh9245 ай бұрын

    will this work on negative numbers ?

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

    bhaiya kon sa pen tab use karte ho aap

  • @deepcodes

    @deepcodes

    Жыл бұрын

    XENX pen tab