Advertisement
Guest User

Untitled

a guest
Dec 17th, 2016
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. Working at Twitter can involve working with large volumes of time series data, often in a variety of different formats. In order to gain valuable insights from the data, we must be able to efficiently record, parse, and categorize it, and display meaningful results to the viewer.
  2.  
  3. For this exercise, you will work with input that represents engagement data at different times for an arbitrary time interval. The data is divided by categories including but not limited to impressions, clicks, favorites, and retweets. The purpose of the task is to aggregate the data by month and engagement category for the requested time interval.
  4.  
  5. Input:
  6. 2015-08, 2016-04
  7.  
  8. 2015-08-15, clicks, 635
  9. 2016-03-24, app_installs, 683
  10. 2015-04-05, favorites, 763
  11. 2016-01-22, favorites, 788
  12. 2015-12-26, clicks, 525
  13. 2016-06-03, retweets, 101
  14. 2015-12-02, app_installs, 982
  15. 2016-09-17, app_installs, 770
  16. 2015-11-07, impressions, 245
  17. 2016-10-16, impressions, 567
  18.  
  19. Each line is terminated by a single newline character '\n'.
  20. The first line represents the start and end of the requested date interval. The start and end dates are separated by a single comma character ',' and zero or more space characters ' '.
  21. The second line is empty.
  22. The third line and onwards represent the time series data points. Each line represents a single data point, consisting of a date, engagement type, and number of engagements. The fields on each line are also separated by commas and optional spaces. Input dates are not expected to be in order.
  23.  
  24. Output:
  25. 2016-03, app_installs, 683
  26. 2016-01, favorites, 788
  27. 2015-12, app_installs, 982, clicks, 525
  28. 2015-11, impressions, 245
  29. 2015-08, clicks, 635
  30.  
  31. The output consists of a line for each month in the requested interval, separated by a single newline character '\n' in order of most recent date to latest date.
  32. Do not include months where there was no engagement data found.
  33. Each line consists of a month date (yyyy-mm), and the totals for each engagement type where the total is greater than 0. Each field on a given line must be separated by a single comma character ',' followed by a single space character ' '.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement