• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
October 25, 2023 |300 Views
SDE Sheet - Find first set bit
  Share   Like
Description
Discussion

This video is part of the Bit Manipulation section under the GFG SDE Sheet.

In this problem, we are given, an integer N. The task is to return the position of the first set bit found from the right side in the binary representation of the number.
Note: If there is no set bit in the integer N, then return 0 from the function.  

Example :

Input: 
N = 18
Output: 
2

Explanation: 
Binary representation of 18 is 010010, the first set bit from the right side is at position 2.

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-

Article: https://www.geeksforgeeks.org/position-of-rightmost-set-bit/
Problem: https://practice.geeksforgeeks.org/problems/find-first-set-bit-1587115620/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More