questionFrontendId int64 1 3.51k | questionTitle stringlengths 3 79 | TitleSlug stringlengths 3 79 | content stringlengths 431 25.4k ⌀ | difficulty stringclasses 3
values | totalAccepted stringlengths 2 6 | totalSubmission stringlengths 2 6 | totalAcceptedRaw int64 124 16.8M | totalSubmissionRaw int64 285 30.3M | acRate stringlengths 4 5 | similarQuestions stringlengths 2 714 | mysqlSchemas stringclasses 295
values | category stringclasses 6
values | codeDefinition stringlengths 122 24.9k ⌀ | sampleTestCase stringlengths 1 4.33k | metaData stringlengths 37 3.13k | envInfo stringclasses 26
values | topicTags stringlengths 2 153 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Two Sum | two-sum | <p>Given an array of integers <code>nums</code> and an integer <code>target</code>, return <em>indices of the two numbers such that they add up to <code>target</code></em>.</p>
<p>You may assume that each input would have <strong><em>exactly</em> one solution</strong>, and you may not use the <em>same</em> elemen... | Easy | 16.8M | 30.3M | 16,787,625 | 30,334,274 | 55.3% | ['3sum', '4sum', 'two-sum-ii-input-array-is-sorted', 'two-sum-iii-data-structure-design', 'subarray-sum-equals-k', 'two-sum-iv-input-is-a-bst', 'two-sum-less-than-k', 'max-number-of-k-sum-pairs', 'count-good-meals', 'count-number-of-pairs-with-absolute-difference-k', 'number-of-pairs-of-strings-with-concatenation-equal... | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> twoSum(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] twoSum(int[] nums, int target) {\n \n }\n}"}, {"value": "python", "te... | [2,7,11,15]
9 | {
"name": "twoSum",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "integer[]",
"size": 2
},
"manual": false
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table'] |
2 | Add Two Numbers | add-two-numbers | <p>You are given two <strong>non-empty</strong> linked lists representing two non-negative integers. The digits are stored in <strong>reverse order</strong>, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.</p>
<p>You may assume the two numbers do not conta... | Medium | 5.6M | 12.3M | 5,606,520 | 12,261,739 | 45.7% | ['multiply-strings', 'add-binary', 'sum-of-two-integers', 'add-strings', 'add-two-numbers-ii', 'add-to-array-form-of-integer', 'add-two-polynomials-represented-as-linked-lists', 'double-a-number-represented-as-a-linked-list'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [2,4,3]
[5,6,4] | {
"name": "addTwoNumbers",
"params": [
{
"name": "l1",
"type": "ListNode",
"dealloc": false
},
{
"name": "l2",
"type": "ListNode",
"dealloc": false
}
],
"return": {
"type": "ListNode",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Math', 'Recursion'] |
3 | Longest Substring Without Repeating Characters | longest-substring-without-repeating-characters | <p>Given a string <code>s</code>, find the length of the <strong>longest</strong> <span data-keyword="substring-nonempty"><strong>substring</strong></span> without duplicate characters.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> s = "abcabcbb"
<strong>... | Medium | 7.2M | 19.8M | 7,234,473 | 19,794,857 | 36.5% | ['longest-substring-with-at-most-two-distinct-characters', 'longest-substring-with-at-most-k-distinct-characters', 'subarrays-with-k-different-integers', 'maximum-erasure-value', 'number-of-equal-count-substrings', 'minimum-consecutive-cards-to-pick-up', 'longest-nice-subarray', 'optimal-partition-of-string', 'count-co... | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int lengthOfLongestSubstring(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int lengthOfLongestSubstring(String s) {\n \n }\n}"}, {"value": "python", "text": "Pyt... | "abcabcbb" | {
"name": "lengthOfLongestSubstring",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Sliding Window'] |
4 | Median of Two Sorted Arrays | median-of-two-sorted-arrays | <p>Given two sorted arrays <code>nums1</code> and <code>nums2</code> of size <code>m</code> and <code>n</code> respectively, return <strong>the median</strong> of the two sorted arrays.</p>
<p>The overall run time complexity should be <code>O(log (m+n))</code>.</p>
<p> </p>
<p><strong class="example">Example 1:<... | Hard | 3.3M | 7.6M | 3,284,688 | 7,596,612 | 43.2% | ['median-of-a-row-wise-sorted-matrix'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double findMedianSortedArrays(int[] nums1, int[] nums2) {\n ... | [1,3]
[2] | {
"name": "findMedianSortedArrays",
"params": [
{
"name": "nums1",
"type": "integer[]"
},
{
"name": "nums2",
"type": "integer[]"
}
],
"return": {
"type": "double"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Divide and Conquer'] |
5 | Longest Palindromic Substring | longest-palindromic-substring | <p>Given a string <code>s</code>, return <em>the longest</em> <span data-keyword="palindromic-string"><em>palindromic</em></span> <span data-keyword="substring-nonempty"><em>substring</em></span> in <code>s</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> s = ... | Medium | 3.7M | 10.5M | 3,742,977 | 10,545,358 | 35.5% | ['shortest-palindrome', 'palindrome-permutation', 'palindrome-pairs', 'longest-palindromic-subsequence', 'palindromic-substrings', 'maximum-number-of-non-overlapping-palindrome-substrings'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string longestPalindrome(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String longestPalindrome(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "d... | "babad" | {
"name": "longestPalindrome",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Two Pointers', 'String', 'Dynamic Programming'] |
6 | Zigzag Conversion | zigzag-conversion | <p>The string <code>"PAYPALISHIRING"</code> is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)</p>
<pre>
P A H N
A P L S I I G
Y I R
</pre>
<p>And then read line by line: <code>"PAHNAPLSIIGYIR"<... | Medium | 1.7M | 3.3M | 1,702,325 | 3,332,883 | 51.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string convert(string s, int numRows) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String convert(String s, int numRows) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | "PAYPALISHIRING"
3 | {
"name": "convert",
"params": [
{
"name": "s",
"type": "string"
},
{
"name": "numRows",
"type": "integer"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String'] |
7 | Reverse Integer | reverse-integer | <p>Given a signed 32-bit integer <code>x</code>, return <code>x</code><em> with its digits reversed</em>. If reversing <code>x</code> causes the value to go outside the signed 32-bit integer range <code>[-2<sup>31</sup>, 2<sup>31</sup> - 1]</code>, then return <code>0</code>.</p>
<p><strong>Assume the environment does... | Medium | 4M | 13.2M | 3,951,399 | 13,166,975 | 30.0% | ['string-to-integer-atoi', 'reverse-bits', 'a-number-after-a-double-reversal', 'count-number-of-distinct-integers-after-reverse-operations'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int reverse(int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int reverse(int x) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solution(obj... | 123 | {
"name": "reverse",
"params": [
{
"name": "x",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math'] |
8 | String to Integer (atoi) | string-to-integer-atoi | <p>Implement the <code>myAtoi(string s)</code> function, which converts a string to a 32-bit signed integer.</p>
<p>The algorithm for <code>myAtoi(string s)</code> is as follows:</p>
<ol>
<li><strong>Whitespace</strong>: Ignore any leading whitespace (<code>" "</code>).</li>
<li><strong>Signedness</strong... | Medium | 1.9M | 10.1M | 1,913,260 | 10,125,663 | 18.9% | ['reverse-integer', 'valid-number', 'check-if-numbers-are-ascending-in-a-sentence'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int myAtoi(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int myAtoi(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solution... | "42" | {
"name": "myAtoi",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String'] |
9 | Palindrome Number | palindrome-number | <p>Given an integer <code>x</code>, return <code>true</code><em> if </em><code>x</code><em> is a </em><span data-keyword="palindrome-integer"><em><strong>palindrome</strong></em></span><em>, and </em><code>false</code><em> otherwise</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<str... | Easy | 6.2M | 10.5M | 6,159,089 | 10,462,661 | 58.9% | ['palindrome-linked-list', 'find-palindrome-with-fixed-length', 'strictly-palindromic-number', 'count-symmetric-integers', 'find-the-count-of-good-integers', 'find-the-largest-palindrome-divisible-by-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isPalindrome(int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isPalindrome(int x) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cla... | 121 | {
"name": "isPalindrome",
"params": [
{
"name": "x",
"type": "integer"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math'] |
10 | Regular Expression Matching | regular-expression-matching | <p>Given an input string <code>s</code> and a pattern <code>p</code>, implement regular expression matching with support for <code>'.'</code> and <code>'*'</code> where:</p>
<ul>
<li><code>'.'</code> Matches any single character.</li>
<li><code>'*'</code> Matches zero or more... | Hard | 1.1M | 3.9M | 1,131,845 | 3,893,591 | 29.1% | ['wildcard-matching'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isMatch(string s, string p) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isMatch(String s, String p) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | "aa"
"a" | {
"name": "isMatch",
"params": [
{
"name": "s",
"type": "string"
},
{
"name": "p",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming', 'Recursion'] |
11 | Container With Most Water | container-with-most-water | <p>You are given an integer array <code>height</code> of length <code>n</code>. There are <code>n</code> vertical lines drawn such that the two endpoints of the <code>i<sup>th</sup></code> line are <code>(i, 0)</code> and <code>(i, height[i])</code>.</p>
<p>Find two lines that together with the x-axis form a container... | Medium | 3.9M | 6.8M | 3,927,910 | 6,842,402 | 57.4% | ['trapping-rain-water', 'maximum-tastiness-of-candy-basket', 'house-robber-iv'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxArea(vector<int>& height) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxArea(int[] height) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode"... | [1,8,6,2,5,4,8,3,7] | {
"name": "maxArea",
"params": [
{
"name": "height",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Greedy'] |
12 | Integer to Roman | integer-to-roman | <p>Seven different symbols represent Roman numerals with the following values:</p>
<table>
<thead>
<tr>
<th>Symbol</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>I</td>
<td>1</td>
</tr>
<tr>
<td>V</td>
<td>5</td>
</tr>
<tr>
<td>X</td>
<td>10</td>
</tr>
<tr>
<td>L</t... | Medium | 1.7M | 2.5M | 1,676,934 | 2,462,404 | 68.1% | ['roman-to-integer', 'integer-to-english-words'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string intToRoman(int num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String intToRoman(int num) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cl... | 3749 | {
"name": "intToRoman",
"params": [
{
"name": "num",
"type": "integer"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'Math', 'String'] |
13 | Roman to Integer | roman-to-integer | <p>Roman numerals are represented by seven different symbols: <code>I</code>, <code>V</code>, <code>X</code>, <code>L</code>, <code>C</code>, <code>D</code> and <code>M</code>.</p>
<pre>
<strong>Symbol</strong> <strong>Value</strong>
I 1
V 5
X 10
L 50
C ... | Easy | 4.7M | 7.3M | 4,677,244 | 7,260,584 | 64.4% | ['integer-to-roman'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int romanToInt(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int romanToInt(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class ... | "III" | {
"name": "romanToInt",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'Math', 'String'] |
14 | Longest Common Prefix | longest-common-prefix | <p>Write a function to find the longest common prefix string amongst an array of strings.</p>
<p>If there is no common prefix, return an empty string <code>""</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> strs = ["flower","flow&quo... | Easy | 4.4M | 9.7M | 4,374,619 | 9,698,637 | 45.1% | ['smallest-missing-integer-greater-than-sequential-prefix-sum', 'find-the-length-of-the-longest-common-prefix', 'longest-common-suffix-queries', 'longest-common-prefix-after-at-most-one-removal'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string longestCommonPrefix(vector<string>& strs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String longestCommonPrefix(String[] strs) {\n \n }\n}"}, {"value": "python",... | ["flower","flow","flight"] | {
"name": "longestCommonPrefix",
"params": [
{
"name": "strs",
"type": "string[]"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Trie'] |
15 | 3Sum | 3sum | <p>Given an integer array nums, return all the triplets <code>[nums[i], nums[j], nums[k]]</code> such that <code>i != j</code>, <code>i != k</code>, and <code>j != k</code>, and <code>nums[i] + nums[j] + nums[k] == 0</code>.</p>
<p>Notice that the solution set must not contain duplicate triplets.</p>
<p> </p>
<p... | Medium | 4.6M | 12.4M | 4,558,708 | 12,432,360 | 36.7% | ['two-sum', '3sum-closest', '4sum', '3sum-smaller', 'number-of-arithmetic-triplets', 'minimum-sum-of-mountain-triplets-i', 'minimum-sum-of-mountain-triplets-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> threeSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> threeSum(int[] nums) {\n \n }\n}"}, {"value": "python", "... | [-1,0,1,2,-1,-4] | {
"name": "threeSum",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "list<list<integer>>",
"colsize": 3,
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Sorting'] |
16 | 3Sum Closest | 3sum-closest | <p>Given an integer array <code>nums</code> of length <code>n</code> and an integer <code>target</code>, find three integers in <code>nums</code> such that the sum is closest to <code>target</code>.</p>
<p>Return <em>the sum of the three integers</em>.</p>
<p>You may assume that each input would have exactly one solu... | Medium | 1.5M | 3.1M | 1,454,764 | 3,115,410 | 46.7% | ['3sum', '3sum-smaller'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int threeSumClosest(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int threeSumClosest(int[] nums, int target) {\n \n }\n}"}, {"value": "pyth... | [-1,2,1,-4]
1 | {
"name": "threeSumClosest",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Sorting'] |
17 | Letter Combinations of a Phone Number | letter-combinations-of-a-phone-number | <p>Given a string containing digits from <code>2-9</code> inclusive, return all possible letter combinations that the number could represent. Return the answer in <strong>any order</strong>.</p>
<p>A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any lette... | Medium | 2.5M | 3.9M | 2,479,182 | 3,912,164 | 63.4% | ['generate-parentheses', 'combination-sum', 'binary-watch', 'count-number-of-texts', 'minimum-number-of-pushes-to-type-word-i', 'minimum-number-of-pushes-to-type-word-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> letterCombinations(string digits) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> letterCombinations(String digits) {\n \n }\n}"}, {"value": "pyt... | "23" | {
"name": "letterCombinations",
"params": [
{
"name": "digits",
"type": "string"
}
],
"return": {
"type": "list<string>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Backtracking'] |
18 | 4Sum | 4sum | <p>Given an array <code>nums</code> of <code>n</code> integers, return <em>an array of all the <strong>unique</strong> quadruplets</em> <code>[nums[a], nums[b], nums[c], nums[d]]</code> such that:</p>
<ul>
<li><code>0 <= a, b, c, d < n</code></li>
<li><code>a</code>, <code>b</code>, <code>c</code>, and <c... | Medium | 1.2M | 3.3M | 1,235,151 | 3,266,631 | 37.8% | ['two-sum', '3sum', '4sum-ii', 'count-special-quadruplets'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> fourSum(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> fourSum(int[] nums, int target) {\n \n }\n}"},... | [1,0,-1,0,-2,2]
0 | {
"name": "fourSum",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "list<list<integer>>",
"colsize": 4,
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Sorting'] |
19 | Remove Nth Node From End of List | remove-nth-node-from-end-of-list | <p>Given the <code>head</code> of a linked list, remove the <code>n<sup>th</sup></code> node from the end of the list and return its head.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2020/10/03/remove_ex1.jpg" style="width: 542px; height: 22... | Medium | 3.4M | 7M | 3,368,182 | 6,957,603 | 48.4% | ['swapping-nodes-in-a-linked-list', 'delete-n-nodes-after-m-nodes-of-a-linked-list', 'delete-the-middle-node-of-a-linked-list'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [1,2,3,4,5]
2 | {
"name": "removeNthFromEnd",
"params": [
{
"name": "head",
"type": "ListNode",
"dealloc": false
},
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "ListNode",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Two Pointers'] |
20 | Valid Parentheses | valid-parentheses | <p>Given a string <code>s</code> containing just the characters <code>'('</code>, <code>')'</code>, <code>'{'</code>, <code>'}'</code>, <code>'['</code> and <code>']'</code>, determine if the input string is valid.</p>
<p>An input string is valid if:</p>
<ol>
<li>Open ... | Easy | 5.9M | 14M | 5,883,846 | 14,000,480 | 42.0% | ['generate-parentheses', 'longest-valid-parentheses', 'remove-invalid-parentheses', 'check-if-word-is-valid-after-substitutions', 'check-if-a-parentheses-string-can-be-valid', 'move-pieces-to-obtain-a-string'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isValid(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isValid(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class S... | "()" | {
"name": "isValid",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Stack'] |
21 | Merge Two Sorted Lists | merge-two-sorted-lists | <p>You are given the heads of two sorted linked lists <code>list1</code> and <code>list2</code>.</p>
<p>Merge the two lists into one <strong>sorted</strong> list. The list should be made by splicing together the nodes of the first two lists.</p>
<p>Return <em>the head of the merged linked list</em>.</p>
<p> </p... | Easy | 5.1M | 7.7M | 5,111,636 | 7,687,513 | 66.5% | ['merge-k-sorted-lists', 'merge-sorted-array', 'sort-list', 'shortest-word-distance-ii', 'add-two-polynomials-represented-as-linked-lists', 'longest-common-subsequence-between-sorted-arrays', 'merge-two-2d-arrays-by-summing-values'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [1,2,4]
[1,3,4] | {
"name": "mergeTwoLists",
"params": [
{
"name": "list1",
"type": "ListNode",
"dealloc": false
},
{
"name": "list2",
"type": "ListNode",
"dealloc": false
}
],
"return": {
"type": "ListNode",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Recursion'] |
22 | Generate Parentheses | generate-parentheses | <p>Given <code>n</code> pairs of parentheses, write a function to <em>generate all combinations of well-formed parentheses</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> n = 3
<strong>Output:</strong> ["((()))","(()())","(())()","()(())","()()()"]
</pre><p><stro... | Medium | 2.3M | 3M | 2,286,059 | 2,978,450 | 76.8% | ['letter-combinations-of-a-phone-number', 'valid-parentheses', 'check-if-a-parentheses-string-can-be-valid'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> generateParenthesis(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> generateParenthesis(int n) {\n \n }\n}"}, {"value": "python", "text": ... | 3 | {
"name": "generateParenthesis",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "list<string>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming', 'Backtracking'] |
23 | Merge k Sorted Lists | merge-k-sorted-lists | <p>You are given an array of <code>k</code> linked-lists <code>lists</code>, each linked-list is sorted in ascending order.</p>
<p><em>Merge all the linked-lists into one sorted linked-list and return it.</em></p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> lists = ... | Hard | 2.4M | 4.3M | 2,428,169 | 4,323,382 | 56.2% | ['merge-two-sorted-lists', 'ugly-number-ii', 'smallest-subarrays-with-maximum-bitwise-or'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [[1,4,5],[1,3,4],[2,6]] | {
"name": "mergeKLists",
"params": [
{
"name": "lists",
"type": "ListNode[]",
"dealloc": false
}
],
"return": {
"type": "ListNode",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Divide and Conquer', 'Heap (Priority Queue)', 'Merge Sort'] |
24 | Swap Nodes in Pairs | swap-nodes-in-pairs | <p>Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.)</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong... | Medium | 1.6M | 2.4M | 1,595,933 | 2,390,687 | 66.8% | ['reverse-nodes-in-k-group', 'swapping-nodes-in-a-linked-list'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [1,2,3,4] | {
"name": "swapPairs",
"params": [
{
"name": "head",
"type": "ListNode"
}
],
"return": {
"type": "ListNode"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Recursion'] |
25 | Reverse Nodes in k-Group | reverse-nodes-in-k-group | <p>Given the <code>head</code> of a linked list, reverse the nodes of the list <code>k</code> at a time, and return <em>the modified list</em>.</p>
<p><code>k</code> is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of <code>k</code> then left-ou... | Hard | 1.2M | 1.9M | 1,186,630 | 1,901,405 | 62.4% | ['swap-nodes-in-pairs', 'swapping-nodes-in-a-linked-list', 'reverse-nodes-in-even-length-groups'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [1,2,3,4,5]
2 | {
"name": "reverseKGroup",
"params": [
{
"name": "head",
"type": "ListNode"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "ListNode"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Recursion'] |
26 | Remove Duplicates from Sorted Array | remove-duplicates-from-sorted-array | <p>Given an integer array <code>nums</code> sorted in <strong>non-decreasing order</strong>, remove the duplicates <a href="https://en.wikipedia.org/wiki/In-place_algorithm" target="_blank"><strong>in-place</strong></a> such that each unique element appears only <strong>once</strong>. The <strong>relative order</strong... | Easy | 6M | 10M | 5,991,178 | 10,016,824 | 59.8% | ['remove-element', 'remove-duplicates-from-sorted-array-ii', 'apply-operations-to-an-array', 'sum-of-distances'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int removeDuplicates(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int removeDuplicates(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [1,1,2] | {
"name": "removeDuplicates",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
},
"output": {
"paramindex": 0,
"size": "ret"
},
"languages": [
"cpp",
"java",
"python",
"c",
"csharp",
"javascript",
"ruby",
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers'] |
27 | Remove Element | remove-element | <p>Given an integer array <code>nums</code> and an integer <code>val</code>, remove all occurrences of <code>val</code> in <code>nums</code> <a href="https://en.wikipedia.org/wiki/In-place_algorithm" target="_blank"><strong>in-place</strong></a>. The order of the elements may be changed. Then return <em>the number of e... | Easy | 4.1M | 6.8M | 4,068,742 | 6,817,163 | 59.7% | ['remove-duplicates-from-sorted-array', 'remove-linked-list-elements', 'move-zeroes'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int removeElement(vector<int>& nums, int val) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int removeElement(int[] nums, int val) {\n \n }\n}"}, {"value": "python", "text... | [3,2,2,3]
3 | {
"name": "removeElement",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "val",
"type": "integer"
}
],
"return": {
"type": "integer"
},
"output": {
"paramindex": 0,
"size": "ret"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers'] |
28 | Find the Index of the First Occurrence in a String | find-the-index-of-the-first-occurrence-in-a-string | <p>Given two strings <code>needle</code> and <code>haystack</code>, return the index of the first occurrence of <code>needle</code> in <code>haystack</code>, or <code>-1</code> if <code>needle</code> is not part of <code>haystack</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<stro... | Easy | 3.2M | 7.2M | 3,210,145 | 7,188,851 | 44.7% | ['shortest-palindrome', 'repeated-substring-pattern'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int strStr(string haystack, string needle) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int strStr(String haystack, String needle) {\n \n }\n}"}, {"value": "python", "tex... | "sadbutsad"
"sad" | {
"name": "strStr",
"params": [
{
"name": "haystack",
"type": "string"
},
{
"name": "needle",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Two Pointers', 'String', 'String Matching'] |
29 | Divide Two Integers | divide-two-integers | <p>Given two integers <code>dividend</code> and <code>divisor</code>, divide two integers <strong>without</strong> using multiplication, division, and mod operator.</p>
<p>The integer division should truncate toward zero, which means losing its fractional part. For example, <code>8.345</code> would be truncated to <co... | Medium | 912.6K | 5M | 912,649 | 5,004,485 | 18.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int divide(int dividend, int divisor) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int divide(int dividend, int divisor) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | 10
3 | {
"name": "divide",
"params": [
{
"name": "dividend",
"type": "integer"
},
{
"name": "divisor",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Bit Manipulation'] |
30 | Substring with Concatenation of All Words | substring-with-concatenation-of-all-words | <p>You are given a string <code>s</code> and an array of strings <code>words</code>. All the strings of <code>words</code> are of <strong>the same length</strong>.</p>
<p>A <strong>concatenated string</strong> is a string that exactly contains all the strings of any permutation of <code>words</code> concatenated.</p>
... | Hard | 562.9K | 1.7M | 562,893 | 1,712,563 | 32.9% | ['minimum-window-substring'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findSubstring(string s, vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> findSubstring(String s, String[] words) {\n \n }\n}"... | "barfoothefoobarman"
["foo","bar"] | {
"name": "findSubstring",
"params": [
{
"name": "s",
"type": "string"
},
{
"name": "words",
"type": "string[]"
}
],
"return": {
"type": "list<integer>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Sliding Window'] |
31 | Next Permutation | next-permutation | <p>A <strong>permutation</strong> of an array of integers is an arrangement of its members into a sequence or linear order.</p>
<ul>
<li>For example, for <code>arr = [1,2,3]</code>, the following are all the permutations of <code>arr</code>: <code>[1,2,3], [1,3,2], [2, 1, 3], [2, 3, 1], [3,1,2], [3,2,1]</code>.</li>
... | Medium | 1.8M | 4.1M | 1,753,130 | 4,116,272 | 42.6% | ['permutations', 'permutations-ii', 'permutation-sequence', 'palindrome-permutation-ii', 'minimum-adjacent-swaps-to-reach-the-kth-smallest-number'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n void nextPermutation(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public void nextPermutation(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [1,2,3] | {
"name": "nextPermutation",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "void"
},
"output": {
"paramindex": 0
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers'] |
32 | Longest Valid Parentheses | longest-valid-parentheses | <p>Given a string containing just the characters <code>'('</code> and <code>')'</code>, return <em>the length of the longest valid (well-formed) parentheses </em><span data-keyword="substring-nonempty"><em>substring</em></span>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre... | Hard | 881.8K | 2.5M | 881,795 | 2,455,894 | 35.9% | ['valid-parentheses'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestValidParentheses(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestValidParentheses(String s) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | "(()" | {
"name": "longestValidParentheses",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming', 'Stack'] |
33 | Search in Rotated Sorted Array | search-in-rotated-sorted-array | <p>There is an integer array <code>nums</code> sorted in ascending order (with <strong>distinct</strong> values).</p>
<p>Prior to being passed to your function, <code>nums</code> is <strong>possibly rotated</strong> at an unknown pivot index <code>k</code> (<code>1 <= k < nums.length</code>) such that the result... | Medium | 3.5M | 8.2M | 3,470,609 | 8,164,122 | 42.5% | ['search-in-rotated-sorted-array-ii', 'find-minimum-in-rotated-sorted-array', 'pour-water-between-buckets-to-make-water-levels-equal'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int search(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int search(int[] nums, int target) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [4,5,6,7,0,1,2]
0 | {
"name": "search",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search'] |
34 | Find First and Last Position of Element in Sorted Array | find-first-and-last-position-of-element-in-sorted-array | <p>Given an array of integers <code>nums</code> sorted in non-decreasing order, find the starting and ending position of a given <code>target</code> value.</p>
<p>If <code>target</code> is not found in the array, return <code>[-1, -1]</code>.</p>
<p>You must write an algorithm with <code>O(log n)</code> run... | Medium | 2.6M | 5.6M | 2,581,439 | 5,564,653 | 46.4% | ['first-bad-version', 'plates-between-candles', 'find-target-indices-after-sorting-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> searchRange(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] searchRange(int[] nums, int target) {\n \n }\n}"}, {"value": "py... | [5,7,7,8,8,10]
8 | {
"name": "searchRange",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search'] |
35 | Search Insert Position | search-insert-position | <p>Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.</p>
<p>You must write an algorithm with <code>O(log n)</code> runtime complexity.</p>
<p> </p>
<p><strong class="example">Ex... | Easy | 3.7M | 7.6M | 3,695,979 | 7,608,049 | 48.6% | ['first-bad-version', 'minimum-operations-to-exceed-threshold-value-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int searchInsert(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int searchInsert(int[] nums, int target) {\n \n }\n}"}, {"value": "python", "... | [1,3,5,6]
5 | {
"name": "searchInsert",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search'] |
36 | Valid Sudoku | valid-sudoku | <p>Determine if a <code>9 x 9</code> Sudoku board is valid. Only the filled cells need to be validated <strong>according to the following rules</strong>:</p>
<ol>
<li>Each row must contain the digits <code>1-9</code> without repetition.</li>
<li>Each column must contain the digits&... | Medium | 1.9M | 3.1M | 1,931,272 | 3,120,199 | 61.9% | ['sudoku-solver', 'check-if-every-row-and-column-contains-all-numbers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isValidSudoku(vector<vector<char>>& board) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isValidSudoku(char[][] board) {\n \n }\n}"}, {"value": "python", "tex... | [["5","3",".",".","7",".",".",".","."],["6",".",".","1","9","5",".",".","."],[".","9","8",".",".",".",".","6","."],["8",".",".",".","6",".",".",".","3"],["4",".",".","8",".","3",".",".","1"],["7",".",".",".","2",".",".",".","6"],[".","6",".",".",".",".","2","8","."],[".",".",".","4","1","9",".",".","5"],[".",".",".",".... | {
"name": "isValidSudoku",
"params": [
{
"name": "board",
"type": "character[][]"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Matrix'] |
37 | Sudoku Solver | sudoku-solver | <p>Write a program to solve a Sudoku puzzle by filling the empty cells.</p>
<p>A sudoku solution must satisfy <strong>all of the following rules</strong>:</p>
<ol>
<li>Each of the digits <code>1-9</code> must occur exactly once in each row.</li>
<li>Each of the digits <code>1-9</code> must occur exactly once in eac... | Hard | 743.9K | 1.2M | 743,905 | 1,167,713 | 63.7% | ['valid-sudoku', 'unique-paths-iii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n void solveSudoku(vector<vector<char>>& board) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public void solveSudoku(char[][] board) {\n \n }\n}"}, {"value": "python", "text": "Py... | [["5","3",".",".","7",".",".",".","."],["6",".",".","1","9","5",".",".","."],[".","9","8",".",".",".",".","6","."],["8",".",".",".","6",".",".",".","3"],["4",".",".","8",".","3",".",".","1"],["7",".",".",".","2",".",".",".","6"],[".","6",".",".",".",".","2","8","."],[".",".",".","4","1","9",".",".","5"],[".",".",".",".... | {
"name": "solveSudoku",
"params": [
{
"name": "board",
"type": "character[][]"
}
],
"return": {
"type": "void"
},
"output": {
"paramindex": 0
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Backtracking', 'Matrix'] |
38 | Count and Say | count-and-say | <p>The <strong>count-and-say</strong> sequence is a sequence of digit strings defined by the recursive formula:</p>
<ul>
<li><code>countAndSay(1) = "1"</code></li>
<li><code>countAndSay(n)</code> is the run-length encoding of <code>countAndSay(n - 1)</code>.</li>
</ul>
<p><a href="http://en.wikipedia.org/... | Medium | 1.1M | 1.9M | 1,096,255 | 1,883,972 | 58.2% | ['encode-and-decode-strings', 'string-compression'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string countAndSay(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String countAndSay(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "clas... | 1 | {
"name": "countAndSay",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String'] |
39 | Combination Sum | combination-sum | <p>Given an array of <strong>distinct</strong> integers <code>candidates</code> and a target integer <code>target</code>, return <em>a list of all <strong>unique combinations</strong> of </em><code>candidates</code><em> where the chosen numbers sum to </em><code>target</code><em>.</em> You may return the combinations i... | Medium | 2.5M | 3.3M | 2,458,098 | 3,313,201 | 74.2% | ['letter-combinations-of-a-phone-number', 'combination-sum-ii', 'combinations', 'combination-sum-iii', 'factor-combinations', 'combination-sum-iv', 'the-number-of-ways-to-make-the-sum'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> combinationSum(vector<int>& candidates, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> combinationSum(int[] candidates, int target... | [2,3,6,7]
7 | {
"name": "combinationSum",
"params": [
{
"name": "candidates",
"type": "integer[]"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "list<list<integer>>",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Backtracking'] |
40 | Combination Sum II | combination-sum-ii | <p>Given a collection of candidate numbers (<code>candidates</code>) and a target number (<code>target</code>), find all unique combinations in <code>candidates</code> where the candidate numbers sum to <code>target</code>.</p>
<p>Each number in <code>candidates</code> may only be used <strong>once</strong> ... | Medium | 1.3M | 2.3M | 1,340,117 | 2,336,886 | 57.3% | ['combination-sum'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> combinationSum2(vector<int>& candidates, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> combinationSum2(int[] candidates, int targ... | [10,1,2,7,6,1,5]
8 | {
"name": "combinationSum2",
"params": [
{
"name": "candidates",
"type": "integer[]"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "list<list<integer>>",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Backtracking'] |
41 | First Missing Positive | first-missing-positive | <p>Given an unsorted integer array <code>nums</code>. Return the <em>smallest positive integer</em> that is <em>not present</em> in <code>nums</code>.</p>
<p>You must implement an algorithm that runs in <code>O(n)</code> time and uses <code>O(1)</code> auxiliary space.</p>
<p> </p>
<p><strong class="example">Exa... | Hard | 1.4M | 3.5M | 1,433,875 | 3,514,023 | 40.8% | ['missing-number', 'find-the-duplicate-number', 'find-all-numbers-disappeared-in-an-array', 'couples-holding-hands', 'smallest-number-in-infinite-set', 'maximum-number-of-integers-to-choose-from-a-range-i', 'smallest-missing-non-negative-integer-after-operations', 'maximum-number-of-integers-to-choose-from-a-range-ii',... | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int firstMissingPositive(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int firstMissingPositive(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "... | [1,2,0] | {
"name": "firstMissingPositive",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table'] |
42 | Trapping Rain Water | trapping-rain-water | <p>Given <code>n</code> non-negative integers representing an elevation map where the width of each bar is <code>1</code>, compute how much water it can trap after raining.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img src="https://assets.leetcode.com/uploads/2018/10/22/rainwatertrap.png" s... | Hard | 2.7M | 4.2M | 2,724,310 | 4,219,175 | 64.6% | ['container-with-most-water', 'product-of-array-except-self', 'trapping-rain-water-ii', 'pour-water', 'maximum-value-of-an-ordered-triplet-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int trap(vector<int>& height) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int trap(int[] height) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cla... | [0,1,0,2,1,0,1,3,2,1,2,1] | {
"name": "trap",
"params": [
{
"name": "height",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Dynamic Programming', 'Stack', 'Monotonic Stack'] |
43 | Multiply Strings | multiply-strings | <p>Given two non-negative integers <code>num1</code> and <code>num2</code> represented as strings, return the product of <code>num1</code> and <code>num2</code>, also represented as a string.</p>
<p><strong>Note:</strong> You must not use any built-in BigInteger library or convert the inputs to integer directly.<... | Medium | 952.8K | 2.3M | 952,804 | 2,268,123 | 42.0% | ['add-two-numbers', 'plus-one', 'add-binary', 'add-strings', 'apply-discount-to-prices'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string multiply(string num1, string num2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String multiply(String num1, String num2) {\n \n }\n}"}, {"value": "python", "text"... | "2"
"3" | {
"name": "multiply",
"params": [
{
"name": "num1",
"type": "string"
},
{
"name": "num2",
"type": "string"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'String', 'Simulation'] |
44 | Wildcard Matching | wildcard-matching | <p>Given an input string (<code>s</code>) and a pattern (<code>p</code>), implement wildcard pattern matching with support for <code>'?'</code> and <code>'*'</code> where:</p>
<ul>
<li><code>'?'</code> Matches any single character.</li>
<li><code>'*'</code> Matches any sequence of cha... | Hard | 696K | 2.4M | 695,977 | 2,356,365 | 29.5% | ['regular-expression-matching', 'substring-matching-pattern'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isMatch(string s, string p) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isMatch(String s, String p) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | "aa"
"a" | {
"name": "isMatch",
"params": [
{
"name": "s",
"type": "string"
},
{
"name": "p",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming', 'Greedy', 'Recursion'] |
45 | Jump Game II | jump-game-ii | <p>You are given a <strong>0-indexed</strong> array of integers <code>nums</code> of length <code>n</code>. You are initially positioned at <code>nums[0]</code>.</p>
<p>Each element <code>nums[i]</code> represents the maximum length of a forward jump from index <code>i</code>. In other words, if you are at <code>nums[... | Medium | 1.7M | 4M | 1,665,965 | 4,039,022 | 41.2% | ['jump-game', 'jump-game-iii', 'jump-game-vii', 'jump-game-viii', 'minimum-number-of-visited-cells-in-a-grid', 'maximum-number-of-jumps-to-reach-the-last-index', 'visit-array-positions-to-maximize-score'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int jump(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int jump(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class S... | [2,3,1,1,4] | {
"name": "jump",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Greedy'] |
46 | Permutations | permutations | <p>Given an array <code>nums</code> of distinct integers, return all the possible <span data-keyword="permutation-array">permutations</span>. You can return the answer in <strong>any order</strong>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> nums = [1,2,3]
<strong... | Medium | 2.5M | 3.1M | 2,530,210 | 3,149,567 | 80.3% | ['next-permutation', 'permutations-ii', 'permutation-sequence', 'combinations'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> permute(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> permute(int[] nums) {\n \n }\n}"}, {"value": "python", "te... | [1,2,3] | {
"name": "permute",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "list<list<integer>>",
"colsize": "size_1",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Backtracking'] |
47 | Permutations II | permutations-ii | <p>Given a collection of numbers, <code>nums</code>, that might contain duplicates, return <em>all possible unique permutations <strong>in any order</strong>.</em></p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [1,1,2]
<strong>Output:</strong>
[[1,1,2],
... | Medium | 1.1M | 1.8M | 1,082,101 | 1,767,846 | 61.2% | ['next-permutation', 'permutations', 'palindrome-permutation-ii', 'number-of-squareful-arrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> permuteUnique(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> permuteUnique(int[] nums) {\n \n }\n}"}, {"value": "... | [1,1,2] | {
"name": "permuteUnique",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "list<list<integer>>",
"colsize": "size_1",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Backtracking', 'Sorting'] |
48 | Rotate Image | rotate-image | <p>You are given an <code>n x n</code> 2D <code>matrix</code> representing an image, rotate the image by <strong>90</strong> degrees (clockwise).</p>
<p>You have to rotate the image <a href="https://en.wikipedia.org/wiki/In-place_algorithm" target="_blank"><strong>in-place</strong></a>, which means you have to modify ... | Medium | 2.2M | 2.9M | 2,216,810 | 2,862,939 | 77.4% | ['determine-whether-matrix-can-be-obtained-by-rotation'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n void rotate(vector<vector<int>>& matrix) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public void rotate(int[][] matrix) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | [[1,2,3],[4,5,6],[7,8,9]] | {
"name": "rotate",
"params": [
{
"name": "matrix",
"type": "integer[][]"
}
],
"return": {
"type": "void"
},
"output": {
"paramindex": 0
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Matrix'] |
49 | Group Anagrams | group-anagrams | <p>Given an array of strings <code>strs</code>, group the <span data-keyword="anagram">anagrams</span> together. You can return the answer in <strong>any order</strong>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io"... | Medium | 3.7M | 5.2M | 3,669,654 | 5,200,015 | 70.6% | ['valid-anagram', 'group-shifted-strings', 'find-resultant-array-after-removing-anagrams', 'count-anagrams'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<string>> groupAnagrams(vector<string>& strs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<String>> groupAnagrams(String[] strs) {\n \n }\n}"}, {"v... | ["eat","tea","tan","ate","nat","bat"] | {
"name": "groupAnagrams",
"params": [
{
"name": "strs",
"type": "string[]"
}
],
"return": {
"type": "list<list<string>>",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Sorting'] |
50 | Pow(x, n) | powx-n | <p>Implement <a href="http://www.cplusplus.com/reference/valarray/pow/" target="_blank">pow(x, n)</a>, which calculates <code>x</code> raised to the power <code>n</code> (i.e., <code>x<sup>n</sup></code>).</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> x = 2.00000, ... | Medium | 2.1M | 5.9M | 2,149,474 | 5,857,324 | 36.7% | ['sqrtx', 'super-pow', 'count-collisions-of-monkeys-on-a-polygon'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double myPow(double x, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double myPow(double x, int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode... | 2.00000
10 | {
"name": "myPow",
"params": [
{
"name": "x",
"type": "double"
},
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "double"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Recursion'] |
51 | N-Queens | n-queens | <p>The <strong>n-queens</strong> puzzle is the problem of placing <code>n</code> queens on an <code>n x n</code> chessboard such that no two queens attack each other.</p>
<p>Given an integer <code>n</code>, return <em>all distinct solutions to the <strong>n-queens puzzle</strong></em>. You may return the answer in <st... | Hard | 942.7K | 1.3M | 942,668 | 1,308,129 | 72.1% | ['n-queens-ii', 'grid-illumination'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<string>> solveNQueens(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<String>> solveNQueens(int n) {\n \n }\n}"}, {"value": "python", "text": ... | 4 | {
"name": "solveNQueens",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "list<list<string>>",
"colsize": "param_1",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Backtracking'] |
52 | N-Queens II | n-queens-ii | <p>The <strong>n-queens</strong> puzzle is the problem of placing <code>n</code> queens on an <code>n x n</code> chessboard such that no two queens attack each other.</p>
<p>Given an integer <code>n</code>, return <em>the number of distinct solutions to the <strong>n-queens puzzle</strong></em>.</p>
<p> </p... | Hard | 477.7K | 626.3K | 477,743 | 626,288 | 76.3% | ['n-queens'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int totalNQueens(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int totalNQueens(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class So... | 4 | {
"name": "totalNQueens",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Backtracking'] |
53 | Maximum Subarray | maximum-subarray | <p>Given an integer array <code>nums</code>, find the <span data-keyword="subarray-nonempty">subarray</span> with the largest sum, and return <em>its sum</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [-2,1,-3,4,-1,2,1,-5,4]
<strong>Output:</strong> 6
<... | Medium | 4.8M | 9.3M | 4,826,832 | 9,306,412 | 51.9% | ['best-time-to-buy-and-sell-stock', 'maximum-product-subarray', 'degree-of-an-array', 'longest-turbulent-subarray', 'maximum-score-of-spliced-array', 'maximum-absolute-sum-of-any-subarray', 'maximum-subarray-sum-after-one-operation', 'substring-with-largest-variance', 'count-subarrays-with-score-less-than-k', 'maximum-... | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSubArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSubArray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | [-2,1,-3,4,-1,2,1,-5,4] | {
"name": "maxSubArray",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Divide and Conquer', 'Dynamic Programming'] |
54 | Spiral Matrix | spiral-matrix | <p>Given an <code>m x n</code> <code>matrix</code>, return <em>all elements of the</em> <code>matrix</code> <em>in spiral order</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2020/11/13/spiral1.jpg" style="width: 242px; height: 242px;" />... | Medium | 1.9M | 3.5M | 1,856,437 | 3,482,400 | 53.3% | ['spiral-matrix-ii', 'spiral-matrix-iii', 'spiral-matrix-iv'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> spiralOrder(vector<vector<int>>& matrix) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> spiralOrder(int[][] matrix) {\n \n }\n}"}, {"value": "pyth... | [[1,2,3],[4,5,6],[7,8,9]] | {
"name": "spiralOrder",
"params": [
{
"name": "matrix",
"type": "integer[][]"
}
],
"return": {
"type": "list<integer>",
"size": "size_1 * col_size_1",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Matrix', 'Simulation'] |
55 | Jump Game | jump-game | <p>You are given an integer array <code>nums</code>. You are initially positioned at the array's <strong>first index</strong>, and each element in the array represents your maximum jump length at that position.</p>
<p>Return <code>true</code><em> if you can reach the last index, or </em><code>false</code><em> othe... | Medium | 2.5M | 6.5M | 2,532,002 | 6,456,623 | 39.2% | ['jump-game-ii', 'jump-game-iii', 'jump-game-vii', 'jump-game-viii', 'minimum-number-of-visited-cells-in-a-grid', 'largest-element-in-an-array-after-merge-operations'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canJump(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canJump(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode... | [2,3,1,1,4] | {
"name": "canJump",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Greedy'] |
56 | Merge Intervals | merge-intervals | <p>Given an array of <code>intervals</code> where <code>intervals[i] = [start<sub>i</sub>, end<sub>i</sub>]</code>, merge all overlapping intervals, and return <em>an array of the non-overlapping intervals that cover all the intervals in the input</em>.</p>
<p> </p>
<p><strong class="example">Example 1:... | Medium | 3.1M | 6.3M | 3,081,575 | 6,285,152 | 49.0% | ['insert-interval', 'meeting-rooms', 'meeting-rooms-ii', 'teemo-attacking', 'add-bold-tag-in-string', 'range-module', 'employee-free-time', 'partition-labels', 'interval-list-intersections', 'amount-of-new-area-painted-each-day', 'longest-substring-of-one-repeating-character', 'count-integers-in-intervals', 'divide-int... | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> merge(vector<vector<int>>& intervals) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] merge(int[][] intervals) {\n \n }\n}"}, {"value": "python",... | [[1,3],[2,6],[8,10],[15,18]] | {
"name": "merge",
"params": [
{
"name": "intervals",
"type": "integer[][]"
}
],
"return": {
"type": "integer[][]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Sorting'] |
57 | Insert Interval | insert-interval | <p>You are given an array of non-overlapping intervals <code>intervals</code> where <code>intervals[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> represent the start and the end of the <code>i<sup>th</sup></code> interval and <code>intervals</code> is sorted in ascending order by <code>start<sub>i</sub></code>. You ... | Medium | 1.4M | 3.3M | 1,405,977 | 3,259,968 | 43.1% | ['merge-intervals', 'range-module', 'count-integers-in-intervals'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] insert(int[][] intervals, int[] newInterva... | [[1,3],[6,9]]
[2,5] | {
"name": "insert",
"params": [
{
"name": "intervals",
"type": "integer[][]"
},
{
"name": "newInterval",
"type": "integer[]"
}
],
"return": {
"type": "integer[][]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array'] |
58 | Length of Last Word | length-of-last-word | <p>Given a string <code>s</code> consisting of words and spaces, return <em>the length of the <strong>last</strong> word in the string.</em></p>
<p>A <strong>word</strong> is a maximal <span data-keyword="substring-nonempty">substring</span> consisting of non-space characters only.</p>
<p> </p>
<p><strong class=... | Easy | 2.7M | 4.8M | 2,659,186 | 4,767,235 | 55.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int lengthOfLastWord(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int lengthOfLastWord(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo... | "Hello World" | {
"name": "lengthOfLastWord",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String'] |
59 | Spiral Matrix II | spiral-matrix-ii | <p>Given a positive integer <code>n</code>, generate an <code>n x n</code> <code>matrix</code> filled with elements from <code>1</code> to <code>n<sup>2</sup></code> in spiral order.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2020/11/13/spi... | Medium | 673.1K | 920.5K | 673,133 | 920,477 | 73.1% | ['spiral-matrix', 'spiral-matrix-iii', 'spiral-matrix-iv'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> generateMatrix(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] generateMatrix(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | 3 | {
"name": "generateMatrix",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer[][]",
"rowsize": "param_1",
"colsize": "param_1",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Matrix', 'Simulation'] |
60 | Permutation Sequence | permutation-sequence | <p>The set <code>[1, 2, 3, ..., n]</code> contains a total of <code>n!</code> unique permutations.</p>
<p>By listing and labeling all of the permutations in order, we get the following sequence for <code>n = 3</code>:</p>
<ol>
<li><code>"123"</code></li>
<li><code>"132"</code></li>
<li><co... | Hard | 466.3K | 943.4K | 466,268 | 943,375 | 49.4% | ['next-permutation', 'permutations'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string getPermutation(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String getPermutation(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | 3
3 | {
"name": "getPermutation",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Recursion'] |
61 | Rotate List | rotate-list | <p>Given the <code>head</code> of a linked list, rotate the list to the right by <code>k</code> places.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2020/11/13/rotate1.jpg" style="width: 450px; height: 191px;" />
<pre>
<strong>Input:</st... | Medium | 1.2M | 3.1M | 1,242,126 | 3,136,615 | 39.6% | ['rotate-array', 'split-linked-list-in-parts'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [1,2,3,4,5]
2 | {
"name": "rotateRight",
"params": [
{
"name": "head",
"type": "ListNode",
"dealloc": false
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "ListNode",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Two Pointers'] |
62 | Unique Paths | unique-paths | <p>There is a robot on an <code>m x n</code> grid. The robot is initially located at the <strong>top-left corner</strong> (i.e., <code>grid[0][0]</code>). The robot tries to move to the <strong>bottom-right corner</strong> (i.e., <code>grid[m - 1][n - 1]</code>). The robot can only move either down or right at any poin... | Medium | 2.3M | 3.5M | 2,261,437 | 3,450,471 | 65.5% | ['unique-paths-ii', 'minimum-path-sum', 'dungeon-game', 'minimum-path-cost-in-a-grid', 'minimum-cost-homecoming-of-a-robot-in-a-grid', 'number-of-ways-to-reach-a-position-after-exactly-k-steps', 'paths-in-matrix-whose-sum-is-divisible-by-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int uniquePaths(int m, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int uniquePaths(int m, int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode... | 3
7 | {
"name": "uniquePaths",
"params": [
{
"name": "m",
"type": "integer"
},
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Dynamic Programming', 'Combinatorics'] |
63 | Unique Paths II | unique-paths-ii | <p>You are given an <code>m x n</code> integer array <code>grid</code>. There is a robot initially located at the <b>top-left corner</b> (i.e., <code>grid[0][0]</code>). The robot tries to move to the <strong>bottom-right corner</strong> (i.e., <code>grid[m - 1][n - 1]</code>). The robot can only move either down or ri... | Medium | 1.2M | 2.7M | 1,170,202 | 2,728,462 | 42.9% | ['unique-paths', 'unique-paths-iii', 'minimum-path-cost-in-a-grid', 'paths-in-matrix-whose-sum-is-divisible-by-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int uniquePathsWithObstacles(int[][] obstacleGrid) {\n \n }\n... | [[0,0,0],[0,1,0],[0,0,0]] | {
"name": "uniquePathsWithObstacles",
"params": [
{
"name": "obstacleGrid",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Matrix'] |
64 | Minimum Path Sum | minimum-path-sum | <p>Given a <code>m x n</code> <code>grid</code> filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path.</p>
<p><strong>Note:</strong> You can only move either down or right at any point in time.</p>
<p> </p>
<p><strong class="example">Ex... | Medium | 1.5M | 2.2M | 1,463,093 | 2,214,242 | 66.1% | ['unique-paths', 'dungeon-game', 'cherry-pickup', 'minimum-path-cost-in-a-grid', 'maximum-number-of-points-with-cost', 'minimum-cost-homecoming-of-a-robot-in-a-grid', 'paths-in-matrix-whose-sum-is-divisible-by-k', 'check-if-there-is-a-path-with-equal-number-of-0s-and-1s', 'minimum-cost-of-a-path-with-special-roads'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minPathSum(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minPathSum(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | [[1,3,1],[1,5,1],[4,2,1]] | {
"name": "minPathSum",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Matrix'] |
65 | Valid Number | valid-number | <p>Given a string <code>s</code>, return whether <code>s</code> is a <strong>valid number</strong>.<br />
<br />
For example, all the following are valid numbers: <code>"2", "0089", "-0.1", "+3.14", "4.", "-.9", "2e10", "-90E3", "3e+7&... | Hard | 438.7K | 2.1M | 438,736 | 2,062,995 | 21.3% | ['string-to-integer-atoi'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isNumber(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isNumber(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class... | "0" | {
"name": "isNumber",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String'] |
66 | Plus One | plus-one | <p>You are given a <strong>large integer</strong> represented as an integer array <code>digits</code>, where each <code>digits[i]</code> is the <code>i<sup>th</sup></code> digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain a... | Easy | 2.8M | 6M | 2,841,806 | 6,016,767 | 47.2% | ['multiply-strings', 'add-binary', 'plus-one-linked-list', 'add-to-array-form-of-integer', 'minimum-operations-to-reduce-an-integer-to-0'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> plusOne(vector<int>& digits) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] plusOne(int[] digits) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | [1,2,3] | {
"name": "plusOne",
"params": [
{
"name": "digits",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math'] |
67 | Add Binary | add-binary | <p>Given two binary strings <code>a</code> and <code>b</code>, return <em>their sum as a binary string</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> a = "11", b = "1"
<strong>Output:</strong> "100"
</pre><p><strong class="example">Example 2:</strong></p>
<pre><... | Easy | 1.8M | 3.3M | 1,810,279 | 3,269,371 | 55.4% | ['add-two-numbers', 'multiply-strings', 'plus-one', 'add-to-array-form-of-integer'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string addBinary(string a, string b) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String addBinary(String a, String b) {\n \n }\n}"}, {"value": "python", "text": "Python"... | "11"
"1" | {
"name": "addBinary",
"params": [
{
"name": "a",
"type": "string"
},
{
"name": "b",
"type": "string"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'String', 'Bit Manipulation', 'Simulation'] |
68 | Text Justification | text-justification | <p>Given an array of strings <code>words</code> and a width <code>maxWidth</code>, format the text such that each line has exactly <code>maxWidth</code> characters and is fully (left and right) justified.</p>
<p>You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad e... | Hard | 526.6K | 1.1M | 526,583 | 1,108,593 | 47.5% | ['rearrange-spaces-between-words', 'divide-a-string-into-groups-of-size-k', 'split-message-based-on-limit'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> fullJustify(vector<string>& words, int maxWidth) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> fullJustify(String[] words, int maxWidth) {\n \n ... | ["This", "is", "an", "example", "of", "text", "justification."]
16 | {
"name": "fullJustify",
"params": [
{
"name": "words",
"type": "string[]"
},
{
"name": "maxWidth",
"type": "integer"
}
],
"return": {
"type": "list<string>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Simulation'] |
69 | Sqrt(x) | sqrtx | <p>Given a non-negative integer <code>x</code>, return <em>the square root of </em><code>x</code><em> rounded down to the nearest integer</em>. The returned integer should be <strong>non-negative</strong> as well.</p>
<p>You <strong>must not use</strong> any built-in exponent function or operator.</p>
<ul>
<li>For e... | Easy | 2.5M | 6.2M | 2,495,850 | 6,215,196 | 40.2% | ['powx-n', 'valid-perfect-square'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int mySqrt(int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int mySqrt(int x) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solution(objec... | 4 | {
"name": "mySqrt",
"params": [
{
"name": "x",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Binary Search'] |
70 | Climbing Stairs | climbing-stairs | <p>You are climbing a staircase. It takes <code>n</code> steps to reach the top.</p>
<p>Each time you can either climb <code>1</code> or <code>2</code> steps. In how many distinct ways can you climb to the top?</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> n = 2
<... | Easy | 4.1M | 7.7M | 4,092,424 | 7,662,054 | 53.4% | ['min-cost-climbing-stairs', 'fibonacci-number', 'n-th-tribonacci-number', 'minimum-rounds-to-complete-all-tasks', 'count-number-of-ways-to-place-houses', 'number-of-ways-to-reach-a-position-after-exactly-k-steps', 'count-ways-to-build-good-strings', 'frog-jump-ii', 'find-number-of-ways-to-reach-the-k-th-stair', 'the-n... | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int climbStairs(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int climbStairs(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solu... | 2 | {
"name": "climbStairs",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Dynamic Programming', 'Memoization'] |
71 | Simplify Path | simplify-path | <p>You are given an <em>absolute</em> path for a Unix-style file system, which always begins with a slash <code>'/'</code>. Your task is to transform this absolute path into its <strong>simplified canonical path</strong>.</p>
<p>The <em>rules</em> of a Unix-style file system are as follows:</p>
<ul>
<li>A si... | Medium | 1M | 2.2M | 1,035,287 | 2,199,452 | 47.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string simplifyPath(string path) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String simplifyPath(String path) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau... | "/home/" | {
"name": "simplifyPath",
"params": [
{
"name": "path",
"type": "string"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Stack'] |
72 | Edit Distance | edit-distance | <p>Given two strings <code>word1</code> and <code>word2</code>, return <em>the minimum number of operations required to convert <code>word1</code> to <code>word2</code></em>.</p>
<p>You have the following three operations permitted on a word:</p>
<ul>
<li>Insert a character</li>
<li>Delete a character</li>
<li>Rep... | Medium | 1.1M | 1.9M | 1,112,477 | 1,905,344 | 58.4% | ['one-edit-distance', 'delete-operation-for-two-strings', 'minimum-ascii-delete-sum-for-two-strings', 'uncrossed-lines', 'minimum-white-tiles-after-covering-with-carpets', 'longest-palindrome-after-substring-concatenation-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minDistance(string word1, string word2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minDistance(String word1, String word2) {\n \n }\n}"}, {"value": "python", "t... | "horse"
"ros" | {
"name": "minDistance",
"params": [
{
"name": "word1",
"type": "string"
},
{
"name": "word2",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
73 | Set Matrix Zeroes | set-matrix-zeroes | <p>Given an <code>m x n</code> integer matrix <code>matrix</code>, if an element is <code>0</code>, set its entire row and column to <code>0</code>'s.</p>
<p>You must do it <a href="https://en.wikipedia.org/wiki/In-place_algorithm" target="_blank">in place</a>.</p>
<p> </p>
<p><strong class="example">Example... | Medium | 1.9M | 3.2M | 1,890,146 | 3,189,533 | 59.3% | ['game-of-life', 'number-of-laser-beams-in-a-bank', 'minimum-operations-to-remove-adjacent-ones-in-matrix', 'remove-all-ones-with-row-and-column-flips-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n void setZeroes(vector<vector<int>>& matrix) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public void setZeroes(int[][] matrix) {\n \n }\n}"}, {"value": "python", "text": "Python... | [[1,1,1],[1,0,1],[1,1,1]] | {
"name": "setZeroes",
"params": [
{
"name": "matrix",
"type": "integer[][]"
}
],
"return": {
"type": "void"
},
"output": {
"paramindex": 0
},
"manual": false
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Matrix'] |
74 | Search a 2D Matrix | search-a-2d-matrix | <p>You are given an <code>m x n</code> integer matrix <code>matrix</code> with the following two properties:</p>
<ul>
<li>Each row is sorted in non-decreasing order.</li>
<li>The first integer of each row is greater than the last integer of the previous row.</li>
</ul>
<p>Given an integer <code>target</code>, retur... | Medium | 2.3M | 4.4M | 2,273,963 | 4,377,486 | 51.9% | ['search-a-2d-matrix-ii', 'split-message-based-on-limit'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool searchMatrix(vector<vector<int>>& matrix, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean searchMatrix(int[][] matrix, int target) {\n \n }\n}"}, {"... | [[1,3,5,7],[10,11,16,20],[23,30,34,60]]
3 | {
"name": "searchMatrix",
"params": [
{
"name": "matrix",
"type": "integer[][]"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Matrix'] |
75 | Sort Colors | sort-colors | <p>Given an array <code>nums</code> with <code>n</code> objects colored red, white, or blue, sort them <strong><a href="https://en.wikipedia.org/wiki/In-place_algorithm" target="_blank">in-place</a> </strong>so that objects of the same color are adjacent, with the colors in the order red, white, and blue.</p>
<p>We wi... | Medium | 2.8M | 4.1M | 2,750,527 | 4,127,377 | 66.6% | ['sort-list', 'wiggle-sort', 'wiggle-sort-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n void sortColors(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public void sortColors(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | [2,0,2,1,1,0] | {
"name": "sortColors",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "void"
},
"output": {
"paramindex": 0
},
"manual": false
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Sorting'] |
76 | Minimum Window Substring | minimum-window-substring | <p>Given two strings <code>s</code> and <code>t</code> of lengths <code>m</code> and <code>n</code> respectively, return <em>the <strong>minimum window</strong></em> <span data-keyword="substring-nonempty"><strong><em>substring</em></strong></span><em> of </em><code>s</code><em> such that every character in </em><code>... | Hard | 1.7M | 3.8M | 1,687,174 | 3,757,064 | 44.9% | ['substring-with-concatenation-of-all-words', 'minimum-size-subarray-sum', 'sliding-window-maximum', 'permutation-in-string', 'smallest-range-covering-elements-from-k-lists', 'minimum-window-subsequence', 'count-substrings-that-can-be-rearranged-to-contain-a-string-ii', 'count-substrings-that-can-be-rearranged-to-conta... | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string minWindow(string s, string t) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String minWindow(String s, String t) {\n \n }\n}"}, {"value": "python", "text": "Python"... | "ADOBECODEBANC"
"ABC" | {
"name": "minWindow",
"params": [
{
"name": "s",
"type": "string"
},
{
"name": "t",
"type": "string"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Sliding Window'] |
77 | Combinations | combinations | <p>Given two integers <code>n</code> and <code>k</code>, return <em>all possible combinations of</em> <code>k</code> <em>numbers chosen from the range</em> <code>[1, n]</code>.</p>
<p>You may return the answer in <strong>any order</strong>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<... | Medium | 1.1M | 1.5M | 1,091,329 | 1,505,199 | 72.5% | ['combination-sum', 'permutations'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> combine(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> combine(int n, int k) {\n \n }\n}"}, {"value": "python", "text"... | 4
2 | {
"name": "combine",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "list<list<integer>>",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Backtracking'] |
78 | Subsets | subsets | <p>Given an integer array <code>nums</code> of <strong>unique</strong> elements, return <em>all possible</em> <span data-keyword="subset"><em>subsets</em></span> <em>(the power set)</em>.</p>
<p>The solution set <strong>must not</strong> contain duplicate subsets. Return the solution in <strong>any order</strong>.</p>... | Medium | 2.4M | 3M | 2,419,303 | 3,006,282 | 80.5% | ['subsets-ii', 'generalized-abbreviation', 'letter-case-permutation', 'find-array-given-subset-sums', 'count-number-of-maximum-bitwise-or-subsets'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> subsets(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> subsets(int[] nums) {\n \n }\n}"}, {"value": "python", "te... | [1,2,3] | {
"name": "subsets",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "list<list<integer>>",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Backtracking', 'Bit Manipulation'] |
79 | Word Search | word-search | <p>Given an <code>m x n</code> grid of characters <code>board</code> and a string <code>word</code>, return <code>true</code> <em>if</em> <code>word</code> <em>exists in the grid</em>.</p>
<p>The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically ne... | Medium | 2M | 4.5M | 2,031,408 | 4,530,013 | 44.8% | ['word-search-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool exist(vector<vector<char>>& board, string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean exist(char[][] board, String word) {\n \n }\n}"}, {"value": "pyt... | [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]]
"ABCCED" | {
"name": "exist",
"params": [
{
"name": "board",
"type": "character[][]"
},
{
"name": "word",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Backtracking', 'Depth-First Search', 'Matrix'] |
80 | Remove Duplicates from Sorted Array II | remove-duplicates-from-sorted-array-ii | <p>Given an integer array <code>nums</code> sorted in <strong>non-decreasing order</strong>, remove some duplicates <a href="https://en.wikipedia.org/wiki/In-place_algorithm" target="_blank"><strong>in-place</strong></a> such that each unique element appears <strong>at most twice</strong>. The <strong>relative order</s... | Medium | 1.5M | 2.4M | 1,497,673 | 2,396,584 | 62.5% | ['remove-duplicates-from-sorted-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int removeDuplicates(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int removeDuplicates(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [1,1,1,2,2,3] | {
"name": "removeDuplicates",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
},
"output": {
"paramindex": 0,
"size": "ret"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers'] |
81 | Search in Rotated Sorted Array II | search-in-rotated-sorted-array-ii | <p>There is an integer array <code>nums</code> sorted in non-decreasing order (not necessarily with <strong>distinct</strong> values).</p>
<p>Before being passed to your function, <code>nums</code> is <strong>rotated</strong> at an unknown pivot index <code>k</code> (<code>0 <= k < nums.length</code>) such that ... | Medium | 933.8K | 2.4M | 933,789 | 2,414,022 | 38.7% | ['search-in-rotated-sorted-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool search(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean search(int[] nums, int target) {\n \n }\n}"}, {"value": "python", "text": ... | [2,5,6,0,0,1,2]
0 | {
"name": "search",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search'] |
82 | Remove Duplicates from Sorted List II | remove-duplicates-from-sorted-list-ii | <p>Given the <code>head</code> of a sorted linked list, <em>delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list</em>. Return <em>the linked list <strong>sorted</strong> as well</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="htt... | Medium | 894K | 1.8M | 893,993 | 1,807,038 | 49.5% | ['remove-duplicates-from-sorted-list', 'remove-duplicates-from-an-unsorted-linked-list'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [1,2,3,3,4,4,5] | {
"name": "deleteDuplicates",
"params": [
{
"name": "head",
"type": "ListNode",
"dealloc": false
}
],
"return": {
"type": "ListNode",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Two Pointers'] |
83 | Remove Duplicates from Sorted List | remove-duplicates-from-sorted-list | <p>Given the <code>head</code> of a sorted linked list, <em>delete all duplicates such that each element appears only once</em>. Return <em>the linked list <strong>sorted</strong> as well</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/202... | Easy | 1.9M | 3.5M | 1,885,167 | 3,456,579 | 54.5% | ['remove-duplicates-from-sorted-list-ii', 'remove-duplicates-from-an-unsorted-linked-list'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [1,1,2] | {
"name": "deleteDuplicates",
"params": [
{
"name": "head",
"type": "ListNode",
"dealloc": false
}
],
"return": {
"type": "ListNode",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List'] |
84 | Largest Rectangle in Histogram | largest-rectangle-in-histogram | <p>Given an array of integers <code>heights</code> representing the histogram's bar height where the width of each bar is <code>1</code>, return <em>the area of the largest rectangle in the histogram</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode... | Hard | 1.1M | 2.4M | 1,147,675 | 2,449,863 | 46.8% | ['maximal-rectangle', 'maximum-score-of-a-good-subarray'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int largestRectangleArea(vector<int>& heights) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int largestRectangleArea(int[] heights) {\n \n }\n}"}, {"value": "python", "te... | [2,1,5,6,2,3] | {
"name": "largestRectangleArea",
"params": [
{
"name": "heights",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Stack', 'Monotonic Stack'] |
85 | Maximal Rectangle | maximal-rectangle | <p>Given a <code>rows x cols</code> binary <code>matrix</code> filled with <code>0</code>'s and <code>1</code>'s, find the largest rectangle containing only <code>1</code>'s and return <em>its area</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://asse... | Hard | 577.5K | 1.1M | 577,528 | 1,086,960 | 53.1% | ['largest-rectangle-in-histogram', 'maximal-square', 'find-sorted-submatrices-with-maximum-element-at-most-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximalRectangle(vector<vector<char>>& matrix) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximalRectangle(char[][] matrix) {\n \n }\n}"}, {"value": "python", "... | [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]] | {
"name": "maximalRectangle",
"params": [
{
"name": "matrix",
"type": "character[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Stack', 'Matrix', 'Monotonic Stack'] |
86 | Partition List | partition-list | <p>Given the <code>head</code> of a linked list and a value <code>x</code>, partition it such that all nodes <strong>less than</strong> <code>x</code> come before nodes <strong>greater than or equal</strong> to <code>x</code>.</p>
<p>You should <strong>preserve</strong> the original relative order of the nodes in each... | Medium | 747.9K | 1.3M | 747,932 | 1,277,375 | 58.6% | ['partition-array-according-to-given-pivot'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [1,4,3,2,5,2]
3 | {
"name": "partition",
"params": [
{
"name": "head",
"type": "ListNode",
"dealloc": false
},
{
"name": "x",
"type": "integer"
}
],
"return": {
"type": "ListNode",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Two Pointers'] |
87 | Scramble String | scramble-string | <p>We can scramble a string s to get a string t using the following algorithm:</p>
<ol>
<li>If the length of the string is 1, stop.</li>
<li>If the length of the string is > 1, do the following:
<ul>
<li>Split the string into two non-empty substrings at a random index, i.e., if the string is <code>s</code>, di... | Hard | 261.9K | 626K | 261,877 | 625,955 | 41.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isScramble(string s1, string s2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isScramble(String s1, String s2) {\n \n }\n}"}, {"value": "python", "text": "Py... | "great"
"rgeat" | {
"name": "isScramble",
"params": [
{
"name": "s1",
"type": "string"
},
{
"name": "s2",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
88 | Merge Sorted Array | merge-sorted-array | <p>You are given two integer arrays <code>nums1</code> and <code>nums2</code>, sorted in <strong>non-decreasing order</strong>, and two integers <code>m</code> and <code>n</code>, representing the number of elements in <code>nums1</code> and <code>nums2</code> respectively.</p>
<p><strong>Merge</strong> <code>nums1</c... | Easy | 4.4M | 8.5M | 4,440,282 | 8,457,584 | 52.5% | ['merge-two-sorted-lists', 'squares-of-a-sorted-array', 'interval-list-intersections', 'take-k-of-each-character-from-left-and-right'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public void merge(int[] nums1, int m, int[] nums2, int n) {\n \n }\... | [1,2,3,0,0,0]
3
[2,5,6]
3 | {
"name": "merge",
"params": [
{
"name": "nums1",
"type": "integer[]",
"implicitsizeparam": false
},
{
"name": "m",
"type": "integer"
},
{
"name": "nums2",
"type": "integer[]",
"implicitsizeparam": false
},
{
"name": "n",
"type"... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Sorting'] |
89 | Gray Code | gray-code | <p>An <strong>n-bit gray code sequence</strong> is a sequence of <code>2<sup>n</sup></code> integers where:</p>
<ul>
<li>Every integer is in the <strong>inclusive</strong> range <code>[0, 2<sup>n</sup> - 1]</code>,</li>
<li>The first integer is <code>0</code>,</li>
<li>An integer appears <strong>no more than once</... | Medium | 341.4K | 555.9K | 341,360 | 555,899 | 61.4% | ['1-bit-and-2-bit-characters'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> grayCode(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> grayCode(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode":... | 2 | {
"name": "grayCode",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "list<integer>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Backtracking', 'Bit Manipulation'] |
90 | Subsets II | subsets-ii | <p>Given an integer array <code>nums</code> that may contain duplicates, return <em>all possible</em> <span data-keyword="subset"><em>subsets</em></span><em> (the power set)</em>.</p>
<p>The solution set <strong>must not</strong> contain duplicate subsets. Return the solution in <strong>any order</strong>.</p>
<p>&nb... | Medium | 1.2M | 2M | 1,163,007 | 1,968,017 | 59.1% | ['subsets', 'find-array-given-subset-sums'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> subsetsWithDup(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> subsetsWithDup(int[] nums) {\n \n }\n}"}, {"value":... | [1,2,2] | {
"name": "subsetsWithDup",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "list<list<integer>>",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Backtracking', 'Bit Manipulation'] |
91 | Decode Ways | decode-ways | <p>You have intercepted a secret message encoded as a string of numbers. The message is <strong>decoded</strong> via the following mapping:</p>
<p><code>"1" -> 'A'<br />
"2" -> 'B'<br />
...<br />
"25" -> 'Y'<br />
"26" -> 'Z'</code></... | Medium | 1.4M | 3.9M | 1,427,588 | 3,938,041 | 36.3% | ['decode-ways-ii', 'number-of-ways-to-separate-numbers', 'count-number-of-texts'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numDecodings(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numDecodings(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cl... | "12" | {
"name": "numDecodings",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
92 | Reverse Linked List II | reverse-linked-list-ii | <p>Given the <code>head</code> of a singly linked list and two integers <code>left</code> and <code>right</code> where <code>left <= right</code>, reverse the nodes of the list from position <code>left</code> to position <code>right</code>, and return <em>the reversed list</em>.</p>
<p> </p>
<p><strong class="... | Medium | 1.1M | 2.2M | 1,061,318 | 2,153,982 | 49.3% | ['reverse-linked-list'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [1,2,3,4,5]
2
4 | {
"name": "reverseBetween",
"params": [
{
"name": "head",
"type": "ListNode",
"dealloc": false
},
{
"name": "left",
"type": "integer"
},
{
"name": "right",
"type": "integer"
}
],
"return": {
"type": "ListNode",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List'] |
93 | Restore IP Addresses | restore-ip-addresses | <p>A <strong>valid IP address</strong> consists of exactly four integers separated by single dots. Each integer is between <code>0</code> and <code>255</code> (<strong>inclusive</strong>) and cannot have leading zeros.</p>
<ul>
<li>For example, <code>"0.1.2.201"</code> and <code>"192.168.1.1"</cod... | Medium | 526.3K | 1M | 526,277 | 1,000,121 | 52.6% | ['ip-to-cidr'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> restoreIpAddresses(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> restoreIpAddresses(String s) {\n \n }\n}"}, {"value": "python", "tex... | "25525511135" | {
"name": "restoreIpAddresses",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "list<string>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Backtracking'] |
94 | Binary Tree Inorder Traversal | binary-tree-inorder-traversal | <p>Given the <code>root</code> of a binary tree, return <em>the inorder traversal of its nodes' values</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">root = [1,null,2,3]</span></p>
<p><strong>Output:</stro... | Easy | 3M | 3.9M | 3,039,731 | 3,886,124 | 78.2% | ['validate-binary-search-tree', 'binary-tree-preorder-traversal', 'binary-tree-postorder-traversal', 'binary-search-tree-iterator', 'kth-smallest-element-in-a-bst', 'closest-binary-search-tree-value-ii', 'inorder-successor-in-bst', 'convert-binary-search-tree-to-sorted-doubly-linked-list', 'minimum-distance-between-bst... | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [1,null,2,3] | {
"name": "inorderTraversal",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "list<integer>",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Stack', 'Tree', 'Depth-First Search', 'Binary Tree'] |
95 | Unique Binary Search Trees II | unique-binary-search-trees-ii | <p>Given an integer <code>n</code>, return <em>all the structurally unique <strong>BST'</strong>s (binary search trees), which has exactly </em><code>n</code><em> nodes of unique values from</em> <code>1</code> <em>to</em> <code>n</code>. Return the answer in <strong>any order</strong>.</p>
<p> </p>
<p><stron... | Medium | 503.8K | 840K | 503,847 | 840,028 | 60.0% | ['unique-binary-search-trees', 'different-ways-to-add-parentheses'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | 3 | {
"name": "generateTrees",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "list<TreeNode>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming', 'Backtracking', 'Tree', 'Binary Search Tree', 'Binary Tree'] |
96 | Unique Binary Search Trees | unique-binary-search-trees | <p>Given an integer <code>n</code>, return <em>the number of structurally unique <strong>BST'</strong>s (binary search trees) which has exactly </em><code>n</code><em> nodes of unique values from</em> <code>1</code> <em>to</em> <code>n</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<i... | Medium | 747.4K | 1.2M | 747,435 | 1,201,043 | 62.2% | ['unique-binary-search-trees-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numTrees(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numTrees(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solution(o... | 3 | {
"name": "numTrees",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Dynamic Programming', 'Tree', 'Binary Search Tree', 'Binary Tree'] |
97 | Interleaving String | interleaving-string | <p>Given strings <code>s1</code>, <code>s2</code>, and <code>s3</code>, find whether <code>s3</code> is formed by an <strong>interleaving</strong> of <code>s1</code> and <code>s2</code>.</p>
<p>An <strong>interleaving</strong> of two strings <code>s</code> and <code>t</code> is a configuration where <code>s</code> and... | Medium | 631.6K | 1.5M | 631,649 | 1,518,648 | 41.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isInterleave(string s1, string s2, string s3) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isInterleave(String s1, String s2, String s3) {\n \n }\n}"}, {"val... | "aabcc"
"dbbca"
"aadbbcbcac" | {
"name": "isInterleave",
"params": [
{
"name": "s1",
"type": "string"
},
{
"name": "s2",
"type": "string"
},
{
"name": "s3",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
98 | Validate Binary Search Tree | validate-binary-search-tree | <p>Given the <code>root</code> of a binary tree, <em>determine if it is a valid binary search tree (BST)</em>.</p>
<p>A <strong>valid BST</strong> is defined as follows:</p>
<ul>
<li>The left <span data-keyword="subtree">subtree</span> of a node contains only nodes with keys <strong>less than</strong> the node's... | Medium | 2.8M | 8.2M | 2,785,611 | 8,164,132 | 34.1% | ['binary-tree-inorder-traversal', 'find-mode-in-binary-search-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [2,1,3] | {
"name": "isValidBST",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Binary Search Tree', 'Binary Tree'] |
99 | Recover Binary Search Tree | recover-binary-search-tree | <p>You are given the <code>root</code> of a binary search tree (BST), where the values of <strong>exactly</strong> two nodes of the tree were swapped by mistake. <em>Recover the tree without changing its structure</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://asset... | Medium | 531K | 952.8K | 530,951 | 952,761 | 55.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [1,3,null,null,2] | {
"name": "recoverTree",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "void"
},
"output": {
"paramindex": 0
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Binary Search Tree', 'Binary Tree'] |
100 | Same Tree | same-tree | <p>Given the roots of two binary trees <code>p</code> and <code>q</code>, write a function to check if they are the same or not.</p>
<p>Two binary trees are considered the same if they are structurally identical, and the nodes have the same value.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<... | Easy | 2.7M | 4.2M | 2,715,430 | 4,199,996 | 64.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [1,2,3]
[1,2,3] | {
"name": "isSameTree",
"params": [
{
"name": "p",
"type": "TreeNode"
},
{
"name": "q",
"type": "TreeNode"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.