Google | SDE | US | Stream data question
Anonymous User
439

sessionid | userid | step| time
123 | 1 | 1 | 1
123 | 1 | 2 | 3
123 | 1 | 3 | 5
123 | 1 | 4 | 8

234 | 2 | 1 | 6
234 | 2 | 2 | 9
234 | 2 | 3 | 11
234 | 2 | 4 | 14

345 | 3 | 1 | 1
345 | 3 | 2 | 4
345 | 3 | 3 | 6

Times spent at step 1 is start time of step 2 - start time of step 1
Above is a continuous stream of data
Write a code to find the average time for each step as data comes in?

Comments (3)