Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
694 views
in Online Assessments by Expert (34,270 points) | 694 views

1 Answer

0 like 0 dislike
Design a function which given an array input, numbers return sum of all possible odd-length (lenght 1 3 5 ...) combination of elements.
you may assume the array has all unique numbers.
eg
input [2,3,10,7]
output 88
2 - 2
3 - 3
10 - 10
7 - 7
[2,3,10] = 15
[2,3,7] = 12
[2,10,7] = 19
[3,10,7] = 20
if we add all together we get 88.
by Expert (34,270 points)