1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-03 22:42:52 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2023-12-09 19:57:46 +08:00
parent 9bc4722a45
commit 3770b44d1e
4792 changed files with 10889 additions and 10886 deletions

View File

@@ -11,7 +11,7 @@
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 8992,
"likes": 8993,
"dislikes": 396,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Shortest Path to Get Food\", \"titleSlug\": \"shortest-path-to-get-food\", \"difficulty\": \"Medium\", \"translatedTitle\": null}, {\"title\": \"Minimum Operations to Remove Adjacent Ones in Matrix\", \"titleSlug\": \"minimum-operations-to-remove-adjacent-ones-in-matrix\", \"difficulty\": \"Hard\", \"translatedTitle\": null}, {\"title\": \"Difference Between Ones and Zeros in Row and Column\", \"titleSlug\": \"difference-between-ones-and-zeros-in-row-and-column\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]",
@@ -161,7 +161,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"507K\", \"totalSubmission\": \"1.1M\", \"totalAcceptedRaw\": 507043, \"totalSubmissionRaw\": 1058949, \"acRate\": \"47.9%\"}",
"stats": "{\"totalAccepted\": \"507.1K\", \"totalSubmission\": \"1.1M\", \"totalAcceptedRaw\": 507096, \"totalSubmissionRaw\": 1059025, \"acRate\": \"47.9%\"}",
"hints": [],
"solution": {
"id": "1965",

View File

@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"126.1K\", \"totalSubmission\": \"279K\", \"totalAcceptedRaw\": 126113, \"totalSubmissionRaw\": 278968, \"acRate\": \"45.2%\"}",
"stats": "{\"totalAccepted\": \"126.1K\", \"totalSubmission\": \"279K\", \"totalAcceptedRaw\": 126123, \"totalSubmissionRaw\": 278989, \"acRate\": \"45.2%\"}",
"hints": [
"Keep track of where the next character starts. At the end, you want to know if you started on the last bit."
],

View File

@@ -11,8 +11,8 @@
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 6955,
"dislikes": 408,
"likes": 6956,
"dislikes": 407,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "[1,2,3,4]\n[3,1,4,2]\n[-1,3,2,0]",
@@ -167,7 +167,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"241.9K\", \"totalSubmission\": \"716.7K\", \"totalAcceptedRaw\": 241908, \"totalSubmissionRaw\": 716713, \"acRate\": \"33.8%\"}",
"stats": "{\"totalAccepted\": \"241.9K\", \"totalSubmission\": \"716.8K\", \"totalAcceptedRaw\": 241925, \"totalSubmissionRaw\": 716755, \"acRate\": \"33.8%\"}",
"hints": [],
"solution": {
"id": "189",

View File

@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"126.8K\", \"totalSubmission\": \"235.6K\", \"totalAcceptedRaw\": 126834, \"totalSubmissionRaw\": 235627, \"acRate\": \"53.8%\"}",
"stats": "{\"totalAccepted\": \"126.9K\", \"totalSubmission\": \"235.7K\", \"totalAcceptedRaw\": 126857, \"totalSubmissionRaw\": 235658, \"acRate\": \"53.8%\"}",
"hints": [
"How many characters may be there in the clipboard at the last step if n = 3? n = 7? n = 10? n = 24?"
],

View File

@@ -11,7 +11,7 @@
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 1428,
"likes": 1429,
"dislikes": 242,
"isLiked": null,
"similarQuestions": "[]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"74.5K\", \"totalSubmission\": \"151.5K\", \"totalAcceptedRaw\": 74548, \"totalSubmissionRaw\": 151523, \"acRate\": \"49.2%\"}",
"stats": "{\"totalAccepted\": \"74.6K\", \"totalSubmission\": \"151.5K\", \"totalAcceptedRaw\": 74560, \"totalSubmissionRaw\": 151538, \"acRate\": \"49.2%\"}",
"hints": [],
"solution": {
"id": "1450",

View File

@@ -11,7 +11,7 @@
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 10037,
"likes": 10038,
"dislikes": 529,
"isLiked": null,
"similarQuestions": "[{\"title\": \"3Sum\", \"titleSlug\": \"3sum\", \"difficulty\": \"Medium\", \"translatedTitle\": null}, {\"title\": \"3Sum Smaller\", \"titleSlug\": \"3sum-smaller\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"1.1M\", \"totalSubmission\": \"2.5M\", \"totalAcceptedRaw\": 1125749, \"totalSubmissionRaw\": 2472928, \"acRate\": \"45.5%\"}",
"stats": "{\"totalAccepted\": \"1.1M\", \"totalSubmission\": \"2.5M\", \"totalAcceptedRaw\": 1125918, \"totalSubmissionRaw\": 2473229, \"acRate\": \"45.5%\"}",
"hints": [],
"solution": {
"id": "948",

View File

@@ -11,8 +11,8 @@
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 29233,
"dislikes": 2660,
"likes": 29237,
"dislikes": 2659,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Two Sum\", \"titleSlug\": \"two-sum\", \"difficulty\": \"Easy\", \"translatedTitle\": null}, {\"title\": \"3Sum Closest\", \"titleSlug\": \"3sum-closest\", \"difficulty\": \"Medium\", \"translatedTitle\": null}, {\"title\": \"4Sum\", \"titleSlug\": \"4sum\", \"difficulty\": \"Medium\", \"translatedTitle\": null}, {\"title\": \"3Sum Smaller\", \"titleSlug\": \"3sum-smaller\", \"difficulty\": \"Medium\", \"translatedTitle\": null}, {\"title\": \"Number of Arithmetic Triplets\", \"titleSlug\": \"number-of-arithmetic-triplets\", \"difficulty\": \"Easy\", \"translatedTitle\": null}, {\"title\": \"Minimum Sum of Mountain Triplets I\", \"titleSlug\": \"minimum-sum-of-mountain-triplets-i\", \"difficulty\": \"Easy\", \"translatedTitle\": null}, {\"title\": \"Minimum Sum of Mountain Triplets II\", \"titleSlug\": \"minimum-sum-of-mountain-triplets-ii\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]",
"exampleTestcases": "[-1,0,1,2,-1,-4]\n[0,1,1]\n[0,0,0]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"3.1M\", \"totalSubmission\": \"9.3M\", \"totalAcceptedRaw\": 3117813, \"totalSubmissionRaw\": 9256538, \"acRate\": \"33.7%\"}",
"stats": "{\"totalAccepted\": \"3.1M\", \"totalSubmission\": \"9.3M\", \"totalAcceptedRaw\": 3118309, \"totalSubmissionRaw\": 9257542, \"acRate\": \"33.7%\"}",
"hints": [
"So, we essentially need to find three numbers x, y, and z such that they add up to the given value. If we fix one of the numbers say x, we are left with the two-sum problem at hand!",
"For the two-sum problem, if we fix one of the numbers, say x, we have to scan the entire array to find the next number y, which is value - x where value is the input parameter. Can we change our array somehow so that this search becomes faster?",

View File

@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"312.1K\", \"totalSubmission\": \"546.1K\", \"totalAcceptedRaw\": 312131, \"totalSubmissionRaw\": 546080, \"acRate\": \"57.2%\"}",
"stats": "{\"totalAccepted\": \"312.1K\", \"totalSubmission\": \"546.1K\", \"totalAcceptedRaw\": 312147, \"totalSubmissionRaw\": 546102, \"acRate\": \"57.2%\"}",
"hints": [],
"solution": {
"id": "960",

View File

@@ -11,7 +11,7 @@
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 10746,
"likes": 10747,
"dislikes": 1289,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Two Sum\", \"titleSlug\": \"two-sum\", \"difficulty\": \"Easy\", \"translatedTitle\": null}, {\"title\": \"3Sum\", \"titleSlug\": \"3sum\", \"difficulty\": \"Medium\", \"translatedTitle\": null}, {\"title\": \"4Sum II\", \"titleSlug\": \"4sum-ii\", \"difficulty\": \"Medium\", \"translatedTitle\": null}, {\"title\": \"Count Special Quadruplets\", \"titleSlug\": \"count-special-quadruplets\", \"difficulty\": \"Easy\", \"translatedTitle\": null}]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"851.5K\", \"totalSubmission\": \"2.4M\", \"totalAcceptedRaw\": 851505, \"totalSubmissionRaw\": 2374815, \"acRate\": \"35.9%\"}",
"stats": "{\"totalAccepted\": \"851.7K\", \"totalSubmission\": \"2.4M\", \"totalAcceptedRaw\": 851715, \"totalSubmissionRaw\": 2375221, \"acRate\": \"35.9%\"}",
"hints": [],
"solution": {
"id": "959",

View File

@@ -46,7 +46,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"141.8K\", \"totalSubmission\": \"280.4K\", \"totalAcceptedRaw\": 141850, \"totalSubmissionRaw\": 280353, \"acRate\": \"50.6%\"}",
"stats": "{\"totalAccepted\": \"141.9K\", \"totalSubmission\": \"280.4K\", \"totalAcceptedRaw\": 141856, \"totalSubmissionRaw\": 280364, \"acRate\": \"50.6%\"}",
"hints": [],
"solution": {
"id": "13",

View File

@@ -34,7 +34,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"28.2K\", \"totalSubmission\": \"50.2K\", \"totalAcceptedRaw\": 28172, \"totalSubmissionRaw\": 50233, \"acRate\": \"56.1%\"}",
"stats": "{\"totalAccepted\": \"28.2K\", \"totalSubmission\": \"50.2K\", \"totalAcceptedRaw\": 28174, \"totalSubmissionRaw\": 50236, \"acRate\": \"56.1%\"}",
"hints": [],
"solution": {
"id": "1667",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"8K\", \"totalSubmission\": \"10.3K\", \"totalAcceptedRaw\": 8012, \"totalSubmissionRaw\": 10299, \"acRate\": \"77.8%\"}",
"stats": "{\"totalAccepted\": \"8K\", \"totalSubmission\": \"10.3K\", \"totalAcceptedRaw\": 8014, \"totalSubmissionRaw\": 10301, \"acRate\": \"77.8%\"}",
"hints": [],
"solution": {
"id": "2180",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"8K\", \"totalSubmission\": \"9.7K\", \"totalAcceptedRaw\": 8014, \"totalSubmissionRaw\": 9711, \"acRate\": \"82.5%\"}",
"stats": "{\"totalAccepted\": \"8K\", \"totalSubmission\": \"9.7K\", \"totalAcceptedRaw\": 8017, \"totalSubmissionRaw\": 9714, \"acRate\": \"82.5%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"34.9K\", \"totalSubmission\": \"94.3K\", \"totalAcceptedRaw\": 34870, \"totalSubmissionRaw\": 94324, \"acRate\": \"37.0%\"}",
"stats": "{\"totalAccepted\": \"34.9K\", \"totalSubmission\": \"94.3K\", \"totalAcceptedRaw\": 34872, \"totalSubmissionRaw\": 94329, \"acRate\": \"37.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"27.3K\", \"totalSubmission\": \"37.6K\", \"totalAcceptedRaw\": 27347, \"totalSubmissionRaw\": 37618, \"acRate\": \"72.7%\"}",
"stats": "{\"totalAccepted\": \"27.4K\", \"totalSubmission\": \"37.6K\", \"totalAcceptedRaw\": 27351, \"totalSubmissionRaw\": 37627, \"acRate\": \"72.7%\"}",
"hints": [],
"solution": {
"id": "2179",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"14.3K\", \"totalSubmission\": \"24.6K\", \"totalAcceptedRaw\": 14323, \"totalSubmissionRaw\": 24555, \"acRate\": \"58.3%\"}",
"stats": "{\"totalAccepted\": \"14.3K\", \"totalSubmission\": \"24.6K\", \"totalAcceptedRaw\": 14325, \"totalSubmissionRaw\": 24557, \"acRate\": \"58.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -52,7 +52,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"86.9K\", \"totalSubmission\": \"176K\", \"totalAcceptedRaw\": 86898, \"totalSubmissionRaw\": 176001, \"acRate\": \"49.4%\"}",
"stats": "{\"totalAccepted\": \"86.9K\", \"totalSubmission\": \"176K\", \"totalAcceptedRaw\": 86900, \"totalSubmissionRaw\": 176003, \"acRate\": \"49.4%\"}",
"hints": [],
"solution": {
"id": "1934",

View File

@@ -58,7 +58,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"359.9K\", \"totalSubmission\": \"1M\", \"totalAcceptedRaw\": 359917, \"totalSubmissionRaw\": 1012660, \"acRate\": \"35.5%\"}",
"stats": "{\"totalAccepted\": \"359.9K\", \"totalSubmission\": \"1M\", \"totalAcceptedRaw\": 359947, \"totalSubmissionRaw\": 1012726, \"acRate\": \"35.5%\"}",
"hints": [],
"solution": {
"id": "923",

View File

@@ -34,7 +34,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"56.2K\", \"totalSubmission\": \"147.3K\", \"totalAcceptedRaw\": 56171, \"totalSubmissionRaw\": 147327, \"acRate\": \"38.1%\"}",
"stats": "{\"totalAccepted\": \"56.2K\", \"totalSubmission\": \"147.3K\", \"totalAcceptedRaw\": 56173, \"totalSubmissionRaw\": 147329, \"acRate\": \"38.1%\"}",
"hints": [
"What if we can reach to a cycle from the source node?",
"Then the answer will be false, because we eventually get trapped in the cycle forever.",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"50.9K\", \"totalSubmission\": \"59.5K\", \"totalAcceptedRaw\": 50884, \"totalSubmissionRaw\": 59528, \"acRate\": \"85.5%\"}",
"stats": "{\"totalAccepted\": \"50.9K\", \"totalSubmission\": \"59.5K\", \"totalAcceptedRaw\": 50887, \"totalSubmissionRaw\": 59532, \"acRate\": \"85.5%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"6.2K\", \"totalSubmission\": \"7.1K\", \"totalAcceptedRaw\": 6205, \"totalSubmissionRaw\": 7123, \"acRate\": \"87.1%\"}",
"stats": "{\"totalAccepted\": \"6.2K\", \"totalSubmission\": \"7.1K\", \"totalAcceptedRaw\": 6211, \"totalSubmissionRaw\": 7133, \"acRate\": \"87.1%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"18.5K\", \"totalSubmission\": \"22K\", \"totalAcceptedRaw\": 18489, \"totalSubmissionRaw\": 22005, \"acRate\": \"84.0%\"}",
"stats": "{\"totalAccepted\": \"18.5K\", \"totalSubmission\": \"22K\", \"totalAcceptedRaw\": 18494, \"totalSubmissionRaw\": 22032, \"acRate\": \"83.9%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"26.8K\", \"totalSubmission\": \"48.9K\", \"totalAcceptedRaw\": 26814, \"totalSubmissionRaw\": 48872, \"acRate\": \"54.9%\"}",
"stats": "{\"totalAccepted\": \"26.8K\", \"totalSubmission\": \"48.9K\", \"totalAcceptedRaw\": 26837, \"totalSubmissionRaw\": 48917, \"acRate\": \"54.9%\"}",
"hints": [
"Whats a good way to keep track of intervals that you have already painted?",
"Create an array of all 1s, and when you have painted an interval, set the values in that interval to 0.",

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"89.7K\", \"totalSubmission\": \"208.8K\", \"totalAcceptedRaw\": 89714, \"totalSubmissionRaw\": 208848, \"acRate\": \"43.0%\"}",
"stats": "{\"totalAccepted\": \"89.7K\", \"totalSubmission\": \"208.9K\", \"totalAcceptedRaw\": 89716, \"totalSubmissionRaw\": 208854, \"acRate\": \"43.0%\"}",
"hints": [
"Let's find for every user separately the websites he visited.",
"Consider all possible 3-sequences, find the number of distinct users who visited each of them.",

View File

@@ -34,7 +34,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"71K\", \"totalSubmission\": \"137.2K\", \"totalAcceptedRaw\": 70993, \"totalSubmissionRaw\": 137152, \"acRate\": \"51.8%\"}",
"stats": "{\"totalAccepted\": \"71K\", \"totalSubmission\": \"137.2K\", \"totalAcceptedRaw\": 70997, \"totalSubmissionRaw\": 137156, \"acRate\": \"51.8%\"}",
"hints": [],
"solution": {
"id": "50",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"47.9K\", \"totalSubmission\": \"54.2K\", \"totalAcceptedRaw\": 47871, \"totalSubmissionRaw\": 54232, \"acRate\": \"88.3%\"}",
"stats": "{\"totalAccepted\": \"47.9K\", \"totalSubmission\": \"54.2K\", \"totalAcceptedRaw\": 47872, \"totalSubmissionRaw\": 54233, \"acRate\": \"88.3%\"}",
"hints": [],
"solution": {
"id": "1959",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"34.6K\", \"totalSubmission\": \"44.4K\", \"totalAcceptedRaw\": 34559, \"totalSubmissionRaw\": 44409, \"acRate\": \"77.8%\"}",
"stats": "{\"totalAccepted\": \"34.6K\", \"totalSubmission\": \"44.4K\", \"totalAcceptedRaw\": 34563, \"totalSubmissionRaw\": 44415, \"acRate\": \"77.8%\"}",
"hints": [
"Check if the given k-digit number equals the sum of the k-th power of it's digits.",
"How to compute the sum of the k-th power of the digits of a number ? Can you divide the number into digits using division and modulus operations ?",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"4.6K\", \"totalSubmission\": \"6.7K\", \"totalAcceptedRaw\": 4588, \"totalSubmissionRaw\": 6713, \"acRate\": \"68.3%\"}",
"stats": "{\"totalAccepted\": \"4.6K\", \"totalSubmission\": \"6.7K\", \"totalAcceptedRaw\": 4592, \"totalSubmissionRaw\": 6722, \"acRate\": \"68.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -21,7 +21,7 @@
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"505\", \"totalSubmission\": \"567\", \"totalAcceptedRaw\": 505, \"totalSubmissionRaw\": 567, \"acRate\": \"89.1%\"}",
"stats": "{\"totalAccepted\": \"507\", \"totalSubmission\": \"569\", \"totalAcceptedRaw\": 507, \"totalSubmissionRaw\": 569, \"acRate\": \"89.1%\"}",
"hints": [],
"solution": {
"id": "2052",

View File

@@ -34,7 +34,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"12.6K\", \"totalSubmission\": \"24.4K\", \"totalAcceptedRaw\": 12640, \"totalSubmissionRaw\": 24422, \"acRate\": \"51.8%\"}",
"stats": "{\"totalAccepted\": \"12.6K\", \"totalSubmission\": \"24.4K\", \"totalAcceptedRaw\": 12641, \"totalSubmissionRaw\": 24424, \"acRate\": \"51.8%\"}",
"hints": [
"Try to simulate the process.",
"For every iteration, find the new array using the old one and the given rules."

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"34K\", \"totalSubmission\": \"60.7K\", \"totalAcceptedRaw\": 34014, \"totalSubmissionRaw\": 60696, \"acRate\": \"56.0%\"}",
"stats": "{\"totalAccepted\": \"34K\", \"totalSubmission\": \"60.7K\", \"totalAcceptedRaw\": 34022, \"totalSubmissionRaw\": 60706, \"acRate\": \"56.0%\"}",
"hints": [],
"solution": {
"id": "169",

View File

@@ -46,7 +46,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"115.1K\", \"totalSubmission\": \"231.4K\", \"totalAcceptedRaw\": 115084, \"totalSubmissionRaw\": 231439, \"acRate\": \"49.7%\"}",
"stats": "{\"totalAccepted\": \"115.1K\", \"totalSubmission\": \"231.4K\", \"totalAcceptedRaw\": 115089, \"totalSubmissionRaw\": 231445, \"acRate\": \"49.7%\"}",
"hints": [],
"solution": {
"id": "1985",

View File

@@ -46,7 +46,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"72.9K\", \"totalSubmission\": \"120.7K\", \"totalAcceptedRaw\": 72873, \"totalSubmissionRaw\": 120680, \"acRate\": \"60.4%\"}",
"stats": "{\"totalAccepted\": \"72.9K\", \"totalSubmission\": \"120.7K\", \"totalAcceptedRaw\": 72882, \"totalSubmissionRaw\": 120689, \"acRate\": \"60.4%\"}",
"hints": [
"Try to solve it in one dimension first. How can this solution apply to the two dimension case?"
],

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"19.8K\", \"totalSubmission\": \"27.6K\", \"totalAcceptedRaw\": 19779, \"totalSubmissionRaw\": 27574, \"acRate\": \"71.7%\"}",
"stats": "{\"totalAccepted\": \"19.8K\", \"totalSubmission\": \"27.6K\", \"totalAcceptedRaw\": 19782, \"totalSubmissionRaw\": 27577, \"acRate\": \"71.7%\"}",
"hints": [],
"solution": {
"id": "2199",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"1.9K\", \"totalSubmission\": \"2.3K\", \"totalAcceptedRaw\": 1852, \"totalSubmissionRaw\": 2301, \"acRate\": \"80.5%\"}",
"stats": "{\"totalAccepted\": \"1.9K\", \"totalSubmission\": \"2.3K\", \"totalAcceptedRaw\": 1860, \"totalSubmissionRaw\": 2309, \"acRate\": \"80.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"52.3K\", \"totalSubmission\": \"105.9K\", \"totalAcceptedRaw\": 52311, \"totalSubmissionRaw\": 105863, \"acRate\": \"49.4%\"}",
"stats": "{\"totalAccepted\": \"52.3K\", \"totalSubmission\": \"105.9K\", \"totalAcceptedRaw\": 52315, \"totalSubmissionRaw\": 105869, \"acRate\": \"49.4%\"}",
"hints": [],
"solution": {
"id": "103",

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"143.6K\", \"totalSubmission\": \"269.7K\", \"totalAcceptedRaw\": 143595, \"totalSubmissionRaw\": 269659, \"acRate\": \"53.3%\"}",
"stats": "{\"totalAccepted\": \"143.6K\", \"totalSubmission\": \"269.7K\", \"totalAcceptedRaw\": 143597, \"totalSubmissionRaw\": 269662, \"acRate\": \"53.3%\"}",
"hints": [],
"solution": {
"id": "14",

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"99.4K\", \"totalSubmission\": \"159.2K\", \"totalAcceptedRaw\": 99369, \"totalSubmissionRaw\": 159238, \"acRate\": \"62.4%\"}",
"stats": "{\"totalAccepted\": \"99.4K\", \"totalSubmission\": \"159.2K\", \"totalAcceptedRaw\": 99370, \"totalSubmissionRaw\": 159239, \"acRate\": \"62.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -11,7 +11,7 @@
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 3071,
"likes": 3072,
"dislikes": 305,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Binary Tree Level Order Traversal\", \"titleSlug\": \"binary-tree-level-order-traversal\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]",
@@ -52,7 +52,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"351.6K\", \"totalSubmission\": \"661.8K\", \"totalAcceptedRaw\": 351638, \"totalSubmissionRaw\": 661812, \"acRate\": \"53.1%\"}",
"stats": "{\"totalAccepted\": \"351.7K\", \"totalSubmission\": \"661.9K\", \"totalAcceptedRaw\": 351682, \"totalSubmissionRaw\": 661882, \"acRate\": \"53.1%\"}",
"hints": [
"Do BFS from the root. Let the root be at column 0. In the BFS, keep in the queue the node and its column.",
"When you traverse a node, store its value in the column index. For example, the root's value should be stored at index 0.",

View File

@@ -21,7 +21,7 @@
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"340\", \"totalSubmission\": \"388\", \"totalAcceptedRaw\": 340, \"totalSubmissionRaw\": 388, \"acRate\": \"87.6%\"}",
"stats": "{\"totalAccepted\": \"342\", \"totalSubmission\": \"390\", \"totalAcceptedRaw\": 342, \"totalSubmissionRaw\": 390, \"acRate\": \"87.7%\"}",
"hints": [
"The easiest way to solve this is to use the built-in fn.apply() method.",
"Without built-in methods, you need to figure out a way to call the function (this) from context object. That will associate \"this\" appropriately.",

View File

@@ -46,7 +46,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"803\", \"totalSubmission\": \"1.4K\", \"totalAcceptedRaw\": 803, \"totalSubmissionRaw\": 1372, \"acRate\": \"58.5%\"}",
"stats": "{\"totalAccepted\": \"804\", \"totalSubmission\": \"1.4K\", \"totalAcceptedRaw\": 804, \"totalSubmissionRaw\": 1373, \"acRate\": \"58.6%\"}",
"hints": [
"All the bits in the array elements will be set in the final result. Why?",
"Also, all the bits in the prefix sum array will be set in the final result. Why?",

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"76.6K\", \"totalSubmission\": \"148.3K\", \"totalAcceptedRaw\": 76551, \"totalSubmissionRaw\": 148293, \"acRate\": \"51.6%\"}",
"stats": "{\"totalAccepted\": \"76.6K\", \"totalSubmission\": \"148.3K\", \"totalAcceptedRaw\": 76563, \"totalSubmissionRaw\": 148307, \"acRate\": \"51.6%\"}",
"hints": [],
"solution": {
"id": "1047",

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"124.4K\", \"totalSubmission\": \"277.1K\", \"totalAcceptedRaw\": 124405, \"totalSubmissionRaw\": 277057, \"acRate\": \"44.9%\"}",
"stats": "{\"totalAccepted\": \"124.4K\", \"totalSubmission\": \"277.1K\", \"totalAcceptedRaw\": 124413, \"totalSubmissionRaw\": 277070, \"acRate\": \"44.9%\"}",
"hints": [],
"solution": {
"id": "97",

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"50.3K\", \"totalSubmission\": \"75.8K\", \"totalAcceptedRaw\": 50259, \"totalSubmissionRaw\": 75834, \"acRate\": \"66.3%\"}",
"stats": "{\"totalAccepted\": \"50.3K\", \"totalSubmission\": \"75.8K\", \"totalAcceptedRaw\": 50260, \"totalSubmissionRaw\": 75836, \"acRate\": \"66.3%\"}",
"hints": [
"All generated strings are of the same size. How can we generate all of these strings?",
"Do a backtracking on which each level of it has to choose one single (e.g. 'a') character or any character of the given parenthesized group (e.g. \"{a,b,c}\")"

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"2K\", \"totalSubmission\": \"3.7K\", \"totalAcceptedRaw\": 2039, \"totalSubmissionRaw\": 3722, \"acRate\": \"54.8%\"}",
"stats": "{\"totalAccepted\": \"2K\", \"totalSubmission\": \"3.7K\", \"totalAcceptedRaw\": 2042, \"totalSubmissionRaw\": 3728, \"acRate\": \"54.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"168.7K\", \"totalSubmission\": \"213K\", \"totalAcceptedRaw\": 168671, \"totalSubmissionRaw\": 213019, \"acRate\": \"79.2%\"}",
"stats": "{\"totalAccepted\": \"168.7K\", \"totalSubmission\": \"213.1K\", \"totalAcceptedRaw\": 168736, \"totalSubmissionRaw\": 213095, \"acRate\": \"79.2%\"}",
"hints": [
"You can traverse the buildings from the nearest to the ocean to the furthest.",
"Keep with you the maximum to the right while traversing to determine if you can see the ocean or not."

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"620\", \"totalSubmission\": \"868\", \"totalAcceptedRaw\": 620, \"totalSubmissionRaw\": 868, \"acRate\": \"71.4%\"}",
"stats": "{\"totalAccepted\": \"625\", \"totalSubmission\": \"876\", \"totalAcceptedRaw\": 625, \"totalSubmissionRaw\": 876, \"acRate\": \"71.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"22.6K\", \"totalSubmission\": \"28.6K\", \"totalAcceptedRaw\": 22625, \"totalSubmissionRaw\": 28631, \"acRate\": \"79.0%\"}",
"stats": "{\"totalAccepted\": \"22.6K\", \"totalSubmission\": \"28.6K\", \"totalAcceptedRaw\": 22628, \"totalSubmissionRaw\": 28642, \"acRate\": \"79.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"4K\", \"totalSubmission\": \"4.8K\", \"totalAcceptedRaw\": 3981, \"totalSubmissionRaw\": 4840, \"acRate\": \"82.3%\"}",
"stats": "{\"totalAccepted\": \"4K\", \"totalSubmission\": \"4.8K\", \"totalAcceptedRaw\": 3985, \"totalSubmissionRaw\": 4847, \"acRate\": \"82.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"69.7K\", \"totalSubmission\": \"119.3K\", \"totalAcceptedRaw\": 69718, \"totalSubmissionRaw\": 119279, \"acRate\": \"58.4%\"}",
"stats": "{\"totalAccepted\": \"69.7K\", \"totalSubmission\": \"119.3K\", \"totalAcceptedRaw\": 69722, \"totalSubmissionRaw\": 119287, \"acRate\": \"58.4%\"}",
"hints": [
"<p>Sort the elements by distance. In case of a tie, sort them by the index of the worker. After that, if there are still ties, sort them by the index of the bike.</p>\r\n\r\n<p>Can you do this in less than O(nlogn) time, where n is the total number of pairs between workers and bikes?</p>",
"Loop the sorted elements and match each pair of worker and bike if the given worker and bike where not used."

View File

@@ -46,7 +46,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"70.1K\", \"totalSubmission\": \"91.1K\", \"totalAcceptedRaw\": 70052, \"totalSubmissionRaw\": 91107, \"acRate\": \"76.9%\"}",
"stats": "{\"totalAccepted\": \"70.1K\", \"totalSubmission\": \"91.1K\", \"totalAcceptedRaw\": 70056, \"totalSubmissionRaw\": 91112, \"acRate\": \"76.9%\"}",
"hints": [
"Carefully perform the \"crush\" and \"gravity\" steps. In the crush step, flag each candy that should be removed, then go through and crush each flagged candy. In the gravity step, collect the candy in each column and then rewrite the column appropriately. Do these steps repeatedly until there's no work left to do."
],

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"3.3K\", \"totalSubmission\": \"6.5K\", \"totalAcceptedRaw\": 3287, \"totalSubmissionRaw\": 6498, \"acRate\": \"50.6%\"}",
"stats": "{\"totalAccepted\": \"3.3K\", \"totalSubmission\": \"6.5K\", \"totalAcceptedRaw\": 3290, \"totalSubmissionRaw\": 6509, \"acRate\": \"50.5%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -34,7 +34,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"46.4K\", \"totalSubmission\": \"79.1K\", \"totalAcceptedRaw\": 46410, \"totalSubmissionRaw\": 79087, \"acRate\": \"58.7%\"}",
"stats": "{\"totalAccepted\": \"46.4K\", \"totalSubmission\": \"79.1K\", \"totalAcceptedRaw\": 46411, \"totalSubmissionRaw\": 79089, \"acRate\": \"58.7%\"}",
"hints": [
"How to check if a given number target is a majority element?.",
"Find the frequency of target and compare it to the length of the array.",

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"3K\", \"totalSubmission\": \"6K\", \"totalAcceptedRaw\": 2989, \"totalSubmissionRaw\": 5962, \"acRate\": \"50.1%\"}",
"stats": "{\"totalAccepted\": \"3K\", \"totalSubmission\": \"6K\", \"totalAcceptedRaw\": 2992, \"totalSubmissionRaw\": 5965, \"acRate\": \"50.2%\"}",
"hints": [
"Can you use dynamic programming to solve the problem?",
"Let dp[i][j][diff] be true if there is a path from the cell (i, j) to (m - 1, n - 1) such that the difference between the number of 0s and the number of 1s that we visited so far is diff, or false otherwise. The answer to the problem will be dp[0][0][0]. How do you compute this dp?"

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"2.7K\", \"totalSubmission\": \"5.2K\", \"totalAcceptedRaw\": 2749, \"totalSubmissionRaw\": 5237, \"acRate\": \"52.5%\"}",
"stats": "{\"totalAccepted\": \"2.8K\", \"totalSubmission\": \"5.2K\", \"totalAcceptedRaw\": 2752, \"totalSubmissionRaw\": 5240, \"acRate\": \"52.5%\"}",
"hints": [
"Find the minimum spanning tree of the given graph.",
"Root the tree in an arbitrary node and calculate the maximum weight of the edge from each node to the chosen root.",

View File

@@ -52,7 +52,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"25.4K\", \"totalSubmission\": \"31.5K\", \"totalAcceptedRaw\": 25410, \"totalSubmissionRaw\": 31516, \"acRate\": \"80.6%\"}",
"stats": "{\"totalAccepted\": \"25.4K\", \"totalSubmission\": \"31.5K\", \"totalAcceptedRaw\": 25412, \"totalSubmissionRaw\": 31518, \"acRate\": \"80.6%\"}",
"hints": [
"Traverse the tree, keep a hashtable with you and create a nodecopy for each node in the tree.",
"Start traversing the original tree again and connect the left, right and random pointers in the cloned tree the same way as the original tree with the help of the hashtable."

View File

@@ -46,7 +46,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"27.3K\", \"totalSubmission\": \"32.8K\", \"totalAcceptedRaw\": 27335, \"totalSubmissionRaw\": 32848, \"acRate\": \"83.2%\"}",
"stats": "{\"totalAccepted\": \"27.3K\", \"totalSubmission\": \"32.8K\", \"totalAcceptedRaw\": 27336, \"totalSubmissionRaw\": 32849, \"acRate\": \"83.2%\"}",
"hints": [
"Traverse the tree, keep a hashtable with you and create a clone node for each node in the tree.",
"Start traversing the original tree again and connect each child pointer in the cloned tree the same way as the original tree with the help of the hashtable."

View File

@@ -64,7 +64,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"114.1K\", \"totalSubmission\": \"194.3K\", \"totalAcceptedRaw\": 114115, \"totalSubmissionRaw\": 194299, \"acRate\": \"58.7%\"}",
"stats": "{\"totalAccepted\": \"114.1K\", \"totalSubmission\": \"194.3K\", \"totalAcceptedRaw\": 114121, \"totalSubmissionRaw\": 194305, \"acRate\": \"58.7%\"}",
"hints": [
"Consider implement these two helper functions:\r\n<ol type=\"i\"><li><code>getPredecessor(N)</code>, which returns the next smaller node to N.</li>\r\n<li><code>getSuccessor(N)</code>, which returns the next larger node to N.</li>\r\n</ol>",
"Try to assume that each node has a parent pointer, it makes the problem much easier.",

View File

@@ -12,7 +12,7 @@
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 1733,
"dislikes": 116,
"dislikes": 117,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Count Complete Tree Nodes\", \"titleSlug\": \"count-complete-tree-nodes\", \"difficulty\": \"Easy\", \"translatedTitle\": null}, {\"title\": \"Closest Binary Search Tree Value II\", \"titleSlug\": \"closest-binary-search-tree-value-ii\", \"difficulty\": \"Hard\", \"translatedTitle\": null}, {\"title\": \"Search in a Binary Search Tree\", \"titleSlug\": \"search-in-a-binary-search-tree\", \"difficulty\": \"Easy\", \"translatedTitle\": null}, {\"title\": \"Closest Nodes Queries in a Binary Search Tree\", \"titleSlug\": \"closest-nodes-queries-in-a-binary-search-tree\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]",
"exampleTestcases": "[4,2,5,1,3]\n3.714286\n[1]\n4.428571",
@@ -52,7 +52,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"307.5K\", \"totalSubmission\": \"582.5K\", \"totalAcceptedRaw\": 307544, \"totalSubmissionRaw\": 582474, \"acRate\": \"52.8%\"}",
"stats": "{\"totalAccepted\": \"307.6K\", \"totalSubmission\": \"582.5K\", \"totalAcceptedRaw\": 307572, \"totalSubmissionRaw\": 582536, \"acRate\": \"52.8%\"}",
"hints": [],
"solution": {
"id": "749",

View File

@@ -46,7 +46,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"3.9K\", \"totalSubmission\": \"6.2K\", \"totalAcceptedRaw\": 3893, \"totalSubmissionRaw\": 6228, \"acRate\": \"62.5%\"}",
"stats": "{\"totalAccepted\": \"3.9K\", \"totalSubmission\": \"6.2K\", \"totalAcceptedRaw\": 3894, \"totalSubmissionRaw\": 6231, \"acRate\": \"62.5%\"}",
"hints": [
"For the ith query, find the distance from node_i to every other node in the tree.",
"We can use a BFS to find the distances.",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"3.5K\", \"totalSubmission\": \"10.7K\", \"totalAcceptedRaw\": 3540, \"totalSubmissionRaw\": 10713, \"acRate\": \"33.0%\"}",
"stats": "{\"totalAccepted\": \"3.5K\", \"totalSubmission\": \"10.7K\", \"totalAcceptedRaw\": 3544, \"totalSubmissionRaw\": 10734, \"acRate\": \"33.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"2.9K\", \"totalSubmission\": \"4.1K\", \"totalAcceptedRaw\": 2866, \"totalSubmissionRaw\": 4112, \"acRate\": \"69.7%\"}",
"stats": "{\"totalAccepted\": \"2.9K\", \"totalSubmission\": \"4.1K\", \"totalAcceptedRaw\": 2872, \"totalSubmissionRaw\": 4118, \"acRate\": \"69.7%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"42K\", \"totalSubmission\": \"86.6K\", \"totalAcceptedRaw\": 42032, \"totalSubmissionRaw\": 86632, \"acRate\": \"48.5%\"}",
"stats": "{\"totalAccepted\": \"42K\", \"totalSubmission\": \"86.6K\", \"totalAcceptedRaw\": 42036, \"totalSubmissionRaw\": 86641, \"acRate\": \"48.5%\"}",
"hints": [
"Reverse each digit with their corresponding new digit if an invalid digit is found the return -1. After reversing the digits just compare the reversed number with the original number."
],

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"80.3K\", \"totalSubmission\": \"121.1K\", \"totalAcceptedRaw\": 80310, \"totalSubmissionRaw\": 121112, \"acRate\": \"66.3%\"}",
"stats": "{\"totalAccepted\": \"80.3K\", \"totalSubmission\": \"121.1K\", \"totalAcceptedRaw\": 80313, \"totalSubmissionRaw\": 121118, \"acRate\": \"66.3%\"}",
"hints": [],
"solution": {
"id": "168",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"700\", \"totalSubmission\": \"2.8K\", \"totalAcceptedRaw\": 700, \"totalSubmissionRaw\": 2779, \"acRate\": \"25.2%\"}",
"stats": "{\"totalAccepted\": \"702\", \"totalSubmission\": \"2.8K\", \"totalAcceptedRaw\": 702, \"totalSubmissionRaw\": 2781, \"acRate\": \"25.2%\"}",
"hints": [],
"solution": {
"id": "2213",

View File

@@ -46,7 +46,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"85.8K\", \"totalSubmission\": \"152K\", \"totalAcceptedRaw\": 85778, \"totalSubmissionRaw\": 151958, \"acRate\": \"56.4%\"}",
"stats": "{\"totalAccepted\": \"85.8K\", \"totalSubmission\": \"152K\", \"totalAcceptedRaw\": 85780, \"totalSubmissionRaw\": 151964, \"acRate\": \"56.4%\"}",
"hints": [],
"solution": {
"id": "1111",

View File

@@ -64,7 +64,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"252.3K\", \"totalSubmission\": \"389.6K\", \"totalAcceptedRaw\": 252254, \"totalSubmissionRaw\": 389592, \"acRate\": \"64.7%\"}",
"stats": "{\"totalAccepted\": \"252.3K\", \"totalSubmission\": \"389.6K\", \"totalAcceptedRaw\": 252273, \"totalSubmissionRaw\": 389635, \"acRate\": \"64.7%\"}",
"hints": [],
"solution": {
"id": "711",

View File

@@ -21,7 +21,7 @@
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"321\", \"totalSubmission\": \"350\", \"totalAcceptedRaw\": 321, \"totalSubmissionRaw\": 350, \"acRate\": \"91.7%\"}",
"stats": "{\"totalAccepted\": \"322\", \"totalSubmission\": \"351\", \"totalAcceptedRaw\": 322, \"totalSubmissionRaw\": 351, \"acRate\": \"91.7%\"}",
"hints": [],
"solution": {
"id": "2137",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"11.8K\", \"totalSubmission\": \"13.7K\", \"totalAcceptedRaw\": 11781, \"totalSubmissionRaw\": 13711, \"acRate\": \"85.9%\"}",
"stats": "{\"totalAccepted\": \"11.8K\", \"totalSubmission\": \"13.7K\", \"totalAcceptedRaw\": 11783, \"totalSubmissionRaw\": 13713, \"acRate\": \"85.9%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -21,7 +21,7 @@
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"10.4K\", \"totalSubmission\": \"13.5K\", \"totalAcceptedRaw\": 10450, \"totalSubmissionRaw\": 13456, \"acRate\": \"77.7%\"}",
"stats": "{\"totalAccepted\": \"10.5K\", \"totalSubmission\": \"13.5K\", \"totalAcceptedRaw\": 10452, \"totalSubmissionRaw\": 13504, \"acRate\": \"77.4%\"}",
"hints": [
"Consider the 4 possibilities. The object could be an array, an object, a string, or another type.",
"Think about the problem recursively. If you know how to convert any sub-data into a string, how could you use it to convert the entire data into a string?",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"1.8K\", \"totalSubmission\": \"2.6K\", \"totalAcceptedRaw\": 1758, \"totalSubmissionRaw\": 2590, \"acRate\": \"67.9%\"}",
"stats": "{\"totalAccepted\": \"1.8K\", \"totalSubmission\": \"2.6K\", \"totalAcceptedRaw\": 1764, \"totalSubmissionRaw\": 2597, \"acRate\": \"67.9%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -21,7 +21,7 @@
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"511\", \"totalSubmission\": \"675\", \"totalAcceptedRaw\": 511, \"totalSubmissionRaw\": 675, \"acRate\": \"75.7%\"}",
"stats": "{\"totalAccepted\": \"512\", \"totalSubmission\": \"676\", \"totalAcceptedRaw\": 512, \"totalSubmissionRaw\": 676, \"acRate\": \"75.7%\"}",
"hints": [
"First, imagine that there is exactly one open door and try to solve the problem.",
"Now close an opened door.",

View File

@@ -34,7 +34,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"1.3K\", \"totalSubmission\": \"1.6K\", \"totalAcceptedRaw\": 1335, \"totalSubmissionRaw\": 1592, \"acRate\": \"83.9%\"}",
"stats": "{\"totalAccepted\": \"1.3K\", \"totalSubmission\": \"1.6K\", \"totalAcceptedRaw\": 1339, \"totalSubmissionRaw\": 1596, \"acRate\": \"83.9%\"}",
"hints": [
"Close the door of k houses moving in one direction.",
"Open the door of the current house.",

View File

@@ -46,7 +46,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"9.1K\", \"totalSubmission\": \"12.1K\", \"totalAcceptedRaw\": 9129, \"totalSubmissionRaw\": 12121, \"acRate\": \"75.3%\"}",
"stats": "{\"totalAccepted\": \"9.1K\", \"totalSubmission\": \"12.1K\", \"totalAcceptedRaw\": 9131, \"totalSubmissionRaw\": 12123, \"acRate\": \"75.3%\"}",
"hints": [
"Can we reuse previously calculated information?",
"How can we calculate the sum of the current subtree using the sum of the child's subtree?"

View File

@@ -21,7 +21,7 @@
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"506\", \"totalSubmission\": \"839\", \"totalAcceptedRaw\": 506, \"totalSubmissionRaw\": 839, \"acRate\": \"60.3%\"}",
"stats": "{\"totalAccepted\": \"507\", \"totalSubmission\": \"840\", \"totalAcceptedRaw\": 507, \"totalSubmissionRaw\": 840, \"acRate\": \"60.4%\"}",
"hints": [
"<div class=\"_1l1MA\">For each node, calculate a list of <code>k</code> values representing <code>k</code> smallest values in the subtree of that node.</div>",
"<div class=\"_1l1MA\">To check if a node is great enough, get the described list in the first hint for its children and merge them. Since the resulting list may contain more than <code>k</code> elements, pick <code>k</code> smallest values and discard the extra ones.</div>",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"1.8K\", \"totalSubmission\": \"3.4K\", \"totalAcceptedRaw\": 1804, \"totalSubmissionRaw\": 3420, \"acRate\": \"52.7%\"}",
"stats": "{\"totalAccepted\": \"1.8K\", \"totalSubmission\": \"3.4K\", \"totalAcceptedRaw\": 1814, \"totalSubmissionRaw\": 3435, \"acRate\": \"52.8%\"}",
"hints": [],
"solution": {
"id": "2195",

View File

@@ -12,7 +12,7 @@
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 40,
"dislikes": 53,
"dislikes": 54,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "\"abcd\"\n\"bccda\"\n\"ab\"\n\"cd\"",
@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"1.8K\", \"totalSubmission\": \"2.7K\", \"totalAcceptedRaw\": 1779, \"totalSubmissionRaw\": 2746, \"acRate\": \"64.8%\"}",
"stats": "{\"totalAccepted\": \"1.8K\", \"totalSubmission\": \"2.7K\", \"totalAcceptedRaw\": 1780, \"totalSubmissionRaw\": 2747, \"acRate\": \"64.8%\"}",
"hints": [
"If the chosen substrings are of size larger than 1, then you can remove all but the first character from both substrings, and you'll get equal substrings of size 1, with the same a but less j. Hence, it's always optimal to choose substrings of size 1.",
"If you choose a specific letter, then it's optimal to choose its first occurrence in firstString, and its last occurrence in secondString, to minimize j-a."

View File

@@ -34,7 +34,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"2.6K\", \"totalSubmission\": \"4K\", \"totalAcceptedRaw\": 2577, \"totalSubmissionRaw\": 4040, \"acRate\": \"63.8%\"}",
"stats": "{\"totalAccepted\": \"2.6K\", \"totalSubmission\": \"4K\", \"totalAcceptedRaw\": 2584, \"totalSubmissionRaw\": 4050, \"acRate\": \"63.8%\"}",
"hints": [
"How can we find the brightness at every position on the street?",
"We can use a hash table to store the change in brightness from the previous position to the current position."

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"5.7K\", \"totalSubmission\": \"7.5K\", \"totalAcceptedRaw\": 5659, \"totalSubmissionRaw\": 7464, \"acRate\": \"75.8%\"}",
"stats": "{\"totalAccepted\": \"5.7K\", \"totalSubmission\": \"7.5K\", \"totalAcceptedRaw\": 5663, \"totalSubmissionRaw\": 7469, \"acRate\": \"75.8%\"}",
"hints": [
"Find the number of strictly increasing subarrays that end at a specific index. Can you calculate that for each index from 0 to n - 1?",
"The answer will be the sum of the number of subarrays that end at each index."

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"1.2K\", \"totalSubmission\": \"1.6K\", \"totalAcceptedRaw\": 1154, \"totalSubmissionRaw\": 1582, \"acRate\": \"72.9%\"}",
"stats": "{\"totalAccepted\": \"1.2K\", \"totalSubmission\": \"1.6K\", \"totalAcceptedRaw\": 1159, \"totalSubmissionRaw\": 1590, \"acRate\": \"72.9%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -52,7 +52,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"1.9K\", \"totalSubmission\": \"3.3K\", \"totalAcceptedRaw\": 1885, \"totalSubmissionRaw\": 3298, \"acRate\": \"57.2%\"}",
"stats": "{\"totalAccepted\": \"1.9K\", \"totalSubmission\": \"3.3K\", \"totalAcceptedRaw\": 1885, \"totalSubmissionRaw\": 3301, \"acRate\": \"57.1%\"}",
"hints": [
"Use the frequency array of characters of the string.",
"For 1 ≤ m ≤ s.length, count the number of subsequences of s where each character occurs exactly m times.",

View File

@@ -11,7 +11,7 @@
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Hard",
"likes": 74,
"likes": 75,
"dislikes": 11,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Count of Smaller Numbers After Self\", \"titleSlug\": \"count-of-smaller-numbers-after-self\", \"difficulty\": \"Hard\", \"translatedTitle\": null}, {\"title\": \"Find All Good Indices\", \"titleSlug\": \"find-all-good-indices\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]",
@@ -64,7 +64,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"3.6K\", \"totalSubmission\": \"6.5K\", \"totalAcceptedRaw\": 3589, \"totalSubmissionRaw\": 6541, \"acRate\": \"54.9%\"}",
"stats": "{\"totalAccepted\": \"3.6K\", \"totalSubmission\": \"6.6K\", \"totalAcceptedRaw\": 3606, \"totalSubmissionRaw\": 6568, \"acRate\": \"54.9%\"}",
"hints": [
"The intended solution uses Fenwick Tree.",
"Lets describe the solution for counting the number of elements smaller than nums[i] in the range [0, i - 1], and counting in the range [i + 1, nums.length - 1] can be done similarly by simply reversing the array.",

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"1.8K\", \"totalSubmission\": \"3.6K\", \"totalAcceptedRaw\": 1771, \"totalSubmissionRaw\": 3575, \"acRate\": \"49.5%\"}",
"stats": "{\"totalAccepted\": \"1.8K\", \"totalSubmission\": \"3.6K\", \"totalAcceptedRaw\": 1775, \"totalSubmissionRaw\": 3579, \"acRate\": \"49.6%\"}",
"hints": [
"Split all numbers into several groups, with each group being an arithmetic sequence with a common difference of k.",
"How many K-free subsets are there for each group? This can be solved by dp: dp[i] = dp[i-1] + dp[i-2], meaning if we choose ith element, we cannot choose (i-1)th; otherwise we can choose (i-1)th element.",

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"147.5K\", \"totalSubmission\": \"262.7K\", \"totalAcceptedRaw\": 147458, \"totalSubmissionRaw\": 262722, \"acRate\": \"56.1%\"}",
"stats": "{\"totalAccepted\": \"147.5K\", \"totalSubmission\": \"262.7K\", \"totalAcceptedRaw\": 147465, \"totalSubmissionRaw\": 262737, \"acRate\": \"56.1%\"}",
"hints": [],
"solution": {
"id": "1875",

View File

@@ -34,7 +34,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"113.7K\", \"totalSubmission\": \"189.7K\", \"totalAcceptedRaw\": 113692, \"totalSubmissionRaw\": 189677, \"acRate\": \"59.9%\"}",
"stats": "{\"totalAccepted\": \"113.7K\", \"totalSubmission\": \"189.7K\", \"totalAcceptedRaw\": 113696, \"totalSubmissionRaw\": 189681, \"acRate\": \"59.9%\"}",
"hints": [
"Use hashset to store all elements.",
"Loop again to count all valid elements."

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"35K\", \"totalSubmission\": \"70.7K\", \"totalAcceptedRaw\": 35050, \"totalSubmissionRaw\": 70679, \"acRate\": \"49.6%\"}",
"stats": "{\"totalAccepted\": \"35.1K\", \"totalSubmission\": \"70.7K\", \"totalAcceptedRaw\": 35052, \"totalSubmissionRaw\": 70683, \"acRate\": \"49.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"21.7K\", \"totalSubmission\": \"28.7K\", \"totalAcceptedRaw\": 21694, \"totalSubmissionRaw\": 28745, \"acRate\": \"75.5%\"}",
"stats": "{\"totalAccepted\": \"21.7K\", \"totalSubmission\": \"28.7K\", \"totalAcceptedRaw\": 21698, \"totalSubmissionRaw\": 28749, \"acRate\": \"75.5%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -21,7 +21,7 @@
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"15.1K\", \"totalSubmission\": \"16.9K\", \"totalAcceptedRaw\": 15129, \"totalSubmissionRaw\": 16937, \"acRate\": \"89.3%\"}",
"stats": "{\"totalAccepted\": \"15.1K\", \"totalSubmission\": \"16.9K\", \"totalAcceptedRaw\": 15139, \"totalSubmissionRaw\": 16947, \"acRate\": \"89.3%\"}",
"hints": [
"You can access the count of parameters expected to passed into a function with \"fn.length\".",
"You can use recursion. If the length of params passed is equal to fn.length, you are done. Just pass those params to fn. Otherwise return a function that is includes the previous passed params plus the new params. The new function should contain a recursive call to curry()."

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"38.7K\", \"totalSubmission\": \"56.1K\", \"totalAcceptedRaw\": 38717, \"totalSubmissionRaw\": 56053, \"acRate\": \"69.1%\"}",
"stats": "{\"totalAccepted\": \"38.7K\", \"totalSubmission\": \"56.1K\", \"totalAcceptedRaw\": 38723, \"totalSubmissionRaw\": 56064, \"acRate\": \"69.1%\"}",
"hints": [],
"solution": {
"id": "2200",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"46.1K\", \"totalSubmission\": \"62.6K\", \"totalAcceptedRaw\": 46078, \"totalSubmissionRaw\": 62601, \"acRate\": \"73.6%\"}",
"stats": "{\"totalAccepted\": \"46.1K\", \"totalSubmission\": \"62.6K\", \"totalAcceptedRaw\": 46083, \"totalSubmissionRaw\": 62607, \"acRate\": \"73.6%\"}",
"hints": [],
"solution": {
"id": "2058",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"634\", \"totalSubmission\": \"1.8K\", \"totalAcceptedRaw\": 634, \"totalSubmissionRaw\": 1803, \"acRate\": \"35.2%\"}",
"stats": "{\"totalAccepted\": \"635\", \"totalSubmission\": \"1.8K\", \"totalAcceptedRaw\": 635, \"totalSubmissionRaw\": 1804, \"acRate\": \"35.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"1.9K\", \"totalSubmission\": \"4.8K\", \"totalAcceptedRaw\": 1929, \"totalSubmissionRaw\": 4771, \"acRate\": \"40.4%\"}",
"stats": "{\"totalAccepted\": \"1.9K\", \"totalSubmission\": \"4.8K\", \"totalAcceptedRaw\": 1935, \"totalSubmissionRaw\": 4781, \"acRate\": \"40.5%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -34,7 +34,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"56.9K\", \"totalSubmission\": \"116.1K\", \"totalAcceptedRaw\": 56879, \"totalSubmissionRaw\": 116131, \"acRate\": \"49.0%\"}",
"stats": "{\"totalAccepted\": \"56.9K\", \"totalSubmission\": \"116.1K\", \"totalAcceptedRaw\": 56890, \"totalSubmissionRaw\": 116143, \"acRate\": \"49.0%\"}",
"hints": [
"Use binary search on the answer.",
"You can get l/m branches of length m from a branch with length l."

View File

@@ -21,7 +21,7 @@
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"228\", \"totalSubmission\": \"275\", \"totalAcceptedRaw\": 228, \"totalSubmissionRaw\": 275, \"acRate\": \"82.9%\"}",
"stats": "{\"totalAccepted\": \"229\", \"totalSubmission\": \"276\", \"totalAcceptedRaw\": 229, \"totalSubmissionRaw\": 276, \"acRate\": \"83.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -21,7 +21,7 @@
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"272\", \"totalSubmission\": \"473\", \"totalAcceptedRaw\": 272, \"totalSubmissionRaw\": 473, \"acRate\": \"57.5%\"}",
"stats": "{\"totalAccepted\": \"275\", \"totalSubmission\": \"476\", \"totalAcceptedRaw\": 275, \"totalSubmissionRaw\": 476, \"acRate\": \"57.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@@ -21,7 +21,7 @@
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"321\", \"totalSubmission\": \"534\", \"totalAcceptedRaw\": 321, \"totalSubmissionRaw\": 534, \"acRate\": \"60.1%\"}",
"stats": "{\"totalAccepted\": \"322\", \"totalSubmission\": \"535\", \"totalAcceptedRaw\": 322, \"totalSubmissionRaw\": 535, \"acRate\": \"60.2%\"}",
"hints": [],
"solution": {
"id": "2085",

View File

@@ -28,7 +28,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"28.8K\", \"totalSubmission\": \"39.4K\", \"totalAcceptedRaw\": 28764, \"totalSubmissionRaw\": 39383, \"acRate\": \"73.0%\"}",
"stats": "{\"totalAccepted\": \"28.8K\", \"totalSubmission\": \"39.4K\", \"totalAcceptedRaw\": 28767, \"totalSubmissionRaw\": 39386, \"acRate\": \"73.0%\"}",
"hints": [
"Traverse the Linked List, each time you need to delete the next n nodes connect the nodes previous deleting with the next node after deleting."
],

View File

@@ -46,7 +46,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"2.1K\", \"totalSubmission\": \"4.7K\", \"totalAcceptedRaw\": 2124, \"totalSubmissionRaw\": 4743, \"acRate\": \"44.8%\"}",
"stats": "{\"totalAccepted\": \"2.1K\", \"totalSubmission\": \"4.7K\", \"totalAcceptedRaw\": 2124, \"totalSubmissionRaw\": 4745, \"acRate\": \"44.8%\"}",
"hints": [
"There are at most 2 possible places where a new node can be inserted?",
"How can we keep track of the depth of each node?"

View File

@@ -40,7 +40,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"69.1K\", \"totalSubmission\": \"101.6K\", \"totalAcceptedRaw\": 69126, \"totalSubmissionRaw\": 101582, \"acRate\": \"68.0%\"}",
"stats": "{\"totalAccepted\": \"69.1K\", \"totalSubmission\": \"101.6K\", \"totalAcceptedRaw\": 69127, \"totalSubmissionRaw\": 101588, \"acRate\": \"68.0%\"}",
"hints": [
"What data structure can we use to keep the players' data?",
"Keep a map (dictionary) of player scores.",

View File

@@ -52,7 +52,7 @@
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"1.3K\", \"totalSubmission\": \"2.1K\", \"totalAcceptedRaw\": 1255, \"totalSubmissionRaw\": 2097, \"acRate\": \"59.8%\"}",
"stats": "{\"totalAccepted\": \"1.3K\", \"totalSubmission\": \"2.1K\", \"totalAcceptedRaw\": 1258, \"totalSubmissionRaw\": 2102, \"acRate\": \"59.8%\"}",
"hints": [],
"solution": null,
"status": null,

Some files were not shown because too many files have changed in this diff Show More