Question: Given an array arr of size N , you have to find the length of the longest subarray such that product of the elements in
Given an array arr of size N you have to find the length of the longest subarray such that product of the elements in the subarray divided by the factorial of its length is maximized.
Example :
Input:
Output:
Explaination:
We can choose subarray for maximum product of we can see that there is no other subarray of length greater than having product greater than
Example :
Input:
Output:
Explaination:
The subarray with maximum such value is
Your Task:
You don't need to read input or print anything. Your task is to complete the function longestBeautifulSubarray which takes the array of integers n and arr as parameters and returns an integer, denoting the answer.
Constraints:
N
arri Write the c code
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
