Question
Programming Challenge Description: IBM is implementing a streaming analytics service for an online retailer to provide data on the best time to sell specific products.
Programming Challenge Description:
IBM is implementing a streaming analytics service for an online retailer to provide data on the best time to sell specific products. To accomplish this goal, the service needs a very fast way to calculate a number of basic formulas for a series of dates, quantity and product id.
Assumptions:
In production, the list of data could be in the hundreds of thousands of dates with quantities and product ids.
The service will be called frequently as the user explores different data models.
The data may not be normalized. There could be multiple lines with the same date and product id. In these cases you should sum all the quantity on input and work on that.
Product ids are case sensitive.
Input:
Each line will contain a comma separated list of text date (yyyy-mm-dd), quantity, product id. For example:
2017-06-02,5,Apples 2017-06-02,2,pears 2017-06-03,3,pineapples
Output:
For each date create a line of this format: date, total items sold for date, average quantity of all items (to 2 decimal places), count of unique parts sold. For example:
2017-06-02,7,3.50,2 2017-06-03,3,3.00,1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started