bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 1113. Reported Posts

1113. Reported Posts

Leetcode Solutions

Counting Reported Posts by Reason Using SQL and Pandas

  1. Filter the 'Actions' table to include only rows where 'action_date' is '2019-07-04'.
  2. Further filter the data to include only rows where 'action' is 'report'.
  3. Group the filtered data by the 'extra' column, which contains the report reasons.
  4. Count the distinct 'post_id's for each group to get the number of unique reports per reason.
  5. Rename the columns to 'report_reason' and 'report_count' for clarity.
  6. Return the result as a DataFrame (for Pandas) or as a result set (for SQL).
erDiagram
    Actions {
        int user_id
        int post_id
        date action_date
        enum action
        varchar extra
    }

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...