Dataset Viewer
Auto-converted to Parquet Duplicate
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>&nbsp;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&nbsp;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>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> s = &quot;abcabcbb&quot; <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>&nbsp;</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>&nbsp;</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>&quot;PAYPALISHIRING&quot;</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>&quot;PAHNAPLSIIGYIR&quot;<...
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>&quot; &quot;</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>&nbsp;</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>&nbsp;and a pattern <code>p</code>, implement regular expression matching with support for <code>&#39;.&#39;</code> and <code>&#39;*&#39;</code> where:</p> <ul> <li><code>&#39;.&#39;</code> Matches any single character.​​​​</li> <li><code>&#39;*&#39;</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:&nbsp;<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']
End of preview. Expand in Data Studio

LeetCode Scraper Dataset

This dataset contains information scraped from LeetCode, including problem details, metadata, and related files. It is designed to assist developers in analyzing LeetCode problems, generating insights, and building tools for competitive programming or educational purposes.

questions_deets.csv

  • Contains detailed information about each problem, including problem descriptions, constraints, and examples.
  • Columns:
    • questionFrontendId: Unique problem ID.
    • questionTitle: Title of the problem.
    • content: HTML content of the problem description.
    • difficulty: Problem difficulty.
    • topicTags: Tags associated with the problem.
    • codeDefinition: Code templates for various programming languages.
    • TitleSlug: URL-friendly title for the problem. Construct the link this way: "https://leetcode.com/problems/{titleSlug}/description/"
    • difficulty, totalAccepted, totalSubmission, totalAcceptedRaw, totalSubmissionRaw,
    • acRate
    • similarQuestions: Questions simmilar to current question.
    • mysqlSchemas,category,sampleTestCase,metaData,envInfo.

This dataset is part of a broader collection of LeetCode-related datasets. It complements:

  • LeetCode Problem Set – a lightweight dataset containing LeetCode problems along with titles, slugs, difficulty levels, and basic metadata (no content or solutions).
  • LeetCode Problem Solutions – includes up to 100 of the most upvoted community solutions per problem, with full code, summaries, and metadata.

Note: New problems are added to the platform weekly. If you’d like the data refreshed or want more solutions per problem, feel free to reach out!

The scraper used to collect this data is open-sourced here: timetooth/leetcode_scraper. Give it a ⭐ if you find it helpful!

image/png

Downloads last month
67