Find if a Number is power of Two

  Рет қаралды 4,481

CppNuts

CppNuts

2 жыл бұрын

JOIN ME
-----
KZbin 🎬 / @cppnuts
Patreon 🚀 / cppnuts
TUTORIALS PLAYLIST
------------
C++ Tutorial For Beginners: • Introduction To C++
STL (Standard Template Library): • STL In C++
ThreadIng In C++: • Multithreading In C++
Data Structures: • Data Structure
Algorithms: • Binary Search
Design Patterns: • Factory Design Pattern...
Smart Pointers: • Smart Pointer In C++
C++14: • Digit Separator In C++
C++17: • std string_view in C++...
C++ All Type Casts: • static_cast In C++
INTERVIEW PLAYLIST
------------
C++ Interview Q&A: • Structural Padding & P...
C++ Interview Q&A For Experienced: • How delete[] Knows How...
Linked List Interview Questions: • Find Kth Node From Bac...
BST Interview Questions: • Search Element In Bina...
Array Interview Questions: • Reverse An Array
String Interview Questions: • Check String Is Palind...
Bit Manipulation Questions: • Find Set Bit In Intege...
Binary Tree Interview Question: • Invert Binary Tree
Sorting Algorithms: • Bubble Sort
C++ MCQ: • Video
C MCQ: • What printf returns af...
C Interview Questions: • Designated Initializat...
Time Lines
=========
0:05 Introduction
0:39 Approach
In this video we will learn how to find the number is power of 2 or not?
This is very easy we can use formula like n&&!(n&(n-1)) and this should give you the result zero if number is power of two.
So we can see that this question can be solved using bit manipulation techniques.
#bitmanipulation #interview #dsa #bits #algorithms

Пікірлер: 4
@enjoythemoment9107
@enjoythemoment9107 3 ай бұрын
Dude explained it, like it was nothing 🔥
@mattloulou123123
@mattloulou123123 2 жыл бұрын
Wow great solution!
@omarious
@omarious 2 жыл бұрын
Simple and amazing
@isdardedilkisifarish3366
@isdardedilkisifarish3366 Жыл бұрын
Superb!
Count number of bits to be flipped to convert a to b
3:36
CppNuts
Рет қаралды 2,5 М.
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 17 МЛН
DAD LEFT HIS OLD SOCKS ON THE COUCH…😱😂
00:24
JULI_PROETO
Рет қаралды 14 МЛН
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 23 МЛН
Powers of 2 - Numberphile
6:10
Numberphile
Рет қаралды 335 М.
Verify if a given number is power of 2 using one line
10:13
Programming with Sikander
Рет қаралды 2,9 М.
One second to compute the largest Fibonacci number I can
25:55
Sheafification of G
Рет қаралды 73 М.
Power of 2 | Leetcode #231 | 4 methods explained
10:17
Techdose
Рет қаралды 38 М.
XOR in a range of numbers
9:08
Techdose
Рет қаралды 4,8 М.
This is How Easy It Is to Lie With Statistics
18:55
Zach Star
Рет қаралды 6 МЛН
GOOGLE Interview Question || Puzzle : 12 Men On An Island || Hard Logic Puzzle
22:01
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 17 МЛН