Limited Time Offer:Up to 20% off Hello Interview Premium
Up to 20% off Hello Interview Premium 🎉
Hello Interview
Your Dashboard
System Design
Code
Low Level Design
Behavioral
AI Coding
New
ML System Design
Salary Negotiation
Interview Guides
Blog
System Design
Low Level Design
AI Coding
Behavioral
New
Interview Questions
Success Stories
System Design
Low-Level Design
New
Ask The Community
Discord
Mock Interviews
1:1 Mentorship
Refer a Friend
Pricing
Sign in / Sign up
Search
⌘K
Pricing

Tutor

Maximum Sum Subarray from Ends

Given an array of integers and an integer k, find the maximum possible sum by selecting exactly k elements from either the front or back of the array without skipping elements. Elements can only be picked consecutively from the beginning or end of the array.

Asked at:

Oracle


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Company
​
Level
All Regions
Region

Early February, 2026

Oracle

Senior

You are given an array of integers nums and an integer k. You must pick exactly k elements from the array. At each step, you may pick only from the front or the back of the array. However, you cannot skip elements: To pick an element at index i from the front, all elements before it must already be picked. To pick an element at index j from the back, all elements after it must already be picked. Goal: Return the maximum possible sum of the k selected elements. Example nums = [1, 8, 2, 0, 9, 3] k = 3 Ans = 13 Possible selections: Pick all 3 from the front: 1 + 8 + 2 = 11 Pick 2 from the front, 1 from the back: 1 + 8 + 3 = 12 Pick 1 from the front, 2 from the back: 1 + 3 + 9 = 13 Pick all 3 from the back: 3 + 9 + 0 = 12

Your account is free and you can post anonymously if you choose.

Hello Interview Premium

Recent interview questions
System Design Guided Practice
Exclusive content
Learn More
Questions
Meta SWE Interview QuestionsAmazon SWE Interview QuestionsGoogle SWE Interview QuestionsOpenAI SWE Interview QuestionsEngineering Manager (EM) Interview Questions
Learn
Learn System DesignLearn DSALearn BehavioralLearn ML System DesignLearn Low Level DesignGuided Practice
Links
FAQPricingGift PremiumHello Interview Premium
Legal
Terms and ConditionsPrivacy PolicySecurity
Contact
About UsProduct Support

7511 Greenwood Ave North Unit #4238 Seattle WA 98103


© 2026 Optick Labs Inc. All rights reserved.