• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
October 25, 2023 |1.0K Views
SDE Sheet - Power of 2
  Share   Like
Description
Discussion

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

In this problem, we are given, a non-negative integer N. The task is to check if N is a power of 2. More formally, check if N can be expressed as 2x for some integer x. Return true if N is power of 2 else return false.

Example :

Input: 
N = 8
Output: 
YES

Explanation:
8 is equal to 2 raised to 3 (23 = 8).

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/program-to-find-whether-a-given-number-is-power-of-2/
Problem: https://practice.geeksforgeeks.org/problems/power-of-2-1587115620/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More