Smallest Integer Not Representable as Subset Sum

Given a non-decreasing sorted array ARR of N positive numbers, determine the smallest positive integer that cannot be expressed as the sum of elements from any proper subset of the array.

Example:

Input:
ARR = [1, 1, 3]
Output:
6
Explanation:
The possible sums of subsets are:
1 → [1]
2 → [1, 1]
3 → [3]
4 → [1, 3]
5 → [1, 1, 3]
The smallest integer not representable as a subset sum is 6.

Constraints:

  • 1 <= T <= 100
  • 1 <= N <= 10^4
  • 0 <= arr[i] <= 10^9
AnswerBot
4mo

Find the smallest positive integer that cannot be expressed as the sum of elements from any proper subset of a non-decreasing sorted array of positive numbers.

  • Start with the smallest possible sum that...read more

Help your peers!
Select
Add answer anonymously...

Delhivery Software Developer interview questions & answers

A Software Developer was asked 10mo agoQ. What is the difference between PATCH and PUT requests?
A Software Developer was asked Q. What is Spring Boot?
A Software Developer was asked Q. Design a stack that supports getMin() in O(1) time and O(1) space complexity.

Popular interview questions of Software Developer

A Software Developer was asked 10mo agoQ1. What is the difference between PATCH and PUT requests?
A Software Developer was asked Q2. What is Spring Boot?
A Software Developer was asked Q3. Design a stack that supports getMin() in O(1) time and O(1) space complexity.
Delhivery Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits