Highest Rating
Practice
3.2 (15 votes)
Arrays
Hash maps
Hash tables
Hiring
Medium
Problem
78% Success 4690 Attempts 30 Points 1.5s Time Limit 256MB Memory 1024 KB Max Code
Neha and Jenish are good friends . Neha challenges Jenish to find the Highest possible Rating of given array A after applying some queries. According to Neha, Rating of an array is highest occourence of a element in the given array. Jenish is provided with the Magical Number M and Q . For Each element in the given Array A , Jenish can Perform Addition or Subtraction with M atmost Q times .
Since Jenish is so confused and not able to come out with the solution , Help him to find Highest Ratings Possible for Given Array after applying queries to each element.
Input :
- First line of Input contains integer M
- Second line contains integer Q
- Third line contains integer N
- Fourth line contains N elements representing elements of array A
Output :
- Output the highest possible rating of array A after applying Queries.
Constraints :
- \( 1 \le N \le 1000000 \)
- \( 1 \le M \le 100 \)
- \( 1 \le Q \le 10 \)
- \( 1 \le A_{i} \le 1000000 \)
Submissions
Please login to view your submissions
Similar Problems
Points:30
17 votes
Tags:
SortingHashmapImplementationHash TablesData StructuresBasics of Hash TablesHashingMathObservation
Points:30
48 votes
Tags:
Ad-HocAlgorithmsApprovedHash MapsMediumOpen
Points:30
21 votes
Tags:
Data StructuresBasics of Hash TablesHash TablesHashmap
Editorial