ThoughtSpot Off-Campus OA 2025 | Maximum Number of Integers to Choose From Range | Greedy and HashSet

thoughtspot · Question · Posted Jun 2026

Problem Statement You are given: An integer array banned containing numbers that cannot be selected. An integer n, representing the range of available numbers from 1 to n. An integer maxSum. You may choose any number of integers from the range [1, n] such that: The chosen number is not present in the banned array. Each number can be selected at most once. The sum of all selected numbers does not exceed maxSum. Return the maximum number of integers that ...

The full answer & interview discussion are available to premium members.

Log in Create a free account