Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The maximum sum possible is 7 , and 7 modulo (109+7)=7. Function Description Complete the function gerMaxSumo/Array in the editor below. getMax5um OfArray has the
The maximum sum possible is 7 , and 7 modulo (109+7)=7. Function Description Complete the function gerMaxSumo/Array in the editor below. getMax5um OfArray has the following parameter(s): arri[n]: an array of integers arr2[n]; an array of integers Return int the maximum possible sum, modulo (109+7). Constraints - 1n105 - is arrifisiog - is arraidsio - Input Format For Custom Testing - Sample Case 0 Sample Input For Custom Testing STDIN FUNCTION -arri[]sizen=3arr1=[1,2,3]arr2[]sizen=3arr2=[1,10,10] Sample Output 5e Explanation Given n=3,arrf=[1,2,3] and arrz =[10,10,10]. Calculating arr 3 using i * (arr 2[1]arr1[D],arr3=[9,36,21] and its sum will be 47 . If arr 1 is changed to [3,2,1] and arr 2 remains unchanged ie. [10,10,10]. Now the value of i * (arr2[i] arri[i] =[7,16,27], and its sum is 50. In this case, 50 is the maximum sum
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