Skip to content

Commit 50f4c91

Browse files
Create leetcode_512.md
1 parent 480eddf commit 50f4c91

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

leetcode_512.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
**512. Game Play Analysis II 🔒**
2+
3+
# Description
4+
5+
Table: `Activity`
6+
7+
```
8+
+--------------+---------+
9+
| Column Name | Type |
10+
+--------------+---------+
11+
| player_id | int |
12+
| device_id | int |
13+
| event_date | date |
14+
| games_played | int |
15+
+--------------+---------+
16+
(player_id, event_date) is the primary key (combination of columns with unique values) of this table.
17+
This table shows the activity of players of some games.
18+
Each row is a record of a player who logged in and played a number of games (possibly 0) before logging out on someday using some device.
19+
```
20+
21+
Write a solution to report the device that is first logged in for each player.
22+
23+
Return the result table in any order.
24+
25+
The result format is in the following example.
26+
27+
**Example 1:**
28+
29+
```
30+
Input:
31+
Activity table:
32+
+-----------+-----------+------------+--------------+
33+
| player_id | device_id | event_date | games_played |
34+
+-----------+-----------+------------+--------------+
35+
| 1 | 2 | 2016-03-01 | 5 |
36+
| 1 | 2 | 2016-05-02 | 6 |
37+
| 2 | 3 | 2017-06-25 | 1 |
38+
| 3 | 1 | 2016-03-02 | 0 |
39+
| 3 | 4 | 2018-07-03 | 5 |
40+
+-----------+-----------+------------+--------------+
41+
Output:
42+
+-----------+-----------+
43+
| player_id | device_id |
44+
+-----------+-----------+
45+
| 1 | 2 |
46+
| 2 | 3 |
47+
| 3 | 1 |
48+
+-----------+-----------+
49+
```
50+
51+
# Solutions
52+

0 commit comments

Comments
 (0)