# Follow up after home assignment
Task 1:
```sql=BigQuery
select
date,
country,
count(*) as `result`
from (
select
user_id,
event_date as date,
any_value(geo.country) as country
from `zedge-android.events.all`
where event_date between current_date - interval 2 day and current_date - interval 1 day
group by user_id, date
)
group by date, country
order by date, count(*) desc
```
What is the runtime of the query expressed for $n$ events per day, $u$ users, $d$ days and $c$ countries?
What is the memory consumption?
Task 2:
A session is defined as a period of activity in the application. If there is a period longer than 5 minutes when the user does not do anything actively the session ends. The session time is the time between the first action to the last action of the session.
Write the algorithm calculating all session times of all users.
Example input:
| userId | minute timestamp of activity |
|-------|----|
| user1 | 1 |
| user1 | 2 |
| user2 | 3 |
| user1 | 7 |
| user1 | 9 |
| user1 | 13 |
Expected output (order of array elements does not matter):
[1, 6, 0]
Task 3:
We are frequently changing our ringtones and wallpaper app. A change is released to a portion of our users and compared to an equal group getting no change. We run statistical hypothesis test to decide if the change is causing a change in user behavior.
Let's consider a test that has ran for 2 weeks. We would like to forecast the impact of this change for the coming year.
We have 4 yeas of timestamped data on each user. It contains description of the user and every interaction the user has with the app. How would you use this data to **predict the increase in number of users** using the app if this change is deployed?