Lowest Number in an Open Range
Updated
Problem statement
You are given an array of positive integers numbers and a two-element array nRange describing a number range whose endpoints satisfy nRange[0] ≤ nRange[1].
Return the smallest value in numbers that lies strictly between the two endpoints. In other words, find the smallest numbers[i] such that nRange[0] < numbers[i] < nRange[1].
If no value satisfies both strict inequalities, return 0.
Function
findLowestInRange(numbers: int[], nRange: int[]) → intExamples
Example 1
numbers = [11,4,23,9,10]nRange = [5,12]return = 9The values strictly between 5 and 12 are 11, 9, and 10. Their minimum is 9.
Example 2
numbers = [1,3,2]nRange = [1,1]return = 0No integer can be strictly greater than 1 and strictly less than 1 at the same time, so the result is 0.
Example 3
numbers = [7,23,3,1,3,5,2]nRange = [2,7]return = 3The qualifying values are 3, 3, and 5. The smallest is 3.
Constraints
1 ≤ numbers.length ≤ 1001 ≤ numbers[i] ≤ 100nRange.length = 2- Both values in
nRangeare positive integers that fit in a signed 32-bit integer. nRange[0] ≤ nRange[1]
More Capital One Online Assessment questions
- Distinct Values on Maximum-Sum FramesOA · Seen Nov 2026
- Branch with the Most FilesOA · Seen Nov 2026
- Earliest Meeting Time for All EmployeesOA · Seen Nov 2026
- Earn the Most 🐝OA · Seen Nov 2026
- Rank Football TeamsOA · Seen Oct 2026
- Count Subarrays Matching a Comparison PatternOA · Seen Oct 2026
- Arithmetic Triplets After QueriesOA · Seen Oct 2026
- Count One-Swap Number PairsOA · Seen Oct 2026
- Sort Adjacent PairsOA · Seen Oct 2026
- Bouncing Diagonal WeightsOA · Seen Oct 2026
Similar questions at other companies
- Build the Task HierarchyPendo · OA
- Missing IntervalsIBM · OAIBM interview questions
- Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Count Valid Square PairsAuxoAI · OA
- Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Two SumAmazon · OA · PHONE SCREEN
- Competition Winner and Runner-Up (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
- Speed Up a Slow FunctionCitadel · OA · PHONE SCREENCitadel interview questions
- Find Words That Can Be Formed by CharactersTabaPay · OA
Capital One interview experiences
- Capital One Coding OA Questions: 3 Experiences
- Capital One Experienced Engineer Power Day and OA: 6 Experiences
- Capital One New Grad OA Questions: 14 Experiences (Part 2 of 2)
- Capital One TDP Agentic Round (AI Coding): 7 Experiences
- Capital One SWE Power Day, Level Not Reported: 6 Experiences
- Capital One TIP Intern OA and Power Day: 13 Experiences