Paypal | OA | 2021 YOE - 6 SDE2 role
Anonymous User
1596

There are n object numbered from 1 ..n . You can color each object with either 0 or 1 . Find the number of ways you can color the object such that the distance between two same colors is atmost K .

Example
K = 2
N = 5
Answer - 4

00011
11100
00111
11000

Constrains -
K : 0 < K <= 10^4
N : 1 <= N <= 10^9

Comments (5)