You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <span id="1955">1955</span> | [Count Number of Special Subsequences](https://leetcode.com/problems/count-number-of-special-subsequences "统计特殊子序列的数目") | [Go](problems/count-number-of-special-subsequences) | Hard |
| <span id="1954">1954</span> | [Minimum Garden Perimeter to Collect Enough Apples](https://leetcode.com/problems/minimum-garden-perimeter-to-collect-enough-apples "收集足够苹果的最小花园周长") | [Go](problems/minimum-garden-perimeter-to-collect-enough-apples) | Medium |
| <span id="1953">1953</span> | [Maximum Number of Weeks for Which You Can Work](https://leetcode.com/problems/maximum-number-of-weeks-for-which-you-can-work "你可以工作的最大周数") | [Go](problems/maximum-number-of-weeks-for-which-you-can-work) | Medium |
| <span id="1951">1951</span> | [All the Pairs With the Maximum Number of Common Followers](https://leetcode.com/problems/all-the-pairs-with-the-maximum-number-of-common-followers) 🔒 | [MySQL](problems/all-the-pairs-with-the-maximum-number-of-common-followers) | Medium |
| <span id="1950">1950</span> | [Maximum of Minimum Values in All Subarrays](https://leetcode.com/problems/maximum-of-minimum-values-in-all-subarrays "所有子数组最小值中的最大值") 🔒 | [Go](problems/maximum-of-minimum-values-in-all-subarrays) | Medium |
| <span id="1946">1946</span> | [Largest Number After Mutating Substring](https://leetcode.com/problems/largest-number-after-mutating-substring "子字符串突变后可能得到的最大整数") | [Go](problems/largest-number-after-mutating-substring) | Medium |
| <span id="1945">1945</span> | [Sum of Digits of String After Convert](https://leetcode.com/problems/sum-of-digits-of-string-after-convert "字符串转化后的各位数字之和") | [Go](problems/sum-of-digits-of-string-after-convert) | Easy |
| <span id="1944">1944</span> | [Number of Visible People in a Queue](https://leetcode.com/problems/number-of-visible-people-in-a-queue "队列中可以看到的人数") | [Go](problems/number-of-visible-people-in-a-queue) | Hard |
| <span id="1943">1943</span> | [Describe the Painting](https://leetcode.com/problems/describe-the-painting "描述绘画结果") | [Go](problems/describe-the-painting) | Medium |
| <span id="1942">1942</span> | [The Number of the Smallest Unoccupied Chair](https://leetcode.com/problems/the-number-of-the-smallest-unoccupied-chair "最小未被占据椅子的编号") | [Go](problems/the-number-of-the-smallest-unoccupied-chair) | Medium |
| <span id="1941">1941</span> | [Check if All Characters Have Equal Number of Occurrences](https://leetcode.com/problems/check-if-all-characters-have-equal-number-of-occurrences "检查是否所有字符出现次数相同") | [Go](problems/check-if-all-characters-have-equal-number-of-occurrences) | Easy |
| <span id="1940">1940</span> | [Longest Common Subsequence Between Sorted Arrays](https://leetcode.com/problems/longest-common-subsequence-between-sorted-arrays "排序数组之间的最长公共子序列") 🔒 | [Go](problems/longest-common-subsequence-between-sorted-arrays) | Medium |
| <span id="1937">1937</span> | [Maximum Number of Points with Cost](https://leetcode.com/problems/maximum-number-of-points-with-cost "扣分后的最大得分") | [Go](problems/maximum-number-of-points-with-cost) | Medium |
| <span id="1936">1936</span> | [Add Minimum Number of Rungs](https://leetcode.com/problems/add-minimum-number-of-rungs "新增的最少台阶数") | [Go](problems/add-minimum-number-of-rungs) | Medium |
| <span id="1935">1935</span> | [Maximum Number of Words You Can Type](https://leetcode.com/problems/maximum-number-of-words-you-can-type "可以输入的最大单词数") | [Go](problems/maximum-number-of-words-you-can-type) | Easy |
| <span id="1933">1933</span> | [Check if String Is Decomposable Into Value-Equal Substrings](https://leetcode.com/problems/check-if-string-is-decomposable-into-value-equal-substrings "判断字符串是否可分解为值均等的子串") 🔒 | [Go](problems/check-if-string-is-decomposable-into-value-equal-substrings) | Easy |
| <span id="1932">1932</span> | [Merge BSTs to Create Single BST](https://leetcode.com/problems/merge-bsts-to-create-single-bst "合并多棵二叉搜索树") | [Go](problems/merge-bsts-to-create-single-bst) | Hard |
| <span id="1931">1931</span> | [Painting a Grid With Three Different Colors](https://leetcode.com/problems/painting-a-grid-with-three-different-colors "用三种不同颜色为网格涂色") | [Go](problems/painting-a-grid-with-three-different-colors) | Hard |
| <span id="1924">1924</span> | [Erect the Fence II](https://leetcode.com/problems/erect-the-fence-ii) 🔒 | [Go](problems/erect-the-fence-ii) | Hard |
| <span id="1923">1923</span> | [Longest Common Subpath](https://leetcode.com/problems/longest-common-subpath "最长公共子路径") | [Go](problems/longest-common-subpath) | Hard |
| <span id="1922">1922</span> | [Count Good Numbers](https://leetcode.com/problems/count-good-numbers "统计好数字的数目") | [Go](problems/count-good-numbers) | Medium |
| <span id="1921">1921</span> | [Eliminate Maximum Number of Monsters](https://leetcode.com/problems/eliminate-maximum-number-of-monsters "消灭怪物的最大数量") | [Go](problems/eliminate-maximum-number-of-monsters) | Medium |
| <span id="1916">1916</span> | [Count Ways to Build Rooms in an Ant Colony](https://leetcode.com/problems/count-ways-to-build-rooms-in-an-ant-colony "统计为蚁群构筑房间的不同顺序") | [Go](problems/count-ways-to-build-rooms-in-an-ant-colony) | Hard |
Expand DownExpand Up
@@ -161,7 +192,7 @@ LeetCode Problems' Solutions
| <span id="1844">1844</span> | [Replace All Digits with Characters](https://leetcode.com/problems/replace-all-digits-with-characters "将所有数字用字符替换") | [Go](problems/replace-all-digits-with-characters) | Easy |
| <span id="1843">1843</span> | [Suspicious Bank Accounts](https://leetcode.com/problems/suspicious-bank-accounts) 🔒 | [MySQL](problems/suspicious-bank-accounts) | Medium |
| <span id="1842">1842</span> | [Next Palindrome Using Same Digits](https://leetcode.com/problems/next-palindrome-using-same-digits "下个由相同数字构成的回文串") 🔒 | [Go](problems/next-palindrome-using-same-digits) | Hard |
| <span id="1840">1840</span> | [Maximum Building Height](https://leetcode.com/problems/maximum-building-height "最高建筑高度") | [Go](problems/maximum-building-height) | Hard |
| <span id="1839">1839</span> | [Longest Substring Of All Vowels in Order](https://leetcode.com/problems/longest-substring-of-all-vowels-in-order "所有元音按顺序排布的最长子字符串") | [Go](problems/longest-substring-of-all-vowels-in-order) | Medium |
| <span id="1838">1838</span> | [Frequency of the Most Frequent Element](https://leetcode.com/problems/frequency-of-the-most-frequent-element "最高频元素的频数") | [Go](problems/frequency-of-the-most-frequent-element) | Medium |
| <span id="1808">1808</span> | [Maximize Number of Nice Divisors](https://leetcode.com/problems/maximize-number-of-nice-divisors "好因子的最大数目") | [Go](problems/maximize-number-of-nice-divisors) | Hard |
| <span id="1807">1807</span> | [Evaluate the Bracket Pairs of a String](https://leetcode.com/problems/evaluate-the-bracket-pairs-of-a-string "替换字符串中的括号内容") | [Go](problems/evaluate-the-bracket-pairs-of-a-string) | Medium |
Expand DownExpand Up
@@ -224,7 +255,7 @@ LeetCode Problems' Solutions
| <span id="1781">1781</span> | [Sum of Beauty of All Substrings](https://leetcode.com/problems/sum-of-beauty-of-all-substrings "所有子字符串美丽值之和") | [Go](problems/sum-of-beauty-of-all-substrings) | Medium |
| <span id="1780">1780</span> | [Check if Number is a Sum of Powers of Three](https://leetcode.com/problems/check-if-number-is-a-sum-of-powers-of-three "判断一个数字是否可以表示成三的幂的和") | [Go](problems/check-if-number-is-a-sum-of-powers-of-three) | Medium |
| <span id="1779">1779</span> | [Find Nearest Point That Has the Same X or Y Coordinate](https://leetcode.com/problems/find-nearest-point-that-has-the-same-x-or-y-coordinate "找到最近的有相同 X 或 Y 坐标的点") | [Go](problems/find-nearest-point-that-has-the-same-x-or-y-coordinate) | Easy |
| <span id="1778">1778</span> | [Shortest Path in a Hidden Grid](https://leetcode.com/problems/shortest-path-in-a-hidden-grid) 🔒 | [Go](problems/shortest-path-in-a-hidden-grid) | Medium |
| <span id="1778">1778</span> | [Shortest Path in a Hidden Grid](https://leetcode.com/problems/shortest-path-in-a-hidden-grid "未知网格中的最短路径") 🔒 | [Go](problems/shortest-path-in-a-hidden-grid) | Medium |
| <span id="1777">1777</span> | [Product's Price for Each Store](https://leetcode.com/problems/products-price-for-each-store "每家商店的产品价格") 🔒 | [MySQL](problems/products-price-for-each-store) | Easy |
| <span id="1775">1775</span> | [Equal Sum Arrays With Minimum Number of Operations](https://leetcode.com/problems/equal-sum-arrays-with-minimum-number-of-operations "通过最少操作次数使数组的和相等") | [Go](problems/equal-sum-arrays-with-minimum-number-of-operations) | Medium |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Given an array of <i>n</i> integers <i>nums</i> and a <i>target</i>, find the number of index triplets <code>i, j, k</code> with <code>0 <= i < j < k < n</code> that satisfy the condition <code>nums[i] + nums[j] + nums[k] < target</code>.</p>
<p><strong>Example:</strong></p>
<pre>
<strong>Input:</strong> <i>nums</i> = <code>[-2,0,1,3]</code>, and <i>target</i> = 2
<strong>Output:</strong> 2
<strong>Explanation:</strong> Because there are two triplets which sums are less than 2:
[-2,0,1]
[-2,0,3]
</pre>
<p><b style="font-family: sans-serif, Arial, Verdana, "Trebuchet MS";">Follow up:</b> Could you solve it in <i>O</i>(<i>n</i><sup>2</sup>) runtime?</p>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Imagine you have a special keyboard with the following keys: </p>
<p><code>Key 1: (A)</code>: Print one 'A' on screen.</p>
<p><code>Key 2: (Ctrl-A)</code>: Select the whole screen.</p>
<p><code>Key 3: (Ctrl-C)</code>: Copy selection to buffer.</p>
<p><code>Key 4: (Ctrl-V)</code>: Print buffer on screen appending it after what has already been printed. </p>
<p>Now, you can only press the keyboard for <b>N</b> times (with the above four keys), find out the maximum numbers of 'A' you can print on screen.</p>
<p><b>Example 1:</b><br />
<pre><b>Input:</b> N = 3
<b>Output:</b> 3
<b>Explanation:</b>
We can at most get 3 A's on screen by pressing following key sequence:
A, A, A
</pre>
</p>
<p><b>Example 2:</b><br />
<pre><b>Input:</b> N = 7
<b>Output:</b> 9
<b>Explanation:</b>
We can at most get 9 A's on screen by pressing following key sequence:
A, A, A, Ctrl A, Ctrl C, Ctrl V, Ctrl V
</pre>
</p>
<p><b>Note:</b><br>
<ol>
<li>1 <= N <= 50 </li>
<li>Answers will be in the range of 32-bit signed integer.</li>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## [1126. Active Businesses (Medium)](https://leetcode.com/problems/active-businesses "查询活跃业务")
<p>Table: <code>Events</code></p>
<pre>
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| business_id | int |
| event_type | varchar |
| occurences | int |
+---------------+---------+
(business_id, event_type) is the primary key of this table.
Each row in the table logs the info that an event of some type occured at some business for a number of times.</pre>
<p> </p>
<p>Write an SQL query to find all <em>active businesses</em>.</p>
<p>An active business is a business that has more than one event type with occurences greater than the average occurences of that event type among all businesses.</p>
<p>The query result format is in the following example:</p>
<pre>
Events table:
+-------------+------------+------------+
| business_id | event_type | occurences |
+-------------+------------+------------+
| 1 | reviews | 7 |
| 3 | reviews | 3 |
| 1 | ads | 11 |
| 2 | ads | 7 |
| 3 | ads | 6 |
| 1 | page views | 3 |
| 2 | page views | 12 |
+-------------+------------+------------+
Result table:
+-------------+
| business_id |
+-------------+
| 1 |
+-------------+
Average for 'reviews', 'ads' and 'page views' are (7+3)/2=5, (11+7+6)/3=8, (3+12)/2=7.5 respectively.
Business with id 1 has 7 'reviews' events (more than 5) and 11 'ads' events (more than 8) so it is an active business.</pre>
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.