Question: 0 0 : 0 1 : 4 5 : 3 6 Problem 9 . Submissions Python 3 Find Bits Accuracy 2 5 . 0 9

00:01:45:36
Problem
9. Submissions
Python 3
Find Bits
Accuracy 25.096
Submisvions: 4 t
Peints: 10
You are given 2 positive numbers n and x. Your task is to find out the number of i such that 0i2n and have bitwise-and with x equal to x itself given that 1x2n
Formally : Find out the number of i such that isx =x given that 11,x2n
Example 1:
Input:
n=4
x=3
Output : 4
Explanation :
For the values of .15 bitwiscerand of i with )=(3 wall gowe x tselt
Example 2:
n=4
x=15
Output: 1
0 0 : 0 1 : 4 5 : 3 6 Problem 9 . Submissions

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!