0

Interview Question

you are given on integer N and integer array A as the input where N denotes the length of A.write a program to find the product of every element with its next consecutive integers on the number line and return the sum of these products​

20th Feb 2022, 8:21 AM
Vedant Naidu
Vedant Naidu - avatar
2 ответов
0
What if N was an odd number? there could be one orphan number in such case.
20th Feb 2022, 8:53 AM
Ipang
0
Just trying to understand, let's say given an array A = [1,2,3,4] The length of array is N = 4 So the SOP (sum of product) is 1*2+2*3+3*4 = 2+6+12 = 20 Is this what you mean?
3rd Mar 2022, 1:12 PM
Hanz
Hanz - avatar