Find the authors who have viewed at least one of their own articles and return their IDs in ascending order.
You are given a table of article view records. Each record contains an author and the viewer of an article.
An author is said to have viewed their own article if there exists at least one record where the author_id and viewer_id are the same.
Return the list of authors who have done this, sorted in ascending order by id.
This is a simple filtering and deduplication task: keep only rows where the two IDs match, then remove duplicates and sort.
The input is a collection of article view records. Each record has at least:
author_idviewer_idFor example, the data may be represented as a list of objects/rows or as a database table.
Return the unique author_id values for rows where author_id = viewer_id, sorted in ascending order.
Example 1
Input
views = [[1,3],[2,2],[3,1],[3,3],[4,5]]
Output
[2,3]
Explanation
Authors 2 and 3 appear in rows where the author viewed their own article.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.