-
Notifications
You must be signed in to change notification settings - Fork 0
/
2026. Low-Quality Problems
67 lines (55 loc) · 1.83 KB
/
2026. Low-Quality Problems
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
2026. Low-Quality Problems
Solved
Easy
Topics
SQL Schema
Pandas Schema
Table: Problems
+-------------+------+
| Column Name | Type |
+-------------+------+
| problem_id | int |
| likes | int |
| dislikes | int |
+-------------+------+
In SQL, problem_id is the primary key column for this table.
Each row of this table indicates the number of likes and dislikes for a LeetCode problem.
Find the IDs of the low-quality problems. A LeetCode problem is low-quality if the like percentage of the problem (number of likes divided by the total number of votes) is strictly less than 60%.
Return the result table ordered by problem_id in ascending order.
The result format is in the following example.
Example 1:
Input:
Problems table:
+------------+-------+----------+
| problem_id | likes | dislikes |
+------------+-------+----------+
| 6 | 1290 | 425 |
| 11 | 2677 | 8659 |
| 1 | 4446 | 2760 |
| 7 | 8569 | 6086 |
| 13 | 2050 | 4164 |
| 10 | 9002 | 7446 |
+------------+-------+----------+
Output:
+------------+
| problem_id |
+------------+
| 7 |
| 10 |
| 11 |
| 13 |
+------------+
Explanation: The like percentages are as follows:
- Problem 1: (4446 / (4446 + 2760)) * 100 = 61.69858%
- Problem 6: (1290 / (1290 + 425)) * 100 = 75.21866%
- Problem 7: (8569 / (8569 + 6086)) * 100 = 58.47151%
- Problem 10: (9002 / (9002 + 7446)) * 100 = 54.73006%
- Problem 11: (2677 / (2677 + 8659)) * 100 = 23.61503%
- Problem 13: (2050 / (2050 + 4164)) * 100 = 32.99002%
Problems 7, 10, 11, and 13 are low-quality problems because their like percentages are less than 60%.
-----------------------------
# Write your MySQL query statement below
select problem_id
from Problems
where likes*100.0 /(likes +dislikes )< 60.00
order by problem_id ASC