Feature #3: Goals Fulfilled
Explore how to analyze stock trading logs to determine if each intern fulfilled their daily trade goal of at least three trades. Learn to use frequency and auxiliary maps to identify consecutive trade subsequences efficiently, ensuring accurate validation of trade data under real-world constraints.
We'll cover the following...
Description
Our stock trading company is hiring interns. Different interns start on different days. Each intern is given a target to close at least three trades on any given day and log these trades using automatically incrementing sequence numbers. Each intern will close trades numbered 1, 2, 3, .... Since different interns have spent a different number of days on the job at any given time, one may be closing trade number 2 while another is closing trade number 23.
Before you arrived, a developer wrote a logging application for the interns. The application accepts trades sequence numbers from the interns and stores them in a centralized log. The logs keep separate records for each day. Unfortunately, the developer didn’t include the intern IDs in the log records. To complicate matters further, the developer sorted the list of trade numbers before storing it in the log. For example, consider a day on which three interns were working. They logged the following trades: [1, 2, 3, 4], [4, 5, 6] and [10, 11, 12]. The log for this day would say [1, 2, 3, 4, 4, 5, 6, 10, 11, 12].
Given a day’s record log, we want you to ...