Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
2,468 views
-> Given an array of size N ;  find the maximum sum subarray which has a difference of "k" between the start and end elements of the array

N = 8

K = 5

1 5 -5 8 8 8 10 15

Output - [5 -5 8 8 8 10] = 34. (also difference b/w start and end element is abs(5-10) = 5

1 <= K <= 100000

1 <= N <= 100000

If there is no subarray with positive then print 0
in Interview-Experiences by Expert (108,170 points)
edited by | 2,468 views

Please log in or register to answer this question.

Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .