Highest average
Practice
2.9 (13 votes)
Algorithms
Binary search
Easy
Searching
Searching
Problem
82% Success 5922 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code
Problem Statement :
You are given an array A of length N. You have to choose a subset S from given array A, such that average of S is less than K. You need to print the maximum possible length of S.
Input format :
- The first line of each input contains N, length of array A.
- Next line contains N space separated elements of array A.
- Next line of input contains an integer Q, Number of queries.
- Each following Q lines contains a single integer K.
Output format :
- For each query, print single integer denoting the maximum possible length of the subset.
Constraints :
- \(1 \le N,Q \le 5*10^{5}\)
- \(1 \le A_{i},K \le 10^{9}\)
Submissions
Please login to view your submissions
Similar Problems
Points:20
536 votes
Tags:
Binary SearchData StructuresEasySearching
2.Coins
Points:20
15 votes
Tags:
AlgorithmsBinary SearchEasySearchingTwo pointer
Points:20
12 votes
Tags:
ApprovedBinary SearchEasyGrammar-VerifiedHiringMathSearching
Editorial