Skip to content

Practice Article Views I

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1148
LeetCode Problem

Article Views I

Problem Statement

Tables: Views(article_id INT, author_id INT, viewer_id INT, view_date DATE). Views permits duplicate rows. Equal author_id and viewer_id identify the same person. Return each author who viewed at least one of their own articles, once, under the column id. Sort id ascending.

Source: Article Views I on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
Views table: +------------+-----------+-----------+------------+ | article_id | author_id | viewer_id | view_date  | +------------+-----------+-----------+------------+ | 1          | 3         | 5         | 2019-08-01 | | 1          | 3         | 6         | 2019-08-02 | | 2          | 7         | 7         | 2019-08-01 | | 2          | 7         | 6         | 2019-08-02 | | 4          | 7         | 1         | 2019-07-22 | | 3          | 4         | 4         | 2019-07-21 | | 3          | 4         | 4         | 2019-07-21 | +------------+-----------+-----------+------------+
Output
+------+ | id   | +------+ | 4    | | 7    | +------+

Related LeetCode Problems

Practice more problems similar to Article Views I.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.