Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 solve in c no chatgpt please
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