Feature #4: Milestone Reached
Explore how to identify the exact day and week a stockbroker reaches a trade milestone by implementing a binary search on a 2D matrix of cumulative trades. This lesson teaches you to efficiently convert matrix indices and optimize the search with logarithmic time complexity and constant space usage.
We'll cover the following...
Description
Our company wants to display high achieving brokers in a hall of fame. They want to find out if a broker reached a milestone of making k trades and, if so, they want to know when they reached that milestone. Stockbrokers have been making trades and recording their tally of completed trades since the start of their career at the company. The data is being recorded into separate log files, each of which can be viewed as a matrix with 5 columns, one for each day of the week. There are r rows, representing the last r weeks of the year. We want to find out when a given broker reached the milestone of k trades in their career.
We’ll be provided with an m x 5 matrix and a target milestone value. Our task is to determine the day and week a stockbroker fulfilled their milestone.
Solution
Each ...