[SOLVED] Algothon- Dennis the menace

20.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

Rate this product

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

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.