How to Reverse Bits of a number - Bit Manipulation Interview

preview_player
Показать описание
In this video, we learn how to reverse bits of a given number using Bit manipulations concepts. This is a frequently asked interview question for software firmware embedded roles. This is a popular question on online coding platforms as well such as LeetCode 190.

See Bit Manipulation Interview Preparation Series here:

#BitManipulation #BitAlgorithm

You could follow us on Facebook and Instagram:

Given a number A, we want to store the bits of A in reversed order in B.
So, the leftmost bit in A would become the rightmost bit in B. And the rightmost bit in A would become the leftmost bit in B.
Just a brief background, this function is usually available to us developers in the form of an Intrinsic Function, which basically means that the hardware provides us with an API that does this task very efficiently for that particular hardware.
But since we also have to use this function quite a lot in a simulation environment as well, we occasionally end up implementing this function.
First we look into a solution for this problem and then have some optimization discussions.
Рекомендации по теме