This video explains a very interesting bit manipulation problem asked in interviews which is to find complement of a given number. In this problem, complement means that you need to flip each bit. If current bit is 1 then make it 0 and vice versa. After flipping all the bits, you will find a resultant new number which you need to return. There are many ways to solve this problem. I have shown the solution using a very specific technique called bitmasking. You can also solve it by using XOR instead of bitwise AND. I have first explained the intuition and process for the problem and finally at the end, i have explained the CODE. CODE LINK is present below as usual. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
CODE LINK: https://gist.github.com/SuryaPratapK/...
On this page of the site you can watch the video online Number complement | Leetcode with a duration of hours minute second in good quality, which was uploaded by the user Techdose 04 May 2020, share the link with friends and acquaintances, this video has already been watched 18,197 times on youtube and it was liked by 315 viewers. Enjoy your viewing!