Little pony summer vaction please give code of this problem

little pony is enjoying his summer vaccation but in the meantime he also wants to be productive and enhance his skills.
there are N days left in the vaccation and there are M types of activities number from 0 to M-1 which he can do during these n days. there is a boredom limit associated with each of these m activites that is he does not want to perfrom i th activiity for more than A[i] consecutive days.
can you find the total number of ways to spend these N days doing exactly one activity on each day?
Two ways are different if there exist a day such that activity done on this day and second way is different.
since the answer is very large, return it modulo 10^9+7.

input format-
the first argument is the integer N.
the second argument is the array A of size M.

output- your function should return an integer corresponding to the answer.

example-
input-1
N=3
M=2
A=[1,2]

input-2
N=5
M=3
A=[4,4,4]

output 1:
4
output 2:
40

Example explanation
since we have 2 choice(let’s say 0 and 1) for each day there are total 8 ways to perfrom this activities.
000-invalid,more than 1 zero’s are together
001-invalid,more than 1 zeros’s are together
010-valid
011-valid
100-invalid,more than 1 zero’s are together
101-valid
110-valid
111- invalid ,more than 2 one’s are together
thus, our answer is .

Hey @sahudilip138
Please share the source of this question

give me one minute i will share their pic

this is an ongoing hiring challenge @sahudilip138
I think u know that already

i don’t know my friend give me this problem and i don’t able to solve so i ask

hello r u there please answer me

Will reply u after that challenge gets over

in how much time the challenge get over and please also tell me how i can approach these problem as i am doing cp course but not able to solve the problem

sir i think now challenge get over now can you explain me

Hey @sahudilip138
Refer to this question ,its variation of that question : https://leetcode.com/problems/dice-roll-simulation

See video soln here https://www.youtube.com/watch?v=MUcOXkcKydw

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.