...

/

DIY: Find Maximum Sum from Either End of an Array

DIY: Find Maximum Sum from Either End of an Array

Problem statement

For this challenge, you are given an array of integers, nums, and a positive integer, k. Your job is to find the maximum sum obtained from the k elements of the array. However, there is one condition: you cannot pick k elements at random. You can only remove elements one by one from either side of the array to add to the total sum. ...

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy