Starting from:

$20

Algothon- Dennis the menace Solved

Dennis (AKA            )is famous for his bad behaviour. This time he tries sneak into Wilson uncle's home through a window. Anyhow he is not tall enough. Dennis asked you help him to calculate the max sum Of brick sizes so he can use them to reach to the window.

 

Assuming that you are given bricks sizes as Integers in an Array, You have to calculated max size with exactly N bricks.

In Other words

Given an array Of integers and  number)find the maximum value that can be calculated by summing exactly N numbers.

Example

InputArray- [10, , 5, 20, 4] output- 31

Expl anation

You have to find the max sum which can be calculated using 2 numbers in the array. 11 + 20 31

Input Format

First line is a String with with spaces Second line is an Integer

Constraints

1 < N Array.length Output Format Integer

Sample Input O

 

3

Sample Output O

22

More products