From 557c36b17b1f2a1d4b3d40148e9e50da050804b4 Mon Sep 17 00:00:00 2001 From: openset Date: Wed, 10 Jul 2019 09:33:21 +0800 Subject: [PATCH 1/2] Add: new --- README.md | 2 ++ .../highest-grade-for-each-student/README.md | 17 +++++++++++++++++ .../mysql_schemas.sql | 9 +++++++++ .../largest-rectangle-in-histogram/README.md | 2 +- problems/maximal-rectangle/README.md | 2 +- .../README.md | 2 +- problems/reported-posts/README.md | 14 ++++++++++++++ problems/reported-posts/mysql_schemas.sql | 15 +++++++++++++++ problems/sort-colors/README.md | 2 +- problems/subsets/README.md | 2 +- 10 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 problems/highest-grade-for-each-student/README.md create mode 100644 problems/highest-grade-for-each-student/mysql_schemas.sql create mode 100644 problems/reported-posts/README.md create mode 100644 problems/reported-posts/mysql_schemas.sql diff --git a/README.md b/README.md index 06535fd8f..ecdf1ae92 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,8 @@ LeetCode Problems' Solutions | # | Title | Solution | Difficulty | | :-: | - | - | :-: | +| 1113 | [Reported Posts](https://leetcode.com/problems/reported-posts) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/reported-posts) | Easy | +| 1112 | [Highest Grade For Each Student](https://leetcode.com/problems/highest-grade-for-each-student) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/highest-grade-for-each-student) | Medium | | 1111 | [Maximum Nesting Depth of Two Valid Parentheses Strings](https://leetcode.com/problems/maximum-nesting-depth-of-two-valid-parentheses-strings "æœ‰æ•ˆæ‹Žå·įš„åĩŒåĨ—æ·ąåšĶ") | [Go](https://github.com/openset/leetcode/tree/master/problems/maximum-nesting-depth-of-two-valid-parentheses-strings) | Medium | | 1110 | [Delete Nodes And Return Forest](https://leetcode.com/problems/delete-nodes-and-return-forest "删į‚đ成林") | [Go](https://github.com/openset/leetcode/tree/master/problems/delete-nodes-and-return-forest) | Medium | | 1109 | [Corporate Flight Bookings](https://leetcode.com/problems/corporate-flight-bookings "čˆŠį­éĒ„čŪĒįŧŸčŪĄ") | [Go](https://github.com/openset/leetcode/tree/master/problems/corporate-flight-bookings) | Medium | diff --git a/problems/highest-grade-for-each-student/README.md b/problems/highest-grade-for-each-student/README.md new file mode 100644 index 000000000..729281835 --- /dev/null +++ b/problems/highest-grade-for-each-student/README.md @@ -0,0 +1,17 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/maximum-nesting-depth-of-two-valid-parentheses-strings "Maximum Nesting Depth of Two Valid Parentheses Strings") +                 +[Next >](https://github.com/openset/leetcode/tree/master/problems/reported-posts "Reported Posts") + +## 1112. Highest Grade For Each Student (Medium) + + + +### Similar Questions + 1. [Department Highest Salary](https://github.com/openset/leetcode/tree/master/problems/department-highest-salary) (Medium) diff --git a/problems/highest-grade-for-each-student/mysql_schemas.sql b/problems/highest-grade-for-each-student/mysql_schemas.sql new file mode 100644 index 000000000..8d245e074 --- /dev/null +++ b/problems/highest-grade-for-each-student/mysql_schemas.sql @@ -0,0 +1,9 @@ +Create table If Not Exists Enrollments (student_id int, course_id int, grade int); +Truncate table Enrollments; +insert into Enrollments (student_id, course_id, grade) values ('2', '2', '95'); +insert into Enrollments (student_id, course_id, grade) values ('2', '3', '95'); +insert into Enrollments (student_id, course_id, grade) values ('1', '1', '90'); +insert into Enrollments (student_id, course_id, grade) values ('1', '2', '99'); +insert into Enrollments (student_id, course_id, grade) values ('3', '1', '80'); +insert into Enrollments (student_id, course_id, grade) values ('3', '2', '75'); +insert into Enrollments (student_id, course_id, grade) values ('3', '3', '82'); diff --git a/problems/largest-rectangle-in-histogram/README.md b/problems/largest-rectangle-in-histogram/README.md index 738d4f273..c0297fe03 100644 --- a/problems/largest-rectangle-in-histogram/README.md +++ b/problems/largest-rectangle-in-histogram/README.md @@ -33,8 +33,8 @@ ### Related Topics - [[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)] [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] + [[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)] ### Similar Questions 1. [Maximal Rectangle](https://github.com/openset/leetcode/tree/master/problems/maximal-rectangle) (Hard) diff --git a/problems/maximal-rectangle/README.md b/problems/maximal-rectangle/README.md index db7c5a9e3..41f54ea8d 100644 --- a/problems/maximal-rectangle/README.md +++ b/problems/maximal-rectangle/README.md @@ -27,10 +27,10 @@ ### Related Topics - [[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)] [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] + [[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)] ### Similar Questions 1. [Largest Rectangle in Histogram](https://github.com/openset/leetcode/tree/master/problems/largest-rectangle-in-histogram) (Hard) diff --git a/problems/maximum-nesting-depth-of-two-valid-parentheses-strings/README.md b/problems/maximum-nesting-depth-of-two-valid-parentheses-strings/README.md index 982a6e671..caed4fc30 100644 --- a/problems/maximum-nesting-depth-of-two-valid-parentheses-strings/README.md +++ b/problems/maximum-nesting-depth-of-two-valid-parentheses-strings/README.md @@ -7,7 +7,7 @@ [< Previous](https://github.com/openset/leetcode/tree/master/problems/delete-nodes-and-return-forest "Delete Nodes And Return Forest")                  -Next > +[Next >](https://github.com/openset/leetcode/tree/master/problems/highest-grade-for-each-student "Highest Grade For Each Student") ## 1111. Maximum Nesting Depth of Two Valid Parentheses Strings (Hard) diff --git a/problems/reported-posts/README.md b/problems/reported-posts/README.md new file mode 100644 index 000000000..1eb7a03fa --- /dev/null +++ b/problems/reported-posts/README.md @@ -0,0 +1,14 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/highest-grade-for-each-student "Highest Grade For Each Student") +                 +Next > + +## 1113. Reported Posts (Easy) + + diff --git a/problems/reported-posts/mysql_schemas.sql b/problems/reported-posts/mysql_schemas.sql new file mode 100644 index 000000000..25a1cbc12 --- /dev/null +++ b/problems/reported-posts/mysql_schemas.sql @@ -0,0 +1,15 @@ +Create table If Not Exists Actions (user_id int, post_id int, action_date date, action ENUM('view', 'like', 'reaction', 'comment', 'report', 'share'), extra varchar(10)); +Truncate table Actions; +insert into Actions (user_id, post_id, action_date, action, extra) values ('1', '1', '2019-07-01', 'view', 'None'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('1', '1', '2019-07-01', 'like', 'None'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('1', '1', '2019-07-01', 'share', 'None'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('2', '4', '2019-07-04', 'view', 'None'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('2', '4', '2019-07-04', 'report', 'spam'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('3', '4', '2019-07-04', 'view', 'None'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('3', '4', '2019-07-04', 'report', 'spam'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('4', '3', '2019-07-02', 'view', 'None'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('4', '3', '2019-07-02', 'report', 'spam'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('5', '2', '2019-07-04', 'view', 'None'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('5', '2', '2019-07-04', 'report', 'racism'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('5', '5', '2019-07-04', 'view', 'None'); +insert into Actions (user_id, post_id, action_date, action, extra) values ('5', '5', '2019-07-04', 'report', 'racism'); diff --git a/problems/sort-colors/README.md b/problems/sort-colors/README.md index 295f0c19a..f56df3c27 100644 --- a/problems/sort-colors/README.md +++ b/problems/sort-colors/README.md @@ -32,9 +32,9 @@ ### Related Topics - [[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)] [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[Two Pointers](https://github.com/openset/leetcode/tree/master/tag/two-pointers/README.md)] + [[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)] ### Similar Questions 1. [Sort List](https://github.com/openset/leetcode/tree/master/problems/sort-list) (Medium) diff --git a/problems/subsets/README.md b/problems/subsets/README.md index 0758cdce9..f66d03539 100644 --- a/problems/subsets/README.md +++ b/problems/subsets/README.md @@ -32,9 +32,9 @@ ] ### Related Topics - [[Bit Manipulation](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[Backtracking](https://github.com/openset/leetcode/tree/master/tag/backtracking/README.md)] + [[Bit Manipulation](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] ### Similar Questions 1. [Subsets II](https://github.com/openset/leetcode/tree/master/problems/subsets-ii) (Medium) From 6408a0144e516979db359c3a9d1acd7ff1721f43 Mon Sep 17 00:00:00 2001 From: openset Date: Wed, 10 Jul 2019 09:38:49 +0800 Subject: [PATCH 2/2] Add: return --- internal/question/question.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/question/question.go b/internal/question/question.go index a821cc4ce..418a80981 100644 --- a/internal/question/question.go +++ b/internal/question/question.go @@ -31,7 +31,7 @@ func runQuestion(cmd *base.Command, args []string) { } question.SaveContent() question.SaveCodeSnippet() - break + return } } }