Given an integer array, filter the array by upper and lower bounds. Return the number of combinations in the array size >= K.
Example:
Input:
N = 6
arr = [5, 8, 9, 10, 1, 3]
lowerBound = 2
upperBound = 9
K = 3
Output:
5
Explanation:
Filter the array: [5, 8, 9, 3].
There are five combinations with minimum 3 numbers: [5, 8, 9], [5, 8, 3], [5, 9, 3], [8, 9, 3], [5, 8, 9, 3].
Return 5.
Get one-to-one training from Google Facebook engineers
Top-notch Professionals
Learn from Facebook and Google senior engineers interviewed 100+ candidates.
Most recent interview questions and system design topics gathered from aonecode alumnus.
One-to-one online classes. Get feedbacks from real interviewers.
Customized Private Class
Already a coding expert? - Advance straight to hard interview topics of your interest.
New to the ground? - Develop basic coding skills with your own designated mentor.
Days before interview? - Focus on most important problems in target company question bank.