Skip to main content
Back to problems
Leetcode
Medium
Sorting
Strings
Arrays
Not Boring Movies

Filter movies by odd IDs and exclude the movie titled "boring", then sort the remaining rows by rating in descending order.

Acceptance 33%
Problem Statement

Given a table of movies, return all movies whose id is odd and whose description is not boring. Sort the result by rating from highest to lowest.

This is a simple data filtering and ordering problem: first apply the row conditions, then rank the remaining movies by rating.

Input Format

You are given a Movies table with at least these columns:

  • id
  • movie
  • description
  • rating

Select the rows that satisfy the conditions described in the problem.

Output Format

Return the filtered rows ordered by rating in descending order.

Constraints

  • id values are integers.
  • rating can be used for ordering.
  • Only rows with odd id and description <> 'boring' should appear in the output.
Examples
Sample cases returned by the problem API.

Example 1

Input

Movies table
+----+------------+-------------+--------+
| id | movie      | description | rating |
+----+------------+-------------+--------+
| 1  | War        | great 3D    | 8.9    |
| 2  | Science    | boring      | 8.5    |
| 3  | John        | exciting    | 8.0    |
| 4  | Alice      | boring      | 6.5    |
| 5  | Zebra      | fun         | 7.7    |
+----+------------+-------------+--------+

Output

+----+------------+-------------+--------+
| id | movie      | description | rating |
+----+------------+-------------+--------+
| 1  | War        | great 3D    | 8.9    |
| 3  | John       | exciting    | 8.0    |
| 5  | Zebra      | fun         | 7.7    |
+----+------------+-------------+--------+

Explanation

Keep only odd id rows and exclude any row whose description is boring, then sort by rating descending.

Premium problem context

Unlock deeper context for this problem

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.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.