• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
October 31, 2023 |400 Views
SDE Sheet - Longest Consecutive 1’s
  Share   Like
Description
Discussion

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

In this video, we are given, a number N. Find the length of the longest consecutive 1s in its binary representation.

Example :

Input: N = 14
Output: 3

Explanation: 
Binary representation of 14 is 1110, in which 111 is the longest consecutive set bits of length is 3.

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/length-longest-consecutive-1s-binary-representation/
Problem: https://practice.geeksforgeeks.org/problems/longest-consecutive-1s-1587115620/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More