stream of B

Given two integers A and B.

Find and Return the number of A bit numbers which have atleast B contiguous bits as ‘1’ % 10^9 + 7.



Input Format

The first argument given is the integer A.
The second argument given is the integer B.

Output Format

Return the number of A bit numbers which have atleast B contiguous bits as '1' % 10^9 + 7

Constraints

1 <= B <= A <= 60

For Example

Example Input 1:
    A = 5
    B = 1
Example Output 1:
    31
Example Explanation 1:
    Total distinct 5 bit numbers = 32(0.....31)
    All numbers except 0 had atleast 1 bit as '1'
    So, answer is 31 % 1000000007

Input 2:
    A = 8
    B = 8
Output 2:
    1
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving stream of B on Interview Code Editor
Sign Up
to access hints and editorial solutions for stream of B

Discussion


Loading...
Click here to start solving coding interview questions