โ† Walmart questions

Modified Kadane's Algorithm with Maximum Sum Less Than K

Filed under Walmart

Given an integer array nums and an integer k, find the maximum sum of a non-empty contiguous subarray such that the sum is strictly less than k. Return -1 if no such subarray sum exists.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Walmart questions

Collected from public candidate posts and coding forums. Updated Nov 2026.