Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Jim and Pam were sitting in a Park when Pam booked a Uber ride to go back home. The app showed 5 mins of ETA
Jim and Pam were sitting in a Park when Pam booked a Uber ride to go back home. The app showed mins of ETA for the cab to arrive at their location so she thought of sharing a new idea with Jim to tease Dwight next day.
Pam has a magical array A of size N which satisfies conditions:
All the Elements in A are greater than or equal to L and smaller than or equal to R ie L Ai R
The sum of all the elements of array A is divisible by
Since the Uber driver came early pam left without sharing the actual array with Jim. So now Jim started thinking how many such magical arrays are possible.
Help Jim by finding how many such arrays are possible for given integers N L and R as input.
Since the answers may be large, return it with modulo
Constraints:
N
L R
Sample:
Input:
Output:
Explanation: only are possible with given NLR which satisfies both the conditions
execution time limit seconds c
memory limit GB
input integer n
The size of the array
input integer I
Lower limit for each array element
input integer r
Upper limit for each array element
output integer
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started