A Collection of Data Science Take-Home Challenges

Query 1


For each user_id, find the difference between the last action and the second last action. Action here is defined as visiting a page. If the user has just one action, you can either remove her from the final results or keep that user_id and have NULL as time difference between the two actions.

The table below shows for each user all the pages she visited and the corresponding timestamp.


You can download the data set here.

head (query_one,1)

Column Name Value Description
user_id 6684 this is id of the user
page home_page the page visited
unix_timestamp 1451640067 unix timestamp in seconds

Click here for mock phone interviews to practice similar questions, DS takehome challenges, and more