Feature #5: Top Brokers

Implementing the "Top Brokers" feature for our "Stocks" project.

Description

The company is doing performance evaluations. Each broker’s increments will be decided based on their level of activity throughout the last quarter. Each broker is assigned a unique ID that can be used to track their progress. Currently, this information is managed using a list. Every time a broker completes a trade, their ID is inserted into this list. Now, the company wants to promote its top k brokers. We have to implement a functionality that will automatically output the top k performers at the end of a quarter.

We’ll be provided with a list of integers representing the brokers’ IDs. Our task is to determine the top k most active brokers based on the number of times their ID occurs in the list.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.