From 47b33df69d3763991714ce845045963beea514c7 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Thu, 30 Jan 2025 14:11:00 +0700 Subject: [PATCH 01/24] Added java+cpp and scraped neetcode vids --- app/db/combined.json | 3970 +++++++++++++++++++++++++----------------- 1 file changed, 2390 insertions(+), 1580 deletions(-) diff --git a/app/db/combined.json b/app/db/combined.json index c2b03a8..c34b8b7 100644 --- a/app/db/combined.json +++ b/app/db/combined.json @@ -5,41 +5,50 @@ "description": "

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

\n\n

You may assume that each input would have exactly one solution, and you may not use the same element twice.

\n\n

You can return the answer in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [2,7,11,15], target = 9\nOutput: [0,1]\nExplanation: Because nums[0] + nums[1] == 9, we return [0, 1].\n
\n\n

Example 2:

\n\n
\nInput: nums = [3,2,4], target = 6\nOutput: [1,2]\n
\n\n

Example 3:

\n\n
\nInput: nums = [3,3], target = 6\nOutput: [0,1]\n
\n\n

 

\n

Constraints:

\n\n\n\n

 

\nFollow-up: Can you come up with an algorithm that is less than O(n2) time complexity?", "difficulty": "easy", "sample_test_cases": [ - "twoSum([2,7,11,15], 9)", - "twoSum([3,2,4], 6)", - "twoSum([3,3], 6)" + "--arg1=2,7,11,15 --arg2=9", + "--arg1=3,2,4 --arg2=6", + "--arg1=3,3 --arg2=6" ], "sample_test_results": [ - "[0, 1]", - "[1, 2]", - "[0, 1]" + "0, 1", + "1, 2", + "0, 1" ], "hidden_test_cases": [ - "twoSum([49, 61, 74, 96, 29, 88, 53, -34, -48], 184)", - "twoSum([62, 15, -95, 26, -65, 12, -86, -5, -40, -64, -91, -14, 20, -36, 83], -60)", - "twoSum([-12, -75, 90, 56, -15, -55, -51, -27, 61, 24, -9, -58], -85)", - "twoSum([-87, 21, -26, 13, -29, -53, -87, 11], -140)", - "twoSum([-65, 6, 58, -29], -7)", - "twoSum([-87, 54], -33)", - "twoSum([-97, -10, 89], -8)", - "twoSum([30, 57, -82, -8, 92, 99, 82, -76], 74)", - "twoSum([75, -74, 40], 1)", - "twoSum([-67, -35, 76, 71, -85, 91, -55, -42, 66, -28, 1, 89], 56)" + "--arg1=49,61,74,96,29,88,53,-34,-48 --arg2=184", + "--arg1=62,15,-95,26,-65,12,-86,-5,-40,-64,-91,-14,20,-36,83 --arg2=-60", + "--arg1=-12,-75,90,56,-15,-55,-51,-27,61,24,-9,-58 --arg2=-85", + "--arg1=-87,21,-26,13,-29,-53,-87,11 --arg2=-140", + "--arg1=-65,6,58,-29 --arg2=-7", + "--arg1=-87,54 --arg2=-33", + "--arg1=-97,-10,89 --arg2=-8", + "--arg1=30,57,-82,-8,92,99,82,-76 --arg2=74", + "--arg1=75,-74,40 --arg2=1", + "--arg1=-67,-35,76,71,-85,91,-55,-42,66,-28,1,89 --arg2=56" ], "hidden_test_results": [ - "[3, 5]", - "[3, 6]", - "[7, 11]", - "[0, 5]", - "[0, 2]", - "[0, 1]", - "[0, 2]", - "[3, 6]", - "[0, 1]", - "[1, 5]" - ], - "boilerplate": "class Solution:\n def twoSum(self, nums: List[int], target: int) -> List[int]:\n ", - "compare_func": "return sorted(result) == sorted(eval(expected))" + "3, 5", + "3, 6", + "7, 11", + "0, 5", + "0, 2", + "0, 1", + "0, 2", + "3, 6", + "0, 1", + "1, 5" + ], + "boilerplate": { + "python": "class Solution:\n def twoSum(self, nums: List[int], target: int) -> List[int]:\n ", + "java": "class Solution {\n public int[] twoSum(int[] nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::vector twoSum(std::vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "return Arrays.equals(Arrays.sort(result), Arrays.sort(eval(expected)));", + "cpp": "vector sortedResult(result.begin(), result.end());\nsort(sortedResult.begin(), sortedResult.end());\nvector sortedExpected(eval(expected).begin(), eval(expected).end());\nsort(sortedExpected.begin(), sortedExpected.end());\nreturn sortedResult == sortedExpected;" + }, + "explanation": "https://www.youtube.com/watch?v=KLlXCFG5TnA&pp=ygUQTmVldENvZGUgVHdvIFN1bQ%3D%3D" }, { "title": "Palindrome Number", @@ -47,9 +56,9 @@ "description": "

Given an integer x, return true if x is a palindrome, and false otherwise.

\n\n

 

\n

Example 1:

\n\n
\nInput: x = 121\nOutput: true\nExplanation: 121 reads as 121 from left to right and from right to left.\n
\n\n

Example 2:

\n\n
\nInput: x = -121\nOutput: false\nExplanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.\n
\n\n

Example 3:

\n\n
\nInput: x = 10\nOutput: false\nExplanation: Reads 01 from right to left. Therefore it is not a palindrome.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= x <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without converting the integer to a string?", "difficulty": "easy", "sample_test_cases": [ - "isPalindrome(121)", - "isPalindrome(-121)", - "isPalindrome(10)" + "--arg1=121", + "--arg1=-121", + "--arg1=10" ], "sample_test_results": [ "True", @@ -57,16 +66,16 @@ "False" ], "hidden_test_cases": [ - "isPalindrome(0)", - "isPalindrome(1234321)", - "isPalindrome(-1)", - "isPalindrome(1000)", - "isPalindrome(12321)", - "isPalindrome(100001)", - "isPalindrome(2147483647)", - "isPalindrome(-2147483648)", - "isPalindrome(11)", - "isPalindrome(1000021)" + "--arg1=0", + "--arg1=1234321", + "--arg1=-1", + "--arg1=1000", + "--arg1=12321", + "--arg1=100001", + "--arg1=2147483647", + "--arg1=-2147483648", + "--arg1=11", + "--arg1=1000021" ], "hidden_test_results": [ "True", @@ -80,8 +89,17 @@ "True", "False" ], - "boilerplate": "class Solution:\n def isPalindrome(self, x: int) -> bool:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def isPalindrome(self, x: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPalindrome(int x) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPalindrome(int x) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "{\n return result == std::stod(expected);\n}" + }, + "explanation": "https://www.youtube.com/watch?v=yubRKwixN-U&pp=ygUaTmVldENvZGUgUGFsaW5kcm9tZSBOdW1iZXI%3D" }, { "title": "Longest Common Prefix", @@ -89,24 +107,24 @@ "description": "

Write a function to find the longest common prefix string amongst an array of strings.

\n\n

If there is no common prefix, return an empty string "".

\n\n

 

\n

Example 1:

\n\n
\nInput: strs = ["flower","flow","flight"]\nOutput: "fl"\n
\n\n

Example 2:

\n\n
\nInput: strs = ["dog","racecar","car"]\nOutput: ""\nExplanation: There is no common prefix among the input strings.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= strs.length <= 200
  • \n\t
  • 0 <= strs[i].length <= 200
  • \n\t
  • strs[i] consists of only lowercase English letters.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "longestCommonPrefix(['flower','flow','flight'])", - "longestCommonPrefix(['dog','racecar','car'])" + "--arg1='flower','flow','flight'", + "--arg1='dog','racecar','car'" ], "sample_test_results": [ "'fl'", "''" ], "hidden_test_cases": [ - "longestCommonPrefix(['interspecies','interstellar','interstate'])", - "longestCommonPrefix(['throne','throne'])", - "longestCommonPrefix([''])", - "longestCommonPrefix(['a'])", - "longestCommonPrefix(['','b'])", - "longestCommonPrefix(['prefix','prefix','prefix'])", - "longestCommonPrefix(['abc','def','ghi'])", - "longestCommonPrefix(['flower','flower','flower','flower'])", - "longestCommonPrefix(['x','xy','xyz'])", - "longestCommonPrefix(['ab','a'])" + "--arg1='interspecies','interstellar','interstate'", + "--arg1='throne','throne'", + "--arg1=''", + "--arg1='a'", + "--arg1='','b'", + "--arg1='prefix','prefix','prefix'", + "--arg1='abc','def','ghi'", + "--arg1='flower','flower','flower','flower'", + "--arg1='x','xy','xyz'", + "--arg1='ab','a'" ], "hidden_test_results": [ "'inters'", @@ -120,8 +138,17 @@ "'x'", "'a'" ], - "boilerplate": "class Solution:\n def longestCommonPrefix(self, strs: List[str]) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def longestCommonPrefix(self, strs: List[str]) -> str:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public String longestCommonPrefix(List strs) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string longestCommonPrefix(vector& strs) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try { \n return result == expected;\n} catch (Exception e) {\n return false;\n}", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=0sWShKIJoo4&pp=ygUeTmVldENvZGUgTG9uZ2VzdCBDb21tb24gUHJlZml4" }, { "title": "Valid Parentheses", @@ -129,10 +156,10 @@ "description": "

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

\n\n

An input string is valid if:

\n\n
    \n\t
  1. Open brackets must be closed by the same type of brackets.
  2. \n\t
  3. Open brackets must be closed in the correct order.
  4. \n\t
  5. Every close bracket has a corresponding open bracket of the same type.
  6. \n
\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "()"

\n\n

Output: true

\n
\n\n

Example 2:

\n\n
\n

Input: s = "()[]{}"

\n\n

Output: true

\n
\n\n

Example 3:

\n\n
\n

Input: s = "(]"

\n\n

Output: false

\n
\n\n

Example 4:

\n\n
\n

Input: s = "([])"

\n\n

Output: true

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of parentheses only '()[]{}'.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "isValid('()')", - "isValid('()[]{}')", - "isValid('(]')", - "isValid('([])')" + "--arg1='()'", + "--arg1='()[]{}'", + "--arg1='(]'", + "--arg1='([])'" ], "sample_test_results": [ "True", @@ -141,16 +168,16 @@ "True" ], "hidden_test_cases": [ - "isValid('{[]}')", - "isValid('((()))')", - "isValid('(()[]{})')", - "isValid('}{}')", - "isValid('')", - "isValid('((())')", - "isValid('())')", - "isValid('([)]')", - "isValid('{{{}}}')", - "isValid('[({})]')" + "--arg1='{[]}'", + "--arg1='((()))'", + "--arg1='(()[]{})'", + "--arg1='}{}'", + "--arg1=''", + "--arg1='((())'", + "--arg1='())'", + "--arg1='([)]'", + "--arg1='{{{}}}'", + "--arg1='[({})]'" ], "hidden_test_results": [ "True", @@ -164,8 +191,17 @@ "True", "True" ], - "boilerplate": "class Solution:\n def isValid(self, s: str) -> bool:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def isValid(self, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean isValid(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isValid(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(evaluate(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=WTzjTskDFMg&pp=ygUaTmVldENvZGUgVmFsaWQgUGFyZW50aGVzZXM%3D" }, { "title": "Find the Index of the First Occurrence in a String", @@ -173,24 +209,24 @@ "description": "

Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

\n\n

 

\n

Example 1:

\n\n
\nInput: haystack = "sadbutsad", needle = "sad"\nOutput: 0\nExplanation: "sad" occurs at index 0 and 6.\nThe first occurrence is at index 0, so we return 0.\n
\n\n

Example 2:

\n\n
\nInput: haystack = "leetcode", needle = "leeto"\nOutput: -1\nExplanation: "leeto" did not occur in "leetcode", so we return -1.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= haystack.length, needle.length <= 104
  • \n\t
  • haystack and needle consist of only lowercase English characters.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "strStr('sadbutsad', 'sad')", - "strStr('leetcode', 'leeto')" + "--arg1='sadbutsad' --arg2='sad'", + "--arg1='leetcode' --arg2='leeto'" ], "sample_test_results": [ "0", "-1" ], "hidden_test_cases": [ - "strStr('hello', 'll')", - "strStr('aaaaa', 'bba')", - "strStr('', '')", - "strStr('a', 'a')", - "strStr('mississippi', 'issi')", - "strStr('aaaaaa', 'aa')", - "strStr('abc', 'c')", - "strStr('hello world', 'world')", - "strStr('abcabcd', 'abcd')", - "strStr('testing', '')" + "--arg1='hello' --arg2='ll'", + "--arg1='aaaaa' --arg2='bba'", + "--arg1='' --arg2=''", + "--arg1='a' --arg2='a'", + "--arg1='mississippi' --arg2='issi'", + "--arg1='aaaaaa' --arg2='aa'", + "--arg1='abc' --arg2='c'", + "--arg1='hello world' --arg2='world'", + "--arg1='abcabcd' --arg2='abcd'", + "--arg1='testing' --arg2=''" ], "hidden_test_results": [ "2", @@ -204,8 +240,17 @@ "3", "0" ], - "boilerplate": "class Solution:\n def strStr(self, haystack: str, needle: str) -> int:\n ", - "compare_func": "return result == int(expected)" + "boilerplate": { + "python": "class Solution:\n def strStr(self, haystack: str, needle: str) -> int:\n ", + "java": "class Solution {\n public int strStr(String haystack, String needle) {\n // Your logic here\n }\n}", + "cpp": "class Solution {\npublic:\n int strStr(string haystack, string needle) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Gjkhm1gYIMw&pp=ygU7TmVldENvZGUgRmluZCB0aGUgSW5kZXggb2YgdGhlIEZpcnN0IE9jY3VycmVuY2UgaW4gYSBTdHJpbmc%3D" }, { "title": "Search Insert Position", @@ -213,9 +258,9 @@ "description": "

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.

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,3,5,6], target = 5\nOutput: 2\n
\n\n

Example 2:

\n\n
\nInput: nums = [1,3,5,6], target = 2\nOutput: 1\n
\n\n

Example 3:

\n\n
\nInput: nums = [1,3,5,6], target = 7\nOutput: 4\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 104
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • nums contains distinct values sorted in ascending order.
  • \n\t
  • -104 <= target <= 104
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "searchInsert([1,3,5,6], 5)", - "searchInsert([1,3,5,6], 2)", - "searchInsert([1,3,5,6], 7)" + "--arg1=1,3,5,6 --arg2=5", + "--arg1=1,3,5,6 --arg2=2", + "--arg1=1,3,5,6 --arg2=7" ], "sample_test_results": [ "2", @@ -223,16 +268,16 @@ "4" ], "hidden_test_cases": [ - "searchInsert([1], 0)", - "searchInsert([1], 2)", - "searchInsert([1,3,5,6,8,10], 9)", - "searchInsert([1,4,6,7,8,9], 6)", - "searchInsert([-5,-3,0,1,3], -4)", - "searchInsert([-3,-1,0,2], 1)", - "searchInsert([1,2,3,4,5], 5)", - "searchInsert([2,4,6,8], 1)", - "searchInsert([1,3,5,7], 4)", - "searchInsert([1,3,5,7,9], 8)" + "--arg1=1 --arg2=0", + "--arg1=1 --arg2=2", + "--arg1=1,3,5,6,8,10 --arg2=9", + "--arg1=1,4,6,7,8,9 --arg2=6", + "--arg1=-5,-3,0,1,3 --arg2=-4", + "--arg1=-3,-1,0,2 --arg2=1", + "--arg1=1,2,3,4,5 --arg2=5", + "--arg1=2,4,6,8 --arg2=1", + "--arg1=1,3,5,7 --arg2=4", + "--arg1=1,3,5,7,9 --arg2=8" ], "hidden_test_results": [ "0", @@ -246,8 +291,17 @@ "2", "4" ], - "boilerplate": "class Solution:\n def searchInsert(self, nums: List[int], target: int) -> int:\n ", - "compare_func": "return result == int(expected)" + "boilerplate": { + "python": "class Solution:\n def searchInsert(self, nums: List[int], target: int) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int searchInsert(List nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int searchInsert(vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return Integer.compare(result, Integer.parseInt(expected)) == 0;", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=K-RYzDZkzCI&pp=ygUfTmVldENvZGUgU2VhcmNoIEluc2VydCBQb3NpdGlvbg%3D%3D" }, { "title": "Length of Last Word", @@ -255,9 +309,9 @@ "description": "

Given a string s consisting of words and spaces, return the length of the last word in the string.

\n\n

A word is a maximal substring consisting of non-space characters only.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "Hello World"\nOutput: 5\nExplanation: The last word is "World" with length 5.\n
\n\n

Example 2:

\n\n
\nInput: s = "   fly me   to   the moon  "\nOutput: 4\nExplanation: The last word is "moon" with length 4.\n
\n\n

Example 3:

\n\n
\nInput: s = "luffy is still joyboy"\nOutput: 6\nExplanation: The last word is "joyboy" with length 6.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of only English letters and spaces ' '.
  • \n\t
  • There will be at least one word in s.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "lengthOfLastWord(\"Hello World\")", - "lengthOfLastWord(\" fly me to the moon \")", - "lengthOfLastWord(\"luffy is still joyboy\")" + "--arg1=\"Hello World\"", + "--arg1=\" fly me to the moon \"", + "--arg1=\"luffy is still joyboy\"" ], "sample_test_results": [ "5", @@ -265,16 +319,16 @@ "6" ], "hidden_test_cases": [ - "lengthOfLastWord(\"a\")", - "lengthOfLastWord(\"hello \")", - "lengthOfLastWord(\" space\")", - "lengthOfLastWord(\"multiple words here\")", - "lengthOfLastWord(\"oneword\")", - "lengthOfLastWord(\" spaces between words \")", - "lengthOfLastWord(\"trailing space \")", - "lengthOfLastWord(\" leading space\")", - "lengthOfLastWord(\"multiple spaces between\")", - "lengthOfLastWord(\"z\")" + "--arg1=\"a\"", + "--arg1=\"hello \"", + "--arg1=\" space\"", + "--arg1=\"multiple words here\"", + "--arg1=\"oneword\"", + "--arg1=\" spaces between words \"", + "--arg1=\"trailing space \"", + "--arg1=\" leading space\"", + "--arg1=\"multiple spaces between\"", + "--arg1=\"z\"" ], "hidden_test_results": [ "1", @@ -288,8 +342,17 @@ "7", "1" ], - "boilerplate": "class Solution:\n def lengthOfLastWord(self, s: str) -> int:\n ", - "compare_func": "return result == int(expected)" + "boilerplate": { + "python": "class Solution:\n def lengthOfLastWord(self, s: str) -> int:\n ", + "java": "class Solution {\n public int lengthOfLastWord(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int lengthOfLastWord(const std::string& s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=KT9rltZTybQ&pp=ygUcTmVldENvZGUgTGVuZ3RoIG9mIExhc3QgV29yZA%3D%3D" }, { "title": "Plus One", @@ -297,41 +360,50 @@ "description": "

You are given a large integer represented as an integer array digits, where each digits[i] is the ith 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 any leading 0's.

\n\n

Increment the large integer by one and return the resulting array of digits.

\n\n

 

\n

Example 1:

\n\n
\nInput: digits = [1,2,3]\nOutput: [1,2,4]\nExplanation: The array represents the integer 123.\nIncrementing by one gives 123 + 1 = 124.\nThus, the result should be [1,2,4].\n
\n\n

Example 2:

\n\n
\nInput: digits = [4,3,2,1]\nOutput: [4,3,2,2]\nExplanation: The array represents the integer 4321.\nIncrementing by one gives 4321 + 1 = 4322.\nThus, the result should be [4,3,2,2].\n
\n\n

Example 3:

\n\n
\nInput: digits = [9]\nOutput: [1,0]\nExplanation: The array represents the integer 9.\nIncrementing by one gives 9 + 1 = 10.\nThus, the result should be [1,0].\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= digits.length <= 100
  • \n\t
  • 0 <= digits[i] <= 9
  • \n\t
  • digits does not contain any leading 0's.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "plusOne([1,2,3])", - "plusOne([4,3,2,1])", - "plusOne([9])" + "--arg1=1,2,3", + "--arg1=4,3,2,1", + "--arg1=9" ], "sample_test_results": [ - "[1, 2, 4]", - "[4, 3, 2, 2]", - "[1, 0]" + "1, 2, 4", + "4, 3, 2, 2", + "1, 0" ], "hidden_test_cases": [ - "plusOne([0])", - "plusOne([9,9])", - "plusOne([1,0,0])", - "plusOne([1,9,9])", - "plusOne([9,8,9])", - "plusOne([1,2,3,4])", - "plusOne([9,9,9,9])", - "plusOne([5,0,9])", - "plusOne([1])", - "plusOne([4,9,9,9])" + "--arg1=0", + "--arg1=9,9", + "--arg1=1,0,0", + "--arg1=1,9,9", + "--arg1=9,8,9", + "--arg1=1,2,3,4", + "--arg1=9,9,9,9", + "--arg1=5,0,9", + "--arg1=1", + "--arg1=4,9,9,9" ], "hidden_test_results": [ - "[1]", - "[1, 0, 0]", - "[1, 0, 1]", - "[2, 0, 0]", - "[9, 9, 0]", - "[1, 2, 3, 5]", - "[1, 0, 0, 0, 0]", - "[5, 1, 0]", - "[2]", - "[5, 0, 0, 0]" - ], - "boilerplate": "class Solution:\n def plusOne(self, digits: List[int]) -> List[int]:\n ", - "compare_func": "return str(result) == expected" + "1", + "1, 0, 0", + "1, 0, 1", + "2, 0, 0", + "9, 9, 0", + "1, 2, 3, 5", + "1, 0, 0, 0, 0", + "5, 1, 0", + "2", + "5, 0, 0, 0" + ], + "boilerplate": { + "python": "class Solution:\n def plusOne(self, digits: List[int]) -> List[int]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List plusOne(List digits) {\n // \n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector plusOne(vector& digits) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=jIaA8boiG1s&pp=ygURTmVldENvZGUgUGx1cyBPbmU%3D" }, { "title": "Add Binary", @@ -339,24 +411,24 @@ "description": "

Given two binary strings a and b, return their sum as a binary string.

\n\n

 

\n

Example 1:

\n
Input: a = \"11\", b = \"1\"\nOutput: \"100\"\n

Example 2:

\n
Input: a = \"1010\", b = \"1011\"\nOutput: \"10101\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= a.length, b.length <= 104
  • \n\t
  • a and b consist only of '0' or '1' characters.
  • \n\t
  • Each string does not contain leading zeros except for the zero itself.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "addBinary(\"11\", \"1\")", - "addBinary(\"1010\", \"1011\")" + "--arg1=\"11\" --arg2=\"1\"", + "--arg1=\"1010\" --arg2=\"1011\"" ], "sample_test_results": [ "'100'", "'10101'" ], "hidden_test_cases": [ - "addBinary(\"0\", \"0\")", - "addBinary(\"1\", \"1\")", - "addBinary(\"111\", \"111\")", - "addBinary(\"1111\", \"1111\")", - "addBinary(\"1010\", \"0101\")", - "addBinary(\"100\", \"110\")", - "addBinary(\"11\", \"11\")", - "addBinary(\"1\", \"111\")", - "addBinary(\"1000\", \"1100\")", - "addBinary(\"1111\", \"1\")" + "--arg1=\"0\" --arg2=\"0\"", + "--arg1=\"1\" --arg2=\"1\"", + "--arg1=\"111\" --arg2=\"111\"", + "--arg1=\"1111\" --arg2=\"1111\"", + "--arg1=\"1010\" --arg2=\"0101\"", + "--arg1=\"100\" --arg2=\"110\"", + "--arg1=\"11\" --arg2=\"11\"", + "--arg1=\"1\" --arg2=\"111\"", + "--arg1=\"1000\" --arg2=\"1100\"", + "--arg1=\"1111\" --arg2=\"1\"" ], "hidden_test_results": [ "'0'", @@ -370,8 +442,17 @@ "'10100'", "'10000'" ], - "boilerplate": "class Solution:\n def addBinary(self, a: str, b: str) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def addBinary(self, a: str, b: str) -> str:\n ", + "java": "class Solution {\n public String addBinary(String a, String b) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string addBinary(string a, string b) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=keuWJ47xG8g&pp=ygUTTmVldENvZGUgQWRkIEJpbmFyeQ%3D%3D" }, { "title": "Climbing Stairs", @@ -379,24 +460,24 @@ "description": "

You are climbing a staircase. It takes n steps to reach the top.

\n\n

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 2\nOutput: 2\nExplanation: There are two ways to climb to the top.\n1. 1 step + 1 step\n2. 2 steps\n
\n\n

Example 2:

\n\n
\nInput: n = 3\nOutput: 3\nExplanation: There are three ways to climb to the top.\n1. 1 step + 1 step + 1 step\n2. 1 step + 2 steps\n3. 2 steps + 1 step\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 45
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "climbStairs(2)", - "climbStairs(3)" + "--arg1=2", + "--arg1=3" ], "sample_test_results": [ "2", "3" ], "hidden_test_cases": [ - "climbStairs(1)", - "climbStairs(4)", - "climbStairs(5)", - "climbStairs(6)", - "climbStairs(7)", - "climbStairs(8)", - "climbStairs(9)", - "climbStairs(10)", - "climbStairs(20)", - "climbStairs(30)" + "--arg1=1", + "--arg1=4", + "--arg1=5", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9", + "--arg1=10", + "--arg1=20", + "--arg1=30" ], "hidden_test_results": [ "1", @@ -410,8 +491,17 @@ "10946", "1346269" ], - "boilerplate": "class Solution:\n def climbStairs(self, n: int) -> int:\n ", - "compare_func": "return result == int(expected)" + "boilerplate": { + "python": "class Solution:\n def climbStairs(self, n: int) -> int:\n ", + "java": "class Solution {\n public int climbStairs(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int climbStairs(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Y0lT9Fck7qI&pp=ygUYTmVldENvZGUgQ2xpbWJpbmcgU3RhaXJz" }, { "title": "Best Time to Buy and Sell Stock", @@ -419,9 +509,9 @@ "description": "

You are given an array prices where prices[i] is the price of a given stock on the ith day.

\n\n

You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.

\n\n

Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.

\n\n

 

\n

Example 1:

\n\n
\nInput: prices = [7,1,5,3,6,4]\nOutput: 5\nExplanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.\nNote that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.\n
\n\n

Example 2:

\n\n
\nInput: prices = [7,6,4,3,1]\nOutput: 0\nExplanation: In this case, no transactions are done and the max profit = 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= prices.length <= 105
  • \n\t
  • 0 <= prices[i] <= 104
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "maxProfit([7,1,5,3,6,4])", - "maxProfit([7,6,4,3,1])", - "maxProfit([2,4,1,7])" + "--arg1=7,1,5,3,6,4", + "--arg1=7,6,4,3,1", + "--arg1=2,4,1,7" ], "sample_test_results": [ "5", @@ -429,16 +519,16 @@ "6" ], "hidden_test_cases": [ - "maxProfit([1])", - "maxProfit([1,2])", - "maxProfit([2,1])", - "maxProfit([3,3,3])", - "maxProfit([1,2,4,2,5,7,2,4,9,0])", - "maxProfit([2,1,2,1,0,1,2])", - "maxProfit([9,8,7,6,5,4,3,2,1])", - "maxProfit([1,4,1,4,3,1])", - "maxProfit([10000,9999,9998,9997])", - "maxProfit([0,2,0,2,0,2])" + "--arg1=1", + "--arg1=1,2", + "--arg1=2,1", + "--arg1=3,3,3", + "--arg1=1,2,4,2,5,7,2,4,9,0", + "--arg1=2,1,2,1,0,1,2", + "--arg1=9,8,7,6,5,4,3,2,1", + "--arg1=1,4,1,4,3,1", + "--arg1=10000,9999,9998,9997", + "--arg1=0,2,0,2,0,2" ], "hidden_test_results": [ "0", @@ -452,8 +542,17 @@ "0", "2" ], - "boilerplate": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", + "java": "class Solution {\n public int maxProfit(int[] prices) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxProfit(vector& prices) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=1pkOgXD63yU&pp=ygUoTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jaw%3D%3D" }, { "title": "Valid Palindrome", @@ -461,9 +560,9 @@ "description": "

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.

\n\n

Given a string s, return true if it is a palindrome, or false otherwise.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "A man, a plan, a canal: Panama"\nOutput: true\nExplanation: "amanaplanacanalpanama" is a palindrome.\n
\n\n

Example 2:

\n\n
\nInput: s = "race a car"\nOutput: false\nExplanation: "raceacar" is not a palindrome.\n
\n\n

Example 3:

\n\n
\nInput: s = " "\nOutput: true\nExplanation: s is an empty string "" after removing non-alphanumeric characters.\nSince an empty string reads the same forward and backward, it is a palindrome.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 2 * 105
  • \n\t
  • s consists only of printable ASCII characters.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "isPalindrome(\"A man, a plan, a canal: Panama\")", - "isPalindrome(\"race a car\")", - "isPalindrome(\" \")" + "--arg1=\"A man --arg2=a plan --arg3=a canal: Panama\"", + "--arg1=\"race a car\"", + "--arg1=\" \"" ], "sample_test_results": [ "True", @@ -471,16 +570,16 @@ "True" ], "hidden_test_cases": [ - "isPalindrome(\"\")", - "isPalindrome(\".,\")", - "isPalindrome(\"0P\")", - "isPalindrome(\"abc123cba\")", - "isPalindrome(\"Race a Car\")", - "isPalindrome(\"!@#$%^&*()\")", - "isPalindrome(\"12321\")", - "isPalindrome(\"Never odd or even\")", - "isPalindrome(\"a\")", - "isPalindrome(\".,a,.\")" + "--arg1=\"\"", + "--arg1=\". --arg2=\"", + "--arg1=\"0P\"", + "--arg1=\"abc123cba\"", + "--arg1=\"Race a Car\"", + "--arg1=\"!@#$%^&*()\"", + "--arg1=\"12321\"", + "--arg1=\"Never odd or even\"", + "--arg1=\"a\"", + "--arg1=\". --arg2=a --arg3=.\"" ], "hidden_test_results": [ "True", @@ -494,8 +593,17 @@ "True", "True" ], - "boilerplate": "class Solution:\n def isPalindrome(self, s: str) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def isPalindrome(self, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean isPalindrome(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPalindrome(std::string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return toLowerCase(result) == toLowerCase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=jJXJ16kPFWg&pp=ygUZTmVldENvZGUgVmFsaWQgUGFsaW5kcm9tZQ%3D%3D" }, { "title": "Excel Sheet Column Title", @@ -503,9 +611,9 @@ "description": "

Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.

\n\n

For example:

\n\n
\nA -> 1\nB -> 2\nC -> 3\n...\nZ -> 26\nAA -> 27\nAB -> 28 \n...\n
\n\n

 

\n

Example 1:

\n\n
\nInput: columnNumber = 1\nOutput: "A"\n
\n\n

Example 2:

\n\n
\nInput: columnNumber = 28\nOutput: "AB"\n
\n\n

Example 3:

\n\n
\nInput: columnNumber = 701\nOutput: "ZY"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= columnNumber <= 231 - 1
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "convertToTitle(1)", - "convertToTitle(28)", - "convertToTitle(701)" + "--arg1=1", + "--arg1=28", + "--arg1=701" ], "sample_test_results": [ "'A'", @@ -513,16 +621,16 @@ "'ZY'" ], "hidden_test_cases": [ - "convertToTitle(26)", - "convertToTitle(27)", - "convertToTitle(52)", - "convertToTitle(676)", - "convertToTitle(702)", - "convertToTitle(1000)", - "convertToTitle(2147483647)", - "convertToTitle(18278)", - "convertToTitle(17576)", - "convertToTitle(18277)" + "--arg1=26", + "--arg1=27", + "--arg1=52", + "--arg1=676", + "--arg1=702", + "--arg1=1000", + "--arg1=2147483647", + "--arg1=18278", + "--arg1=17576", + "--arg1=18277" ], "hidden_test_results": [ "'Z'", @@ -536,8 +644,17 @@ "'YYZ'", "'ZZY'" ], - "boilerplate": "class Solution:\n def convertToTitle(self, columnNumber: int) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def convertToTitle(self, columnNumber: int) -> str:\n ", + "java": "class Solution {\n public String convertToTitle(int columnNumber) {\n // Implementation goes here\n }\n}", + "cpp": "class Solution {\npublic:\n std::string convertToTitle(int columnNumber) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=X_vJDpCCuoA&pp=ygUhTmVldENvZGUgRXhjZWwgU2hlZXQgQ29sdW1uIFRpdGxl" }, { "title": "Happy Number", @@ -545,9 +662,9 @@ "description": "

Write an algorithm to determine if a number n is happy.

\n\n

A happy number is a number defined by the following process:

\n\n
    \n\t
  • Starting with any positive integer, replace the number by the sum of the squares of its digits.
  • \n\t
  • Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1.
  • \n\t
  • Those numbers for which this process ends in 1 are happy.
  • \n
\n\n

Return true if n is a happy number, and false if not.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 19\nOutput: true\nExplanation:\n12 + 92 = 82\n82 + 22 = 68\n62 + 82 = 100\n12 + 02 + 02 = 1\n
\n\n

Example 2:

\n\n
\nInput: n = 2\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "isHappy(19)", - "isHappy(2)", - "isHappy(7)" + "--arg1=19", + "--arg1=2", + "--arg1=7" ], "sample_test_results": [ "True", @@ -555,16 +672,16 @@ "True" ], "hidden_test_cases": [ - "isHappy(1)", - "isHappy(4)", - "isHappy(16)", - "isHappy(89)", - "isHappy(100)", - "isHappy(1111111)", - "isHappy(999999)", - "isHappy(123)", - "isHappy(3)", - "isHappy(44)" + "--arg1=1", + "--arg1=4", + "--arg1=16", + "--arg1=89", + "--arg1=100", + "--arg1=1111111", + "--arg1=999999", + "--arg1=123", + "--arg1=3", + "--arg1=44" ], "hidden_test_results": [ "True", @@ -578,8 +695,17 @@ "False", "True" ], - "boilerplate": "class Solution:\n def isHappy(self, n: int) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def isHappy(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isHappy(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isHappy(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=ljz85bxOYJ0&pp=ygUVTmVldENvZGUgSGFwcHkgTnVtYmVy" }, { "title": "Isomorphic Strings", @@ -587,9 +713,9 @@ "description": "

Given two strings s and t, determine if they are isomorphic.

\n\n

Two strings s and t are isomorphic if the characters in s can be replaced to get t.

\n\n

All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself.

\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "egg", t = "add"

\n\n

Output: true

\n\n

Explanation:

\n\n

The strings s and t can be made identical by:

\n\n
    \n\t
  • Mapping 'e' to 'a'.
  • \n\t
  • Mapping 'g' to 'd'.
  • \n
\n
\n\n

Example 2:

\n\n
\n

Input: s = "foo", t = "bar"

\n\n

Output: false

\n\n

Explanation:

\n\n

The strings s and t can not be made identical as 'o' needs to be mapped to both 'a' and 'r'.

\n
\n\n

Example 3:

\n\n
\n

Input: s = "paper", t = "title"

\n\n

Output: true

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 5 * 104
  • \n\t
  • t.length == s.length
  • \n\t
  • s and t consist of any valid ascii character.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "isIsomorphic(\"egg\", \"add\")", - "isIsomorphic(\"foo\", \"bar\")", - "isIsomorphic(\"paper\", \"title\")" + "--arg1=\"egg\" --arg2=\"add\"", + "--arg1=\"foo\" --arg2=\"bar\"", + "--arg1=\"paper\" --arg2=\"title\"" ], "sample_test_results": [ "True", @@ -597,16 +723,16 @@ "True" ], "hidden_test_cases": [ - "isIsomorphic(\"\", \"\")", - "isIsomorphic(\"a\", \"b\")", - "isIsomorphic(\"ab\", \"aa\")", - "isIsomorphic(\"badc\", \"bada\")", - "isIsomorphic(\"abcde\", \"vwxyz\")", - "isIsomorphic(\"hello\", \"world\")", - "isIsomorphic(\"aaaa\", \"bbbb\")", - "isIsomorphic(\"ab\", \"cd\")", - "isIsomorphic(\"13\", \"42\")", - "isIsomorphic(\"ACAB\", \"XCXY\")" + "--arg1=\"\" --arg2=\"\"", + "--arg1=\"a\" --arg2=\"b\"", + "--arg1=\"ab\" --arg2=\"aa\"", + "--arg1=\"badc\" --arg2=\"bada\"", + "--arg1=\"abcde\" --arg2=\"vwxyz\"", + "--arg1=\"hello\" --arg2=\"world\"", + "--arg1=\"aaaa\" --arg2=\"bbbb\"", + "--arg1=\"ab\" --arg2=\"cd\"", + "--arg1=\"13\" --arg2=\"42\"", + "--arg1=\"ACAB\" --arg2=\"XCXY\"" ], "hidden_test_results": [ "True", @@ -620,8 +746,17 @@ "True", "True" ], - "boilerplate": "class Solution:\n def isIsomorphic(self, s: str, t: str) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def isIsomorphic(self, s: str, t: str) -> bool:\n ", + "java": "class Solution {\n public boolean isIsomorphic(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isIsomorphic(string s, string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return toLowerCase(result) == toLowerCase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=7yF-U1hLEqQ&pp=ygUbTmVldENvZGUgSXNvbW9ycGhpYyBTdHJpbmdz" }, { "title": "Contains Duplicate II", @@ -629,9 +764,9 @@ "description": "

Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) <= k.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,3,1], k = 3\nOutput: true\n
\n\n

Example 2:

\n\n
\nInput: nums = [1,0,1,1], k = 1\nOutput: true\n
\n\n

Example 3:

\n\n
\nInput: nums = [1,2,3,1,2,3], k = 2\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • 0 <= k <= 105
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "containsNearbyDuplicate([1,2,3,1], 3)", - "containsNearbyDuplicate([1,0,1,1], 1)", - "containsNearbyDuplicate([1,2,3,1,2,3], 2)" + "--arg1=1,2,3,1 --arg2=3", + "--arg1=1,0,1,1 --arg2=1", + "--arg1=1,2,3,1,2,3 --arg2=2" ], "sample_test_results": [ "True", @@ -639,16 +774,16 @@ "False" ], "hidden_test_cases": [ - "containsNearbyDuplicate([1,2,3,4,5], 2)", - "containsNearbyDuplicate([1,1], 1)", - "containsNearbyDuplicate([1,2,1], 0)", - "containsNearbyDuplicate([1,2,3,4,1], 4)", - "containsNearbyDuplicate([1,2,3,4,1], 3)", - "containsNearbyDuplicate([-1,-1], 1)", - "containsNearbyDuplicate([1], 1)", - "containsNearbyDuplicate([1,2,3,4,2], 3)", - "containsNearbyDuplicate([1,1,1,1], 2)", - "containsNearbyDuplicate([1,2,1,2], 2)" + "--arg1=1,2,3,4,5 --arg2=2", + "--arg1=1,1 --arg2=1", + "--arg1=1,2,1 --arg2=0", + "--arg1=1,2,3,4,1 --arg2=4", + "--arg1=1,2,3,4,1 --arg2=3", + "--arg1=-1,-1 --arg2=1", + "--arg1=1 --arg2=1", + "--arg1=1,2,3,4,2 --arg2=3", + "--arg1=1,1,1,1 --arg2=2", + "--arg1=1,2,1,2 --arg2=2" ], "hidden_test_results": [ "False", @@ -662,8 +797,17 @@ "True", "True" ], - "boilerplate": "class Solution:\n def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool:\n ", + "java": "class Solution {\n public boolean containsNearbyDuplicate(int[] nums, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool containsNearbyDuplicate(std::vector& nums, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=ypn0aZ0nrL4&pp=ygUeTmVldENvZGUgQ29udGFpbnMgRHVwbGljYXRlIElJ" }, { "title": "Summary Ranges", @@ -671,41 +815,50 @@ "description": "

You are given a sorted unique integer array nums.

\n\n

A range [a,b] is the set of all integers from a to b (inclusive).

\n\n

Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, each element of nums is covered by exactly one of the ranges, and there is no integer x such that x is in one of the ranges but not in nums.

\n\n

Each range [a,b] in the list should be output as:

\n\n
    \n\t
  • "a->b" if a != b
  • \n\t
  • "a" if a == b
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [0,1,2,4,5,7]\nOutput: ["0->2","4->5","7"]\nExplanation: The ranges are:\n[0,2] --> "0->2"\n[4,5] --> "4->5"\n[7,7] --> "7"\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,2,3,4,6,8,9]\nOutput: ["0","2->4","6","8->9"]\nExplanation: The ranges are:\n[0,0] --> "0"\n[2,4] --> "2->4"\n[6,6] --> "6"\n[8,9] --> "8->9"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 20
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n\t
  • All the values of nums are unique.
  • \n\t
  • nums is sorted in ascending order.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "summaryRanges([0,1,2,4,5,7])", - "summaryRanges([0,2,3,4,6,8,9])", - "summaryRanges([])" + "--arg1=0,1,2,4,5,7", + "--arg1=0,2,3,4,6,8,9", + "--arg1=" ], "sample_test_results": [ - "['0->2', '4->5', '7']", - "['0', '2->4', '6', '8->9']", - "[]" + "'0->2', '4->5', '7'", + "'0', '2->4', '6', '8->9'", + "" ], "hidden_test_cases": [ - "summaryRanges([1])", - "summaryRanges([1,2])", - "summaryRanges([1,3,5,7])", - "summaryRanges([1,2,3,4,5])", - "summaryRanges([-1,0,1,2])", - "summaryRanges([-5,-4,-3,-1,0,2])", - "summaryRanges([1,3])", - "summaryRanges([1,2,4,6,7,8])", - "summaryRanges([0,1,3,5,6,7,9])", - "summaryRanges([-2147483648,2147483647])" + "--arg1=1", + "--arg1=1,2", + "--arg1=1,3,5,7", + "--arg1=1,2,3,4,5", + "--arg1=-1,0,1,2", + "--arg1=-5,-4,-3,-1,0,2", + "--arg1=1,3", + "--arg1=1,2,4,6,7,8", + "--arg1=0,1,3,5,6,7,9", + "--arg1=-2147483648,2147483647" ], "hidden_test_results": [ - "['1']", - "['1->2']", - "['1', '3', '5', '7']", - "['1->5']", - "['-1->2']", - "['-5->-3', '-1->0', '2']", - "['1', '3']", - "['1->2', '4', '6->8']", - "['0->1', '3', '5->7', '9']", - "['-2147483648', '2147483647']" - ], - "boilerplate": "class Solution:\n def summaryRanges(self, nums: List[int]) -> List[str]:\n ", - "compare_func": "return sorted(result) == sorted(eval(expected))" + "'1'", + "'1->2'", + "'1', '3', '5', '7'", + "'1->5'", + "'-1->2'", + "'-5->-3', '-1->0', '2'", + "'1', '3'", + "'1->2', '4', '6->8'", + "'0->1', '3', '5->7', '9'", + "'-2147483648', '2147483647'" + ], + "boilerplate": { + "python": "class Solution:\n def summaryRanges(self, nums: List[int]) -> List[str]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List summaryRanges(List nums) {\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector summaryRanges(vector& nums) {\n // Implementation goes here\n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "return Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray());", + "cpp": "std::sort(result.begin(), result.end());\nauto evaluated_expected = evaluateStringToVector(expected);\nstd::sort(evaluated_expected.begin(), evaluated_expected.end());\nreturn result == evaluated_expected;" + }, + "explanation": "https://www.youtube.com/watch?v=ZHJDwbfqoa8&pp=ygUXTmVldENvZGUgU3VtbWFyeSBSYW5nZXM%3D" }, { "title": "Power of Two", @@ -713,9 +866,9 @@ "description": "

Given an integer n, return true if it is a power of two. Otherwise, return false.

\n\n

An integer n is a power of two, if there exists an integer x such that n == 2x.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 1\nOutput: true\nExplanation: 20 = 1\n
\n\n

Example 2:

\n\n
\nInput: n = 16\nOutput: true\nExplanation: 24 = 16\n
\n\n

Example 3:

\n\n
\nInput: n = 3\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", "difficulty": "easy", "sample_test_cases": [ - "isPowerOfTwo(1)", - "isPowerOfTwo(16)", - "isPowerOfTwo(3)" + "--arg1=1", + "--arg1=16", + "--arg1=3" ], "sample_test_results": [ "True", @@ -723,16 +876,16 @@ "False" ], "hidden_test_cases": [ - "isPowerOfTwo(0)", - "isPowerOfTwo(-16)", - "isPowerOfTwo(2)", - "isPowerOfTwo(4)", - "isPowerOfTwo(5)", - "isPowerOfTwo(32)", - "isPowerOfTwo(64)", - "isPowerOfTwo(100)", - "isPowerOfTwo(2147483647)", - "isPowerOfTwo(-2147483648)" + "--arg1=0", + "--arg1=-16", + "--arg1=2", + "--arg1=4", + "--arg1=5", + "--arg1=32", + "--arg1=64", + "--arg1=100", + "--arg1=2147483647", + "--arg1=-2147483648" ], "hidden_test_results": [ "False", @@ -746,8 +899,17 @@ "False", "False" ], - "boilerplate": "class Solution:\n def isPowerOfTwo(self, n: int) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def isPowerOfTwo(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPowerOfTwo(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPowerOfTwo(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) == std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" + }, + "explanation": "https://www.youtube.com/watch?v=H2bjttEV4Vc&pp=ygUVTmVldENvZGUgUG93ZXIgb2YgVHdv" }, { "title": "Ugly Number", @@ -755,9 +917,9 @@ "description": "

An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.

\n\n

Given an integer n, return true if n is an ugly number.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 6\nOutput: true\nExplanation: 6 = 2 × 3\n
\n\n

Example 2:

\n\n
\nInput: n = 1\nOutput: true\nExplanation: 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5.\n
\n\n

Example 3:

\n\n
\nInput: n = 14\nOutput: false\nExplanation: 14 is not ugly since it includes the prime factor 7.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "isUgly(6)", - "isUgly(1)", - "isUgly(14)" + "--arg1=6", + "--arg1=1", + "--arg1=14" ], "sample_test_results": [ "True", @@ -765,16 +927,16 @@ "False" ], "hidden_test_cases": [ - "isUgly(8)", - "isUgly(0)", - "isUgly(-6)", - "isUgly(25)", - "isUgly(15)", - "isUgly(49)", - "isUgly(30)", - "isUgly(100)", - "isUgly(-2147483648)", - "isUgly(2147483647)" + "--arg1=8", + "--arg1=0", + "--arg1=-6", + "--arg1=25", + "--arg1=15", + "--arg1=49", + "--arg1=30", + "--arg1=100", + "--arg1=-2147483648", + "--arg1=2147483647" ], "hidden_test_results": [ "True", @@ -788,8 +950,17 @@ "False", "False" ], - "boilerplate": "class Solution:\n def isUgly(self, n: int) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def isUgly(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isUgly(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isUgly(int n) {\n\n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=M0Zay1Qr9ws&pp=ygUUTmVldENvZGUgVWdseSBOdW1iZXI%3D" }, { "title": "Word Pattern", @@ -797,9 +968,9 @@ "description": "

Given a pattern and a string s, find if s follows the same pattern.

\n\n

Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. Specifically:

\n\n
    \n\t
  • Each letter in pattern maps to exactly one unique word in s.
  • \n\t
  • Each unique word in s maps to exactly one letter in pattern.
  • \n\t
  • No two letters map to the same word, and no two words map to the same letter.
  • \n
\n\n

 

\n

Example 1:

\n\n
\n

Input: pattern = "abba", s = "dog cat cat dog"

\n\n

Output: true

\n\n

Explanation:

\n\n

The bijection can be established as:

\n\n
    \n\t
  • 'a' maps to "dog".
  • \n\t
  • 'b' maps to "cat".
  • \n
\n
\n\n

Example 2:

\n\n
\n

Input: pattern = "abba", s = "dog cat cat fish"

\n\n

Output: false

\n
\n\n

Example 3:

\n\n
\n

Input: pattern = "aaaa", s = "dog cat cat dog"

\n\n

Output: false

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= pattern.length <= 300
  • \n\t
  • pattern contains only lower-case English letters.
  • \n\t
  • 1 <= s.length <= 3000
  • \n\t
  • s contains only lowercase English letters and spaces ' '.
  • \n\t
  • s does not contain any leading or trailing spaces.
  • \n\t
  • All the words in s are separated by a single space.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "wordPattern(\"abba\", \"dog cat cat dog\")", - "wordPattern(\"abba\", \"dog cat cat fish\")", - "wordPattern(\"aaaa\", \"dog cat cat dog\")" + "--arg1=\"abba\" --arg2=\"dog cat cat dog\"", + "--arg1=\"abba\" --arg2=\"dog cat cat fish\"", + "--arg1=\"aaaa\" --arg2=\"dog cat cat dog\"" ], "sample_test_results": [ "True", @@ -807,16 +978,16 @@ "False" ], "hidden_test_cases": [ - "wordPattern(\"abc\", \"dog cat dog\")", - "wordPattern(\"jquery\", \"jquery\")", - "wordPattern(\"aaa\", \"aa aa aa\")", - "wordPattern(\"abba\", \"dog dog dog dog\")", - "wordPattern(\"ab\", \"dog cat\")", - "wordPattern(\"abc\", \"b c a\")", - "wordPattern(\"aabb\", \"cat cat dog dog\")", - "wordPattern(\"abba\", \"dog cat cat fish\")", - "wordPattern(\"\", \"\")", - "wordPattern(\"a\", \"dog\")" + "--arg1=\"abc\" --arg2=\"dog cat dog\"", + "--arg1=\"jquery\" --arg2=\"jquery\"", + "--arg1=\"aaa\" --arg2=\"aa aa aa\"", + "--arg1=\"abba\" --arg2=\"dog dog dog dog\"", + "--arg1=\"ab\" --arg2=\"dog cat\"", + "--arg1=\"abc\" --arg2=\"b c a\"", + "--arg1=\"aabb\" --arg2=\"cat cat dog dog\"", + "--arg1=\"abba\" --arg2=\"dog cat cat fish\"", + "--arg1=\"\" --arg2=\"\"", + "--arg1=\"a\" --arg2=\"dog\"" ], "hidden_test_results": [ "False", @@ -830,8 +1001,17 @@ "True", "True" ], - "boilerplate": "class Solution:\n def wordPattern(self, pattern: str, s: str) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def wordPattern(self, pattern: str, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean wordPattern(String pattern, String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool wordPattern(const string& pattern, const string& s) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return toLowercase(result) == toLowercase(expected);\n\nstd::string toLowercase(const std::string &input) {\n std::string lowercased = input;\n std::transform(lowercased.begin(), lowercased.end(), lowercased.begin(), ::tolower);\n return lowercased;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=W_akoecmCbM&pp=ygUVTmVldENvZGUgV29yZCBQYXR0ZXJu" }, { "title": "Nim Game", @@ -839,9 +1019,9 @@ "description": "

You are playing the following Nim Game with your friend:

\n\n
    \n\t
  • Initially, there is a heap of stones on the table.
  • \n\t
  • You and your friend will alternate taking turns, and you go first.
  • \n\t
  • On each turn, the person whose turn it is will remove 1 to 3 stones from the heap.
  • \n\t
  • The one who removes the last stone is the winner.
  • \n
\n\n

Given n, the number of stones in the heap, return true if you can win the game assuming both you and your friend play optimally, otherwise return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 4\nOutput: false\nExplanation: These are the possible outcomes:\n1. You remove 1 stone. Your friend removes 3 stones, including the last stone. Your friend wins.\n2. You remove 2 stones. Your friend removes 2 stones, including the last stone. Your friend wins.\n3. You remove 3 stones. Your friend removes the last stone. Your friend wins.\nIn all outcomes, your friend wins.\n
\n\n

Example 2:

\n\n
\nInput: n = 1\nOutput: true\n
\n\n

Example 3:

\n\n
\nInput: n = 2\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "canWinNim(4)", - "canWinNim(1)", - "canWinNim(2)" + "--arg1=4", + "--arg1=1", + "--arg1=2" ], "sample_test_results": [ "False", @@ -849,16 +1029,16 @@ "True" ], "hidden_test_cases": [ - "canWinNim(3)", - "canWinNim(5)", - "canWinNim(6)", - "canWinNim(7)", - "canWinNim(8)", - "canWinNim(9)", - "canWinNim(10)", - "canWinNim(100)", - "canWinNim(1000000)", - "canWinNim(2147483647)" + "--arg1=3", + "--arg1=5", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9", + "--arg1=10", + "--arg1=100", + "--arg1=1000000", + "--arg1=2147483647" ], "hidden_test_results": [ "True", @@ -872,8 +1052,17 @@ "False", "True" ], - "boilerplate": "class Solution:\n def canWinNim(self, n: int) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def canWinNim(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean canWinNim(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool canWinNim(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) ==\n std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" + }, + "explanation": "https://www.youtube.com/watch?v=ndR2buBWVc8&pp=ygURTmVldENvZGUgTmltIEdhbWU%3D" }, { "title": "Power of Three", @@ -881,9 +1070,9 @@ "description": "

Given an integer n, return true if it is a power of three. Otherwise, return false.

\n\n

An integer n is a power of three, if there exists an integer x such that n == 3x.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 27\nOutput: true\nExplanation: 27 = 33\n
\n\n

Example 2:

\n\n
\nInput: n = 0\nOutput: false\nExplanation: There is no x where 3x = 0.\n
\n\n

Example 3:

\n\n
\nInput: n = -1\nOutput: false\nExplanation: There is no x where 3x = (-1).\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", "difficulty": "easy", "sample_test_cases": [ - "isPowerOfThree(27)", - "isPowerOfThree(0)", - "isPowerOfThree(-1)" + "--arg1=27", + "--arg1=0", + "--arg1=-1" ], "sample_test_results": [ "True", @@ -891,16 +1080,16 @@ "False" ], "hidden_test_cases": [ - "isPowerOfThree(1)", - "isPowerOfThree(9)", - "isPowerOfThree(45)", - "isPowerOfThree(81)", - "isPowerOfThree(243)", - "isPowerOfThree(-3)", - "isPowerOfThree(2)", - "isPowerOfThree(99)", - "isPowerOfThree(19683)", - "isPowerOfThree(-729)" + "--arg1=1", + "--arg1=9", + "--arg1=45", + "--arg1=81", + "--arg1=243", + "--arg1=-3", + "--arg1=2", + "--arg1=99", + "--arg1=19683", + "--arg1=-729" ], "hidden_test_results": [ "True", @@ -914,8 +1103,17 @@ "True", "False" ], - "boilerplate": "class Solution:\n def isPowerOfThree(self, n: int) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def isPowerOfThree(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPowerOfThree(int n) {\n // Implementation here\n }\n}", + "cpp": "class Solution {\npublic:\n bool isPowerOfThree(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "std::string lowerCase(const std::string& str) {\n std::string lowerStr = str;\n std::transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(), ::tolower);\n return lowerStr;\n}\n\nreturn lowerCase(result) == lowerCase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=M2P2BAFmLlo&pp=ygUXTmVldENvZGUgUG93ZXIgb2YgVGhyZWU%3D" }, { "title": "Power of Four", @@ -923,9 +1121,9 @@ "description": "

Given an integer n, return true if it is a power of four. Otherwise, return false.

\n\n

An integer n is a power of four, if there exists an integer x such that n == 4x.

\n\n

 

\n

Example 1:

\n
Input: n = 16\nOutput: true\n

Example 2:

\n
Input: n = 5\nOutput: false\n

Example 3:

\n
Input: n = 1\nOutput: true\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", "difficulty": "easy", "sample_test_cases": [ - "isPowerOfFour(16)", - "isPowerOfFour(5)", - "isPowerOfFour(1)" + "--arg1=16", + "--arg1=5", + "--arg1=1" ], "sample_test_results": [ "True", @@ -933,16 +1131,16 @@ "True" ], "hidden_test_cases": [ - "isPowerOfFour(4)", - "isPowerOfFour(64)", - "isPowerOfFour(8)", - "isPowerOfFour(256)", - "isPowerOfFour(-4)", - "isPowerOfFour(0)", - "isPowerOfFour(2)", - "isPowerOfFour(100)", - "isPowerOfFour(1024)", - "isPowerOfFour(-1024)" + "--arg1=4", + "--arg1=64", + "--arg1=8", + "--arg1=256", + "--arg1=-4", + "--arg1=0", + "--arg1=2", + "--arg1=100", + "--arg1=1024", + "--arg1=-1024" ], "hidden_test_results": [ "True", @@ -956,8 +1154,17 @@ "True", "False" ], - "boilerplate": "class Solution:\n def isPowerOfFour(self, n: int) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def isPowerOfFour(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPowerOfFour(int n) {\n\n }\n}", + "cpp": "class Solution {\npublic:\n bool isPowerOfFour(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return to_lowercopy(result) == to_lowercopy(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=qEYZPwnlM0U&pp=ygUWTmVldENvZGUgUG93ZXIgb2YgRm91cg%3D%3D" }, { "title": "Reverse Vowels of a String", @@ -965,24 +1172,24 @@ "description": "

Given a string s, reverse only all the vowels in the string and return it.

\n\n

The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once.

\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "IceCreAm"

\n\n

Output: "AceCreIm"

\n\n

Explanation:

\n\n

The vowels in s are ['I', 'e', 'e', 'A']. On reversing the vowels, s becomes "AceCreIm".

\n
\n\n

Example 2:

\n\n
\n

Input: s = "leetcode"

\n\n

Output: "leotcede"

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 3 * 105
  • \n\t
  • s consist of printable ASCII characters.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "reverseVowels('IceCreAm')", - "reverseVowels('leetcode')" + "--arg1='IceCreAm'", + "--arg1='leetcode'" ], "sample_test_results": [ "'AceCreIm'", "'leotcede'" ], "hidden_test_cases": [ - "reverseVowels('hello')", - "reverseVowels('aA')", - "reverseVowels('race a car')", - "reverseVowels('')", - "reverseVowels('xyz')", - "reverseVowels('AEIOU')", - "reverseVowels('aeiou')", - "reverseVowels('.,!')", - "reverseVowels('Aa')", - "reverseVowels('LEetcOde')" + "--arg1='hello'", + "--arg1='aA'", + "--arg1='race a car'", + "--arg1=''", + "--arg1='xyz'", + "--arg1='AEIOU'", + "--arg1='aeiou'", + "--arg1='. --arg2=!'", + "--arg1='Aa'", + "--arg1='LEetcOde'" ], "hidden_test_results": [ "'holle'", @@ -996,8 +1203,17 @@ "'aA'", "'LeOtcedE'" ], - "boilerplate": "class Solution:\n def reverseVowels(self, s: str) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def reverseVowels(self, s: str) -> str:\n ", + "java": "class Solution {\n public String reverseVowels(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string reverseVowels(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=uHYjUMR3Tg8&pp=ygUjTmVldENvZGUgUmV2ZXJzZSBWb3dlbHMgb2YgYSBTdHJpbmc%3D" }, { "title": "Intersection of Two Arrays II", @@ -1005,39 +1221,48 @@ "description": "

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums1 = [1,2,2,1], nums2 = [2,2]\nOutput: [2,2]\n
\n\n

Example 2:

\n\n
\nInput: nums1 = [4,9,5], nums2 = [9,4,9,8,4]\nOutput: [4,9]\nExplanation: [9,4] is also accepted.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums1.length, nums2.length <= 1000
  • \n\t
  • 0 <= nums1[i], nums2[i] <= 1000
  • \n
\n\n

 

\n

Follow up:

\n\n
    \n\t
  • What if the given array is already sorted? How would you optimize your algorithm?
  • \n\t
  • What if nums1's size is small compared to nums2's size? Which algorithm is better?
  • \n\t
  • What if elements of nums2 are stored on disk, and the memory is limited such that you cannot load all elements into the memory at once?
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "intersect([1,2,2,1], [2,2])", - "intersect([4,9,5], [9,4,9,8,4])" + "--arg1=1,2,2,1 --arg2=[2 --arg3=2]", + "--arg1=4,9,5 --arg2=[9 --arg3=4 --arg4=9 --arg5=8 --arg6=4]" ], "sample_test_results": [ - "[2, 2]", - "[9, 4]" + "2, 2", + "9, 4" ], "hidden_test_cases": [ - "intersect([1,1,1], [1,1])", - "intersect([1,2], [1,1])", - "intersect([1], [1])", - "intersect([1,2,3], [4,5,6])", - "intersect([1,2,3,4], [1,2,3,4])", - "intersect([1,1,1,1], [1])", - "intersect([], [1])", - "intersect([1,2,2,3], [2,2,2,3])", - "intersect([1,2,3,4,5], [5,4,3,2,1])", - "intersect([1000,1000], [1000,1000])" + "--arg1=1,1,1 --arg2=[1 --arg3=1]", + "--arg1=1,2 --arg2=[1 --arg3=1]", + "--arg1=1 --arg2=1", + "--arg1=1,2,3 --arg2=[4 --arg3=5 --arg4=6]", + "--arg1=1,2,3,4 --arg2=[1 --arg3=2 --arg4=3 --arg5=4]", + "--arg1=1,1,1,1 --arg2=1", + "--arg1= --arg2=1", + "--arg1=1,2,2,3 --arg2=[2 --arg3=2 --arg4=2 --arg5=3]", + "--arg1=1,2,3,4,5 --arg2=[5 --arg3=4 --arg4=3 --arg5=2 --arg6=1]", + "--arg1=1000,1000 --arg2=[1000 --arg3=1000]" ], "hidden_test_results": [ - "[1, 1]", - "[1]", - "[1]", - "[]", - "[1, 2, 3, 4]", - "[1]", - "[]", - "[2, 2, 3]", - "[5, 4, 3, 2, 1]", - "[1000, 1000]" - ], - "boilerplate": "class Solution:\n def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:\n ", - "compare_func": "return sorted(result) == sorted(eval(expected))" + "1, 1", + "1", + "1", + "", + "1, 2, 3, 4", + "1", + "", + "2, 2, 3", + "5, 4, 3, 2, 1", + "1000, 1000" + ], + "boilerplate": { + "python": "class Solution:\n def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List intersect(int[] nums1, int[] nums2) {\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector intersect(vector& nums1, vector& nums2) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "import java.util.Arrays;\n\nboolean compareFunction(Object result, String expected) {\n Object expectedList = eval(expected); // Assuming eval converts the expected\n return Arrays.equals(Arrays.sort(result), Arrays.sort(expectedList));\n}\n\n// Note: `eval` is a placeholder for your evaluation logic, as Java \n// doesn't provide a direct equivalent for Python's eval. You need \n// to implement conversion of 'expected' from String representation \n// to the required Object format.", + "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedSorted = eval(expected); // ensure eval yields vector of same type\nstd::sort(expectedSorted.begin(), expectedSorted.end());\nreturn result == expectedSorted;" + }, + "explanation": "https://www.youtube.com/watch?v=fwUTXaMom6U&pp=ygUmTmVldENvZGUgSW50ZXJzZWN0aW9uIG9mIFR3byBBcnJheXMgSUk%3D" }, { "title": "Valid Perfect Square", @@ -1045,9 +1270,9 @@ "description": "

Given a positive integer num, return true if num is a perfect square or false otherwise.

\n\n

A perfect square is an integer that is the square of an integer. In other words, it is the product of some integer with itself.

\n\n

You must not use any built-in library function, such as sqrt.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = 16\nOutput: true\nExplanation: We return true because 4 * 4 = 16 and 4 is an integer.\n
\n\n

Example 2:

\n\n
\nInput: num = 14\nOutput: false\nExplanation: We return false because 3.742 * 3.742 = 14 and 3.742 is not an integer.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num <= 231 - 1
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "isPerfectSquare(16)", - "isPerfectSquare(14)", - "isPerfectSquare(1)" + "--arg1=16", + "--arg1=14", + "--arg1=1" ], "sample_test_results": [ "True", @@ -1055,16 +1280,16 @@ "True" ], "hidden_test_cases": [ - "isPerfectSquare(0)", - "isPerfectSquare(4)", - "isPerfectSquare(9)", - "isPerfectSquare(25)", - "isPerfectSquare(26)", - "isPerfectSquare(100)", - "isPerfectSquare(2147483647)", - "isPerfectSquare(808201)", - "isPerfectSquare(2)", - "isPerfectSquare(3)" + "--arg1=0", + "--arg1=4", + "--arg1=9", + "--arg1=25", + "--arg1=26", + "--arg1=100", + "--arg1=2147483647", + "--arg1=808201", + "--arg1=2", + "--arg1=3" ], "hidden_test_results": [ "True", @@ -1078,8 +1303,17 @@ "False", "False" ], - "boilerplate": "class Solution:\n def isPerfectSquare(self, num: int) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def isPerfectSquare(self, num: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPerfectSquare(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPerfectSquare(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Cg_wWPHJ2Sk&pp=ygUdTmVldENvZGUgVmFsaWQgUGVyZmVjdCBTcXVhcmU%3D" }, { "title": "Find the Difference", @@ -1087,9 +1321,9 @@ "description": "

You are given two strings s and t.

\n\n

String t is generated by random shuffling string s and then add one more letter at a random position.

\n\n

Return the letter that was added to t.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abcd", t = "abcde"\nOutput: "e"\nExplanation: 'e' is the letter that was added.\n
\n\n

Example 2:

\n\n
\nInput: s = "", t = "y"\nOutput: "y"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s.length <= 1000
  • \n\t
  • t.length == s.length + 1
  • \n\t
  • s and t consist of lowercase English letters.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "findTheDifference('abcd', 'abcde')", - "findTheDifference('', 'y')", - "findTheDifference('ae', 'aea')" + "--arg1='abcd' --arg2='abcde'", + "--arg1='' --arg2='y'", + "--arg1='ae' --arg2='aea'" ], "sample_test_results": [ "'e'", @@ -1097,16 +1331,16 @@ "'a'" ], "hidden_test_cases": [ - "findTheDifference('abcd', 'abcde')", - "findTheDifference('', 'y')", - "findTheDifference('a', 'aa')", - "findTheDifference('ae', 'aea')", - "findTheDifference('abc', 'cabd')", - "findTheDifference('xyz', 'xyzz')", - "findTheDifference('aaa', 'aaaa')", - "findTheDifference('bb', 'bbb')", - "findTheDifference('abcd', 'dbcae')", - "findTheDifference('hello', 'hollae')" + "--arg1='abcd' --arg2='abcde'", + "--arg1='' --arg2='y'", + "--arg1='a' --arg2='aa'", + "--arg1='ae' --arg2='aea'", + "--arg1='abc' --arg2='cabd'", + "--arg1='xyz' --arg2='xyzz'", + "--arg1='aaa' --arg2='aaaa'", + "--arg1='bb' --arg2='bbb'", + "--arg1='abcd' --arg2='dbcae'", + "--arg1='hello' --arg2='hollae'" ], "hidden_test_results": [ "'e'", @@ -1120,8 +1354,17 @@ "'e'", "'a'" ], - "boilerplate": "class Solution:\n def findTheDifference(self, s: str, t: str) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def findTheDifference(self, s: str, t: str) -> str:\n ", + "java": "class Solution {\n public char findTheDifference(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n char findTheDifference(string s, string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "Object evaluatedExpected = null;\ntry {\n evaluatedExpected = new ScriptEngineManager().getEngineByName(\"JavaScript\").eval(expected);\n} catch (Exception e) {\n return false;\n}\nreturn result.equals(evaluatedExpected);", + "cpp": "#include \n#include \n#include \n#include \n#include \n\nbool evaluateAndCompare(const std::string& result, const std::string& expected) {\n try {\n std::stringstream evaluationStream;\n evaluationStream << expected;\n double evaluatedExpected;\n evaluationStream >> evaluatedExpected;\n\n double resultValue;\n std::stringstream resultStream(result);\n resultStream >> resultValue;\n\n return resultValue == evaluatedExpected;\n } catch (const std::exception& e) {\n std::cerr << \"Error evaluating expression: \" << e.what() << std::endl;\n return false;\n }\n}" + }, + "explanation": "https://www.youtube.com/watch?v=a4wqKR-znBE&pp=ygUcTmVldENvZGUgRmluZCB0aGUgRGlmZmVyZW5jZQ%3D%3D" }, { "title": "Is Subsequence", @@ -1129,9 +1372,9 @@ "description": "

Given two strings s and t, return true if s is a subsequence of t, or false otherwise.

\n\n

A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not).

\n\n

 

\n

Example 1:

\n
Input: s = \"abc\", t = \"ahbgdc\"\nOutput: true\n

Example 2:

\n
Input: s = \"axc\", t = \"ahbgdc\"\nOutput: false\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s.length <= 100
  • \n\t
  • 0 <= t.length <= 104
  • \n\t
  • s and t consist only of lowercase English letters.
  • \n
\n\n

 

\nFollow up: Suppose there are lots of incoming s, say s1, s2, ..., sk where k >= 109, and you want to check one by one to see if t has its subsequence. In this scenario, how would you change your code?", "difficulty": "easy", "sample_test_cases": [ - "isSubsequence('abc', 'ahbgdc')", - "isSubsequence('axc', 'ahbgdc')", - "isSubsequence('', 'ahbgdc')" + "--arg1='abc' --arg2='ahbgdc'", + "--arg1='axc' --arg2='ahbgdc'", + "--arg1='' --arg2='ahbgdc'" ], "sample_test_results": [ "True", @@ -1139,16 +1382,16 @@ "True" ], "hidden_test_cases": [ - "isSubsequence('abc', 'ahbgdc')", - "isSubsequence('', '')", - "isSubsequence('abc', 'abc')", - "isSubsequence('abc', 'abcd')", - "isSubsequence('abc', 'acb')", - "isSubsequence('ab', 'baab')", - "isSubsequence('leetcode', 'yleets')", - "isSubsequence('b', 'abc')", - "isSubsequence('bb', 'ahbgb')", - "isSubsequence('aaaaaa', 'bbaaaa')" + "--arg1='abc' --arg2='ahbgdc'", + "--arg1='' --arg2=''", + "--arg1='abc' --arg2='abc'", + "--arg1='abc' --arg2='abcd'", + "--arg1='abc' --arg2='acb'", + "--arg1='ab' --arg2='baab'", + "--arg1='leetcode' --arg2='yleets'", + "--arg1='b' --arg2='abc'", + "--arg1='bb' --arg2='ahbgb'", + "--arg1='aaaaaa' --arg2='bbaaaa'" ], "hidden_test_results": [ "True", @@ -1162,8 +1405,17 @@ "True", "False" ], - "boilerplate": "class Solution:\n def isSubsequence(self, s: str, t: str) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def isSubsequence(self, s: str, t: str) -> bool:\n ", + "java": "class Solution {\n public boolean isSubsequence(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isSubsequence(string s, string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return toLowerCase(result) == toLowerCase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=99RVfqklbCE&pp=ygUXTmVldENvZGUgSXMgU3Vic2VxdWVuY2U%3D" }, { "title": "Binary Watch", @@ -1171,41 +1423,50 @@ "description": "

A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED represents a zero or one, with the least significant bit on the right.

\n\n
    \n\t
  • For example, the below binary watch reads "4:51".
  • \n
\n\n

\"\"

\n\n

Given an integer turnedOn which represents the number of LEDs that are currently on (ignoring the PM), return all possible times the watch could represent. You may return the answer in any order.

\n\n

The hour must not contain a leading zero.

\n\n
    \n\t
  • For example, "01:00" is not valid. It should be "1:00".
  • \n
\n\n

The minute must consist of two digits and may contain a leading zero.

\n\n
    \n\t
  • For example, "10:2" is not valid. It should be "10:02".
  • \n
\n\n

 

\n

Example 1:

\n
Input: turnedOn = 1\nOutput: [\"0:01\",\"0:02\",\"0:04\",\"0:08\",\"0:16\",\"0:32\",\"1:00\",\"2:00\",\"4:00\",\"8:00\"]\n

Example 2:

\n
Input: turnedOn = 9\nOutput: []\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= turnedOn <= 10
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "readBinaryWatch(1)", - "readBinaryWatch(9)", - "readBinaryWatch(2)" + "--arg1=1", + "--arg1=9", + "--arg1=2" ], "sample_test_results": [ - "['0:01', '0:02', '0:04', '0:08', '0:16', '0:32', '1:00', '2:00', '4:00', '8:00']", - "[]", - "['0:03', '0:05', '0:06', '0:09', '0:10', '0:12', '0:17', '0:18', '0:20', '0:24', '0:33', '0:34', '0:36', '0:40', '0:48', '1:01', '1:02', '1:04', '1:08', '1:16', '1:32', '2:01', '2:02', '2:04', '2:08', '2:16', '2:32', '3:00', '4:01', '4:02', '4:04', '4:08', '4:16', '4:32', '5:00', '6:00', '8:01', '8:02', '8:04', '8:08', '8:16', '8:32', '9:00', '10:00']" + "'0:01', '0:02', '0:04', '0:08', '0:16', '0:32', '1:00', '2:00', '4:00', '8:00'", + "", + "'0:03', '0:05', '0:06', '0:09', '0:10', '0:12', '0:17', '0:18', '0:20', '0:24', '0:33', '0:34', '0:36', '0:40', '0:48', '1:01', '1:02', '1:04', '1:08', '1:16', '1:32', '2:01', '2:02', '2:04', '2:08', '2:16', '2:32', '3:00', '4:01', '4:02', '4:04', '4:08', '4:16', '4:32', '5:00', '6:00', '8:01', '8:02', '8:04', '8:08', '8:16', '8:32', '9:00', '10:00'" ], "hidden_test_cases": [ - "readBinaryWatch(0)", - "readBinaryWatch(1)", - "readBinaryWatch(2)", - "readBinaryWatch(3)", - "readBinaryWatch(4)", - "readBinaryWatch(5)", - "readBinaryWatch(6)", - "readBinaryWatch(7)", - "readBinaryWatch(8)", - "readBinaryWatch(9)" + "--arg1=0", + "--arg1=1", + "--arg1=2", + "--arg1=3", + "--arg1=4", + "--arg1=5", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9" ], "hidden_test_results": [ - "['0:00']", - "['0:01', '0:02', '0:04', '0:08', '0:16', '0:32', '1:00', '2:00', '4:00', '8:00']", - "['0:03', '0:05', '0:06', '0:09', '0:10', '0:12', '0:17', '0:18', '0:20', '0:24', '0:33', '0:34', '0:36', '0:40', '0:48', '1:01', '1:02', '1:04', '1:08', '1:16', '1:32', '2:01', '2:02', '2:04', '2:08', '2:16', '2:32', '3:00', '4:01', '4:02', '4:04', '4:08', '4:16', '4:32', '5:00', '6:00', '8:01', '8:02', '8:04', '8:08', '8:16', '8:32', '9:00', '10:00']", - "['0:07', '0:11', '0:13', '0:14', '0:19', '0:21', '0:22', '0:25', '0:26', '0:28', '0:35', '0:37', '0:38', '0:41', '0:42', '0:44', '0:49', '0:50', '0:52', '0:56', '1:03', '1:05', '1:06', '1:09', '1:10', '1:12', '1:17', '1:18', '1:20', '1:24', '1:33', '1:34', '1:36', '1:40', '1:48', '2:03', '2:05', '2:06', '2:09', '2:10', '2:12', '2:17', '2:18', '2:20', '2:24', '2:33', '2:34', '2:36', '2:40', '2:48', '3:01', '3:02', '3:04', '3:08', '3:16', '3:32', '4:03', '4:05', '4:06', '4:09', '4:10', '4:12', '4:17', '4:18', '4:20', '4:24', '4:33', '4:34', '4:36', '4:40', '4:48', '5:01', '5:02', '5:04', '5:08', '5:16', '5:32', '6:01', '6:02', '6:04', '6:08', '6:16', '6:32', '7:00', '8:03', '8:05', '8:06', '8:09', '8:10', '8:12', '8:17', '8:18', '8:20', '8:24', '8:33', '8:34', '8:36', '8:40', '8:48', '9:01', '9:02', '9:04', '9:08', '9:16', '9:32', '10:01', '10:02', '10:04', '10:08', '10:16', '10:32', '11:00']", - "['0:15', '0:23', '0:27', '0:29', '0:30', '0:39', '0:43', '0:45', '0:46', '0:51', '0:53', '0:54', '0:57', '0:58', '1:07', '1:11', '1:13', '1:14', '1:19', '1:21', '1:22', '1:25', '1:26', '1:28', '1:35', '1:37', '1:38', '1:41', '1:42', '1:44', '1:49', '1:50', '1:52', '1:56', '2:07', '2:11', '2:13', '2:14', '2:19', '2:21', '2:22', '2:25', '2:26', '2:28', '2:35', '2:37', '2:38', '2:41', '2:42', '2:44', '2:49', '2:50', '2:52', '2:56', '3:03', '3:05', '3:06', '3:09', '3:10', '3:12', '3:17', '3:18', '3:20', '3:24', '3:33', '3:34', '3:36', '3:40', '3:48', '4:07', '4:11', '4:13', '4:14', '4:19', '4:21', '4:22', '4:25', '4:26', '4:28', '4:35', '4:37', '4:38', '4:41', '4:42', '4:44', '4:49', '4:50', '4:52', '4:56', '5:03', '5:05', '5:06', '5:09', '5:10', '5:12', '5:17', '5:18', '5:20', '5:24', '5:33', '5:34', '5:36', '5:40', '5:48', '6:03', '6:05', '6:06', '6:09', '6:10', '6:12', '6:17', '6:18', '6:20', '6:24', '6:33', '6:34', '6:36', '6:40', '6:48', '7:01', '7:02', '7:04', '7:08', '7:16', '7:32', '8:07', '8:11', '8:13', '8:14', '8:19', '8:21', '8:22', '8:25', '8:26', '8:28', '8:35', '8:37', '8:38', '8:41', '8:42', '8:44', '8:49', '8:50', '8:52', '8:56', '9:03', '9:05', '9:06', '9:09', '9:10', '9:12', '9:17', '9:18', '9:20', '9:24', '9:33', '9:34', '9:36', '9:40', '9:48', '10:03', '10:05', '10:06', '10:09', '10:10', '10:12', '10:17', '10:18', '10:20', '10:24', '10:33', '10:34', '10:36', '10:40', '10:48', '11:01', '11:02', '11:04', '11:08', '11:16', '11:32']", - "['0:31', '0:47', '0:55', '0:59', '1:15', '1:23', '1:27', '1:29', '1:30', '1:39', '1:43', '1:45', '1:46', '1:51', '1:53', '1:54', '1:57', '1:58', '2:15', '2:23', '2:27', '2:29', '2:30', '2:39', '2:43', '2:45', '2:46', '2:51', '2:53', '2:54', '2:57', '2:58', '3:07', '3:11', '3:13', '3:14', '3:19', '3:21', '3:22', '3:25', '3:26', '3:28', '3:35', '3:37', '3:38', '3:41', '3:42', '3:44', '3:49', '3:50', '3:52', '3:56', '4:15', '4:23', '4:27', '4:29', '4:30', '4:39', '4:43', '4:45', '4:46', '4:51', '4:53', '4:54', '4:57', '4:58', '5:07', '5:11', '5:13', '5:14', '5:19', '5:21', '5:22', '5:25', '5:26', '5:28', '5:35', '5:37', '5:38', '5:41', '5:42', '5:44', '5:49', '5:50', '5:52', '5:56', '6:07', '6:11', '6:13', '6:14', '6:19', '6:21', '6:22', '6:25', '6:26', '6:28', '6:35', '6:37', '6:38', '6:41', '6:42', '6:44', '6:49', '6:50', '6:52', '6:56', '7:03', '7:05', '7:06', '7:09', '7:10', '7:12', '7:17', '7:18', '7:20', '7:24', '7:33', '7:34', '7:36', '7:40', '7:48', '8:15', '8:23', '8:27', '8:29', '8:30', '8:39', '8:43', '8:45', '8:46', '8:51', '8:53', '8:54', '8:57', '8:58', '9:07', '9:11', '9:13', '9:14', '9:19', '9:21', '9:22', '9:25', '9:26', '9:28', '9:35', '9:37', '9:38', '9:41', '9:42', '9:44', '9:49', '9:50', '9:52', '9:56', '10:07', '10:11', '10:13', '10:14', '10:19', '10:21', '10:22', '10:25', '10:26', '10:28', '10:35', '10:37', '10:38', '10:41', '10:42', '10:44', '10:49', '10:50', '10:52', '10:56', '11:03', '11:05', '11:06', '11:09', '11:10', '11:12', '11:17', '11:18', '11:20', '11:24', '11:33', '11:34', '11:36', '11:40', '11:48']", - "['1:31', '1:47', '1:55', '1:59', '2:31', '2:47', '2:55', '2:59', '3:15', '3:23', '3:27', '3:29', '3:30', '3:39', '3:43', '3:45', '3:46', '3:51', '3:53', '3:54', '3:57', '3:58', '4:31', '4:47', '4:55', '4:59', '5:15', '5:23', '5:27', '5:29', '5:30', '5:39', '5:43', '5:45', '5:46', '5:51', '5:53', '5:54', '5:57', '5:58', '6:15', '6:23', '6:27', '6:29', '6:30', '6:39', '6:43', '6:45', '6:46', '6:51', '6:53', '6:54', '6:57', '6:58', '7:07', '7:11', '7:13', '7:14', '7:19', '7:21', '7:22', '7:25', '7:26', '7:28', '7:35', '7:37', '7:38', '7:41', '7:42', '7:44', '7:49', '7:50', '7:52', '7:56', '8:31', '8:47', '8:55', '8:59', '9:15', '9:23', '9:27', '9:29', '9:30', '9:39', '9:43', '9:45', '9:46', '9:51', '9:53', '9:54', '9:57', '9:58', '10:15', '10:23', '10:27', '10:29', '10:30', '10:39', '10:43', '10:45', '10:46', '10:51', '10:53', '10:54', '10:57', '10:58', '11:07', '11:11', '11:13', '11:14', '11:19', '11:21', '11:22', '11:25', '11:26', '11:28', '11:35', '11:37', '11:38', '11:41', '11:42', '11:44', '11:49', '11:50', '11:52', '11:56']", - "['3:31', '3:47', '3:55', '3:59', '5:31', '5:47', '5:55', '5:59', '6:31', '6:47', '6:55', '6:59', '7:15', '7:23', '7:27', '7:29', '7:30', '7:39', '7:43', '7:45', '7:46', '7:51', '7:53', '7:54', '7:57', '7:58', '9:31', '9:47', '9:55', '9:59', '10:31', '10:47', '10:55', '10:59', '11:15', '11:23', '11:27', '11:29', '11:30', '11:39', '11:43', '11:45', '11:46', '11:51', '11:53', '11:54', '11:57', '11:58']", - "['7:31', '7:47', '7:55', '7:59', '11:31', '11:47', '11:55', '11:59']", - "[]" - ], - "boilerplate": "class Solution:\n def readBinaryWatch(self, turnedOn: int) -> List[str]:\n ", - "compare_func": "def sorted_list_strings(lst):\n return sorted([str(x) for x in eval(lst)])\n return sorted(result) == sorted_list_strings(expected)" + "'0:00'", + "'0:01', '0:02', '0:04', '0:08', '0:16', '0:32', '1:00', '2:00', '4:00', '8:00'", + "'0:03', '0:05', '0:06', '0:09', '0:10', '0:12', '0:17', '0:18', '0:20', '0:24', '0:33', '0:34', '0:36', '0:40', '0:48', '1:01', '1:02', '1:04', '1:08', '1:16', '1:32', '2:01', '2:02', '2:04', '2:08', '2:16', '2:32', '3:00', '4:01', '4:02', '4:04', '4:08', '4:16', '4:32', '5:00', '6:00', '8:01', '8:02', '8:04', '8:08', '8:16', '8:32', '9:00', '10:00'", + "'0:07', '0:11', '0:13', '0:14', '0:19', '0:21', '0:22', '0:25', '0:26', '0:28', '0:35', '0:37', '0:38', '0:41', '0:42', '0:44', '0:49', '0:50', '0:52', '0:56', '1:03', '1:05', '1:06', '1:09', '1:10', '1:12', '1:17', '1:18', '1:20', '1:24', '1:33', '1:34', '1:36', '1:40', '1:48', '2:03', '2:05', '2:06', '2:09', '2:10', '2:12', '2:17', '2:18', '2:20', '2:24', '2:33', '2:34', '2:36', '2:40', '2:48', '3:01', '3:02', '3:04', '3:08', '3:16', '3:32', '4:03', '4:05', '4:06', '4:09', '4:10', '4:12', '4:17', '4:18', '4:20', '4:24', '4:33', '4:34', '4:36', '4:40', '4:48', '5:01', '5:02', '5:04', '5:08', '5:16', '5:32', '6:01', '6:02', '6:04', '6:08', '6:16', '6:32', '7:00', '8:03', '8:05', '8:06', '8:09', '8:10', '8:12', '8:17', '8:18', '8:20', '8:24', '8:33', '8:34', '8:36', '8:40', '8:48', '9:01', '9:02', '9:04', '9:08', '9:16', '9:32', '10:01', '10:02', '10:04', '10:08', '10:16', '10:32', '11:00'", + "'0:15', '0:23', '0:27', '0:29', '0:30', '0:39', '0:43', '0:45', '0:46', '0:51', '0:53', '0:54', '0:57', '0:58', '1:07', '1:11', '1:13', '1:14', '1:19', '1:21', '1:22', '1:25', '1:26', '1:28', '1:35', '1:37', '1:38', '1:41', '1:42', '1:44', '1:49', '1:50', '1:52', '1:56', '2:07', '2:11', '2:13', '2:14', '2:19', '2:21', '2:22', '2:25', '2:26', '2:28', '2:35', '2:37', '2:38', '2:41', '2:42', '2:44', '2:49', '2:50', '2:52', '2:56', '3:03', '3:05', '3:06', '3:09', '3:10', '3:12', '3:17', '3:18', '3:20', '3:24', '3:33', '3:34', '3:36', '3:40', '3:48', '4:07', '4:11', '4:13', '4:14', '4:19', '4:21', '4:22', '4:25', '4:26', '4:28', '4:35', '4:37', '4:38', '4:41', '4:42', '4:44', '4:49', '4:50', '4:52', '4:56', '5:03', '5:05', '5:06', '5:09', '5:10', '5:12', '5:17', '5:18', '5:20', '5:24', '5:33', '5:34', '5:36', '5:40', '5:48', '6:03', '6:05', '6:06', '6:09', '6:10', '6:12', '6:17', '6:18', '6:20', '6:24', '6:33', '6:34', '6:36', '6:40', '6:48', '7:01', '7:02', '7:04', '7:08', '7:16', '7:32', '8:07', '8:11', '8:13', '8:14', '8:19', '8:21', '8:22', '8:25', '8:26', '8:28', '8:35', '8:37', '8:38', '8:41', '8:42', '8:44', '8:49', '8:50', '8:52', '8:56', '9:03', '9:05', '9:06', '9:09', '9:10', '9:12', '9:17', '9:18', '9:20', '9:24', '9:33', '9:34', '9:36', '9:40', '9:48', '10:03', '10:05', '10:06', '10:09', '10:10', '10:12', '10:17', '10:18', '10:20', '10:24', '10:33', '10:34', '10:36', '10:40', '10:48', '11:01', '11:02', '11:04', '11:08', '11:16', '11:32'", + "'0:31', '0:47', '0:55', '0:59', '1:15', '1:23', '1:27', '1:29', '1:30', '1:39', '1:43', '1:45', '1:46', '1:51', '1:53', '1:54', '1:57', '1:58', '2:15', '2:23', '2:27', '2:29', '2:30', '2:39', '2:43', '2:45', '2:46', '2:51', '2:53', '2:54', '2:57', '2:58', '3:07', '3:11', '3:13', '3:14', '3:19', '3:21', '3:22', '3:25', '3:26', '3:28', '3:35', '3:37', '3:38', '3:41', '3:42', '3:44', '3:49', '3:50', '3:52', '3:56', '4:15', '4:23', '4:27', '4:29', '4:30', '4:39', '4:43', '4:45', '4:46', '4:51', '4:53', '4:54', '4:57', '4:58', '5:07', '5:11', '5:13', '5:14', '5:19', '5:21', '5:22', '5:25', '5:26', '5:28', '5:35', '5:37', '5:38', '5:41', '5:42', '5:44', '5:49', '5:50', '5:52', '5:56', '6:07', '6:11', '6:13', '6:14', '6:19', '6:21', '6:22', '6:25', '6:26', '6:28', '6:35', '6:37', '6:38', '6:41', '6:42', '6:44', '6:49', '6:50', '6:52', '6:56', '7:03', '7:05', '7:06', '7:09', '7:10', '7:12', '7:17', '7:18', '7:20', '7:24', '7:33', '7:34', '7:36', '7:40', '7:48', '8:15', '8:23', '8:27', '8:29', '8:30', '8:39', '8:43', '8:45', '8:46', '8:51', '8:53', '8:54', '8:57', '8:58', '9:07', '9:11', '9:13', '9:14', '9:19', '9:21', '9:22', '9:25', '9:26', '9:28', '9:35', '9:37', '9:38', '9:41', '9:42', '9:44', '9:49', '9:50', '9:52', '9:56', '10:07', '10:11', '10:13', '10:14', '10:19', '10:21', '10:22', '10:25', '10:26', '10:28', '10:35', '10:37', '10:38', '10:41', '10:42', '10:44', '10:49', '10:50', '10:52', '10:56', '11:03', '11:05', '11:06', '11:09', '11:10', '11:12', '11:17', '11:18', '11:20', '11:24', '11:33', '11:34', '11:36', '11:40', '11:48'", + "'1:31', '1:47', '1:55', '1:59', '2:31', '2:47', '2:55', '2:59', '3:15', '3:23', '3:27', '3:29', '3:30', '3:39', '3:43', '3:45', '3:46', '3:51', '3:53', '3:54', '3:57', '3:58', '4:31', '4:47', '4:55', '4:59', '5:15', '5:23', '5:27', '5:29', '5:30', '5:39', '5:43', '5:45', '5:46', '5:51', '5:53', '5:54', '5:57', '5:58', '6:15', '6:23', '6:27', '6:29', '6:30', '6:39', '6:43', '6:45', '6:46', '6:51', '6:53', '6:54', '6:57', '6:58', '7:07', '7:11', '7:13', '7:14', '7:19', '7:21', '7:22', '7:25', '7:26', '7:28', '7:35', '7:37', '7:38', '7:41', '7:42', '7:44', '7:49', '7:50', '7:52', '7:56', '8:31', '8:47', '8:55', '8:59', '9:15', '9:23', '9:27', '9:29', '9:30', '9:39', '9:43', '9:45', '9:46', '9:51', '9:53', '9:54', '9:57', '9:58', '10:15', '10:23', '10:27', '10:29', '10:30', '10:39', '10:43', '10:45', '10:46', '10:51', '10:53', '10:54', '10:57', '10:58', '11:07', '11:11', '11:13', '11:14', '11:19', '11:21', '11:22', '11:25', '11:26', '11:28', '11:35', '11:37', '11:38', '11:41', '11:42', '11:44', '11:49', '11:50', '11:52', '11:56'", + "'3:31', '3:47', '3:55', '3:59', '5:31', '5:47', '5:55', '5:59', '6:31', '6:47', '6:55', '6:59', '7:15', '7:23', '7:27', '7:29', '7:30', '7:39', '7:43', '7:45', '7:46', '7:51', '7:53', '7:54', '7:57', '7:58', '9:31', '9:47', '9:55', '9:59', '10:31', '10:47', '10:55', '10:59', '11:15', '11:23', '11:27', '11:29', '11:30', '11:39', '11:43', '11:45', '11:46', '11:51', '11:53', '11:54', '11:57', '11:58'", + "'7:31', '7:47', '7:55', '7:59', '11:31', '11:47', '11:55', '11:59'", + "" + ], + "boilerplate": { + "python": "class Solution:\n def readBinaryWatch(self, turnedOn: int) -> List[str]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List readBinaryWatch(int turnedOn) {\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector readBinaryWatch(int turnedOn) {\n \n }\n};" + }, + "compare_func": { + "python": "def sorted_list_strings(lst):\n return sorted([str(x) for x in eval(lst)])\n return sorted(result) == sorted_list_strings(expected)", + "java": "boolean compareFunction(String result, String expected) {\n String[] expectedList = evalStrings(expected);\n String[] resultList = evalStrings(result);\n \n Arrays.sort(expectedList);\n Arrays.sort(resultList);\n \n return Arrays.equals(resultList, expectedList);\n}\n\nString[] evalStrings(String input) {\n String parsed = input.replaceAll(\"[\\[\\]\\\"]\", \"\");\n return parsed.split(\", ?\");\n}", + "cpp": "std::vector sortedListStrings(const std::string &lst) {\n // Assuming the input is a properly formatted string representation of a list\n std::stringstream ss(lst);\n std::string token;\n std::vector result; \n \n while(std::getline(ss, token, ',')) {\n // Remove potential leading/trailing spaces and quotes\n token.erase(std::remove_if(token.begin(), token.end(), ::isspace), token.end());\n token.erase(std::remove(token.begin(), token.end(), '\"'), token.end());\n token.erase(std::remove(token.begin(), token.end(), '\\\n'), token.end());\n result.push_back(token);\n }\n \n std::sort(result.begin(), result.end());\n return result;\n}\n\nstd::vector sortedList(const std::vector &lst) {\n std::vector result = lst;\n std::sort(result.begin(), result.end());\n return result;\n}\n\nbool compareFunction(const std::vector &result, const std::string &expected) {\n return sortedList(result) == sortedListStrings(expected);\n}" + }, + "explanation": "https://www.youtube.com/watch?v=0BanwDe6cMY&pp=ygUVTmVldENvZGUgQmluYXJ5IFdhdGNo" }, { "title": "Convert a Number to Hexadecimal", @@ -1213,9 +1474,9 @@ "description": "

Given a 32-bit integer num, return a string representing its hexadecimal representation. For negative integers, two’s complement method is used.

\n\n

All the letters in the answer string should be lowercase characters, and there should not be any leading zeros in the answer except for the zero itself.

\n\n

Note: You are not allowed to use any built-in library method to directly solve this problem.

\n\n

 

\n

Example 1:

\n
Input: num = 26\nOutput: \"1a\"\n

Example 2:

\n
Input: num = -1\nOutput: \"ffffffff\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= num <= 231 - 1
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "toHex(26)", - "toHex(-1)", - "toHex(0)" + "--arg1=26", + "--arg1=-1", + "--arg1=0" ], "sample_test_results": [ "'1a'", @@ -1223,16 +1484,16 @@ "'0'" ], "hidden_test_cases": [ - "toHex(0)", - "toHex(16)", - "toHex(26)", - "toHex(-1)", - "toHex(2147483647)", - "toHex(-2147483648)", - "toHex(100)", - "toHex(-100)", - "toHex(255)", - "toHex(-255)" + "--arg1=0", + "--arg1=16", + "--arg1=26", + "--arg1=-1", + "--arg1=2147483647", + "--arg1=-2147483648", + "--arg1=100", + "--arg1=-100", + "--arg1=255", + "--arg1=-255" ], "hidden_test_results": [ "'0'", @@ -1246,8 +1507,17 @@ "'ff'", "'ffffff01'" ], - "boilerplate": "class Solution:\n def toHex(self, num: int) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def toHex(self, num: int) -> str:\n ", + "java": "class Solution {\n public String toHex(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string toHex(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "try {\n return result == std::stod(expected);\n} catch (const std::invalid_argument& e) {\n return false;\n}\ncatch (const std::out_of_range& e) {\n return false;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=I1HBykyZvbc&pp=ygUoTmVldENvZGUgQ29udmVydCBhIE51bWJlciB0byBIZXhhZGVjaW1hbA%3D%3D" }, { "title": "Longest Palindrome", @@ -1255,9 +1525,9 @@ "description": "

Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.

\n\n

Letters are case sensitive, for example, "Aa" is not considered a palindrome.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abccccdd"\nOutput: 7\nExplanation: One longest palindrome that can be built is "dccaccd", whose length is 7.\n
\n\n

Example 2:

\n\n
\nInput: s = "a"\nOutput: 1\nExplanation: The longest palindrome that can be built is "a", whose length is 1.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 2000
  • \n\t
  • s consists of lowercase and/or uppercase English letters only.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "longestPalindrome('abccccdd')", - "longestPalindrome('a')", - "longestPalindrome('Aa')" + "--arg1='abccccdd'", + "--arg1='a'", + "--arg1='Aa'" ], "sample_test_results": [ "7", @@ -1265,16 +1535,16 @@ "1" ], "hidden_test_cases": [ - "longestPalindrome('racecar')", - "longestPalindrome('aaaaaa')", - "longestPalindrome('abcde')", - "longestPalindrome('AAaa')", - "longestPalindrome('aA')", - "longestPalindrome('z')", - "longestPalindrome('abccba')", - "longestPalindrome('aaabbbcccc')", - "longestPalindrome('abcABC')", - "longestPalindrome('')" + "--arg1='racecar'", + "--arg1='aaaaaa'", + "--arg1='abcde'", + "--arg1='AAaa'", + "--arg1='aA'", + "--arg1='z'", + "--arg1='abccba'", + "--arg1='aaabbbcccc'", + "--arg1='abcABC'", + "--arg1=''" ], "hidden_test_results": [ "7", @@ -1288,8 +1558,17 @@ "1", "0" ], - "boilerplate": "class Solution:\n def longestPalindrome(self, s: str) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def longestPalindrome(self, s: str) -> int:\n ", + "java": "class Solution {\n public int longestPalindrome(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int longestPalindrome(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=_g9jrLuAphs&pp=ygUbTmVldENvZGUgTG9uZ2VzdCBQYWxpbmRyb21l" }, { "title": "Add Strings", @@ -1297,9 +1576,9 @@ "description": "

Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string.

\n\n

You must solve the problem without using any built-in library for handling large integers (such as BigInteger). You must also not convert the inputs to integers directly.

\n\n

 

\n

Example 1:

\n\n
\nInput: num1 = "11", num2 = "123"\nOutput: "134"\n
\n\n

Example 2:

\n\n
\nInput: num1 = "456", num2 = "77"\nOutput: "533"\n
\n\n

Example 3:

\n\n
\nInput: num1 = "0", num2 = "0"\nOutput: "0"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num1.length, num2.length <= 104
  • \n\t
  • num1 and num2 consist of only digits.
  • \n\t
  • num1 and num2 don't have any leading zeros except for the zero itself.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "addStrings('11', '123')", - "addStrings('456', '77')", - "addStrings('0', '0')" + "--arg1='11' --arg2='123'", + "--arg1='456' --arg2='77'", + "--arg1='0' --arg2='0'" ], "sample_test_results": [ "'134'", @@ -1307,16 +1586,16 @@ "'0'" ], "hidden_test_cases": [ - "addStrings('9', '1')", - "addStrings('999', '1')", - "addStrings('1', '999')", - "addStrings('0', '1')", - "addStrings('1', '0')", - "addStrings('999999', '1')", - "addStrings('123', '456')", - "addStrings('1000', '2000')", - "addStrings('9999', '9999')", - "addStrings('1111', '9999')" + "--arg1='9' --arg2='1'", + "--arg1='999' --arg2='1'", + "--arg1='1' --arg2='999'", + "--arg1='0' --arg2='1'", + "--arg1='1' --arg2='0'", + "--arg1='999999' --arg2='1'", + "--arg1='123' --arg2='456'", + "--arg1='1000' --arg2='2000'", + "--arg1='9999' --arg2='9999'", + "--arg1='1111' --arg2='9999'" ], "hidden_test_results": [ "'10'", @@ -1330,8 +1609,17 @@ "'19998'", "'11110'" ], - "boilerplate": "class Solution:\n def addStrings(self, num1: str, num2: str) -> str:\n ", - "compare_func": "return str(result) == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def addStrings(self, num1: str, num2: str) -> str:\n ", + "java": "class Solution {\n public String addStrings(String num1, String num2) {\n // Implementation will go here\n return null;\n }\n}", + "cpp": "class Solution {\npublic:\n string addStrings(string num1, string num2) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == eval(expected)", + "java": "return result.toString().equals(String.valueOf(eval(expected)));", + "cpp": "#include \n\ncompareFunction(const std::string &result, const std::string &expected) {\n return result == expected;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=jziDtPZJ4fw&pp=ygUUTmVldENvZGUgQWRkIFN0cmluZ3M%3D" }, { "title": "Arranging Coins", @@ -1339,9 +1627,9 @@ "description": "

You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete.

\n\n

Given the integer n, return the number of complete rows of the staircase you will build.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: n = 5\nOutput: 2\nExplanation: Because the 3rd row is incomplete, we return 2.\n
\n\n

Example 2:

\n\"\"\n
\nInput: n = 8\nOutput: 3\nExplanation: Because the 4th row is incomplete, we return 3.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "arrangeCoins(5)", - "arrangeCoins(8)", - "arrangeCoins(1)" + "--arg1=5", + "--arg1=8", + "--arg1=1" ], "sample_test_results": [ "2", @@ -1349,16 +1637,16 @@ "1" ], "hidden_test_cases": [ - "arrangeCoins(0)", - "arrangeCoins(3)", - "arrangeCoins(10)", - "arrangeCoins(15)", - "arrangeCoins(21)", - "arrangeCoins(100)", - "arrangeCoins(1000)", - "arrangeCoins(10000)", - "arrangeCoins(2147483647)", - "arrangeCoins(6)" + "--arg1=0", + "--arg1=3", + "--arg1=10", + "--arg1=15", + "--arg1=21", + "--arg1=100", + "--arg1=1000", + "--arg1=10000", + "--arg1=2147483647", + "--arg1=6" ], "hidden_test_results": [ "0", @@ -1372,8 +1660,17 @@ "65535", "3" ], - "boilerplate": "class Solution:\n def arrangeCoins(self, n: int) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def arrangeCoins(self, n: int) -> int:\n ", + "java": "class Solution {\n public int arrangeCoins(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int arrangeCoins(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.valueOf(result).equals(Integer.valueOf(expected));", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=5rHz_6s2Buw&pp=ygUYTmVldENvZGUgQXJyYW5naW5nIENvaW5z" }, { "title": "Assign Cookies", @@ -1381,9 +1678,9 @@ "description": "

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.

\n\n

Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and each cookie j has a size s[j]. If s[j] >= g[i], we can assign the cookie j to the child i, and the child i will be content. Your goal is to maximize the number of your content children and output the maximum number.

\n\n

 

\n

Example 1:

\n\n
\nInput: g = [1,2,3], s = [1,1]\nOutput: 1\nExplanation: You have 3 children and 2 cookies. The greed factors of 3 children are 1, 2, 3. \nAnd even though you have 2 cookies, since their size is both 1, you could only make the child whose greed factor is 1 content.\nYou need to output 1.\n
\n\n

Example 2:

\n\n
\nInput: g = [1,2], s = [1,2,3]\nOutput: 2\nExplanation: You have 2 children and 3 cookies. The greed factors of 2 children are 1, 2. \nYou have 3 cookies and their sizes are big enough to gratify all of the children, \nYou need to output 2.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= g.length <= 3 * 104
  • \n\t
  • 0 <= s.length <= 3 * 104
  • \n\t
  • 1 <= g[i], s[j] <= 231 - 1
  • \n
\n\n

 

\n

Note: This question is the same as 2410: Maximum Matching of Players With Trainers.

\n", "difficulty": "easy", "sample_test_cases": [ - "findContentChildren([1,2,3], [1,1])", - "findContentChildren([1,2], [1,2,3])", - "findContentChildren([1,2,3], [])" + "--arg1=1,2,3 --arg2=[1 --arg3=1]", + "--arg1=1,2 --arg2=[1 --arg3=2 --arg4=3]", + "--arg1=1,2,3 --arg2=" ], "sample_test_results": [ "1", @@ -1391,16 +1688,16 @@ "0" ], "hidden_test_cases": [ - "findContentChildren([], [1,2,3])", - "findContentChildren([1,2], [1])", - "findContentChildren([2], [1])", - "findContentChildren([1,2,3], [1,2,3])", - "findContentChildren([10,9,8,7], [5,6,7,8])", - "findContentChildren([1,1,1], [1,1,1])", - "findContentChildren([2,3,4,5], [1,2,3])", - "findContentChildren([1], [2])", - "findContentChildren([3,4,5], [1,2])", - "findContentChildren([1,2,3], [3])" + "--arg1= --arg2=[1 --arg3=2 --arg4=3]", + "--arg1=1,2 --arg2=1", + "--arg1=2 --arg2=1", + "--arg1=1,2,3 --arg2=[1 --arg3=2 --arg4=3]", + "--arg1=10,9,8,7 --arg2=[5 --arg3=6 --arg4=7 --arg5=8]", + "--arg1=1,1,1 --arg2=[1 --arg3=1 --arg4=1]", + "--arg1=2,3,4,5 --arg2=[1 --arg3=2 --arg4=3]", + "--arg1=1 --arg2=2", + "--arg1=3,4,5 --arg2=[1 --arg3=2]", + "--arg1=1,2,3 --arg2=3" ], "hidden_test_results": [ "0", @@ -1414,8 +1711,17 @@ "0", "1" ], - "boilerplate": "class Solution:\n def findContentChildren(self, g: List[int], s: List[int]) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def findContentChildren(self, g: List[int], s: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int findContentChildren(List g, List s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findContentChildren(vector& g, vector& s) {\n\n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=JW8fgvoxPTg&pp=ygUXTmVldENvZGUgQXNzaWduIENvb2tpZXM%3D" }, { "title": "Repeated Substring Pattern", @@ -1423,9 +1729,9 @@ "description": "

Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abab"\nOutput: true\nExplanation: It is the substring "ab" twice.\n
\n\n

Example 2:

\n\n
\nInput: s = "aba"\nOutput: false\n
\n\n

Example 3:

\n\n
\nInput: s = "abcabcabcabc"\nOutput: true\nExplanation: It is the substring "abc" four times or the substring "abcabc" twice.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of lowercase English letters.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "repeatedSubstringPattern('abab')", - "repeatedSubstringPattern('aba')", - "repeatedSubstringPattern('abcabcabcabc')" + "--arg1='abab'", + "--arg1='aba'", + "--arg1='abcabcabcabc'" ], "sample_test_results": [ "True", @@ -1433,16 +1739,16 @@ "True" ], "hidden_test_cases": [ - "repeatedSubstringPattern('')", - "repeatedSubstringPattern('a')", - "repeatedSubstringPattern('aa')", - "repeatedSubstringPattern('aaa')", - "repeatedSubstringPattern('aabaaba')", - "repeatedSubstringPattern('abaababaab')", - "repeatedSubstringPattern('aaaaa')", - "repeatedSubstringPattern('abcabc')", - "repeatedSubstringPattern('abcabcabc')", - "repeatedSubstringPattern('abac')" + "--arg1=''", + "--arg1='a'", + "--arg1='aa'", + "--arg1='aaa'", + "--arg1='aabaaba'", + "--arg1='abaababaab'", + "--arg1='aaaaa'", + "--arg1='abcabc'", + "--arg1='abcabcabc'", + "--arg1='abac'" ], "hidden_test_results": [ "True", @@ -1456,8 +1762,17 @@ "True", "False" ], - "boilerplate": "class Solution:\n def repeatedSubstringPattern(self, s: str) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def repeatedSubstringPattern(self, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean repeatedSubstringPattern(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool repeatedSubstringPattern(std::string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.equalsIgnoreCase(expected);", + "cpp": "return result.size() == expected.size() && std::equal(result.begin(), result.end(), expected.begin(), [](char a, char b) { return std::tolower(a) == std::tolower(b); });" + }, + "explanation": "https://www.youtube.com/watch?v=2qEmA76Unm4&pp=ygUjTmVldENvZGUgUmVwZWF0ZWQgU3Vic3RyaW5nIFBhdHRlcm4%3D" }, { "title": "License Key Formatting", @@ -1465,24 +1780,24 @@ "description": "

You are given a license key represented as a string s that consists of only alphanumeric characters and dashes. The string is separated into n + 1 groups by n dashes. You are also given an integer k.

\n\n

We want to reformat the string s such that each group contains exactly k characters, except for the first group, which could be shorter than k but still must contain at least one character. Furthermore, there must be a dash inserted between two groups, and you should convert all lowercase letters to uppercase.

\n\n

Return the reformatted license key.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "5F3Z-2e-9-w", k = 4\nOutput: "5F3Z-2E9W"\nExplanation: The string s has been split into two parts, each part has 4 characters.\nNote that the two extra dashes are not needed and can be removed.\n
\n\n

Example 2:

\n\n
\nInput: s = "2-5g-3-J", k = 2\nOutput: "2-5G-3J"\nExplanation: The string s has been split into three parts, each part has 2 characters except the first part as it could be shorter as mentioned above.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 105
  • \n\t
  • s consists of English letters, digits, and dashes '-'.
  • \n\t
  • 1 <= k <= 104
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "licenseKeyFormatting('5F3Z-2e-9-w', 4)", - "licenseKeyFormatting('2-5g-3-J', 2)" + "--arg1='5F3Z-2e-9-w' --arg2=4", + "--arg1='2-5g-3-J' --arg2=2" ], "sample_test_results": [ "'5F3Z-2E9W'", "'2-5G-3J'" ], "hidden_test_cases": [ - "licenseKeyFormatting('a-a-a-a-', 1)", - "licenseKeyFormatting('---', 3)", - "licenseKeyFormatting('2', 2)", - "licenseKeyFormatting('r', 1)", - "licenseKeyFormatting('5F3Z-2e-9-w-a-b-c-d', 4)", - "licenseKeyFormatting('2-5g-3-J-k-L', 3)", - "licenseKeyFormatting('a-b-c', 3)", - "licenseKeyFormatting('12345', 1)", - "licenseKeyFormatting('ABCD', 2)", - "licenseKeyFormatting('a-1-B-2', 2)" + "--arg1='a-a-a-a-' --arg2=1", + "--arg1='---' --arg2=3", + "--arg1='2' --arg2=2", + "--arg1='r' --arg2=1", + "--arg1='5F3Z-2e-9-w-a-b-c-d' --arg2=4", + "--arg1='2-5g-3-J-k-L' --arg2=3", + "--arg1='a-b-c' --arg2=3", + "--arg1='12345' --arg2=1", + "--arg1='ABCD' --arg2=2", + "--arg1='a-1-B-2' --arg2=2" ], "hidden_test_results": [ "'A-A-A-A'", @@ -1496,8 +1811,17 @@ "'AB-CD'", "'A1-B2'" ], - "boilerplate": "class Solution:\n def licenseKeyFormatting(self, s: str, k: int) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def licenseKeyFormatting(self, s: str, k: int) -> str:\n ", + "java": "class Solution {\n public String licenseKeyFormatting(String s, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string licenseKeyFormatting(string s, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=3KMlpe8eZ0E&pp=ygUfTmVldENvZGUgTGljZW5zZSBLZXkgRm9ybWF0dGluZw%3D%3D" }, { "title": "Construct the Rectangle", @@ -1505,41 +1829,50 @@ "description": "

A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:

\n\n
    \n\t
  1. The area of the rectangular web page you designed must equal to the given target area.
  2. \n\t
  3. The width W should not be larger than the length L, which means L >= W.
  4. \n\t
  5. The difference between length L and width W should be as small as possible.
  6. \n
\n\n

Return an array [L, W] where L and W are the length and width of the web page you designed in sequence.

\n\n

 

\n

Example 1:

\n\n
\nInput: area = 4\nOutput: [2,2]\nExplanation: The target area is 4, and all the possible ways to construct it are [1,4], [2,2], [4,1]. \nBut according to requirement 2, [1,4] is illegal; according to requirement 3,  [4,1] is not optimal compared to [2,2]. So the length L is 2, and the width W is 2.\n
\n\n

Example 2:

\n\n
\nInput: area = 37\nOutput: [37,1]\n
\n\n

Example 3:

\n\n
\nInput: area = 122122\nOutput: [427,286]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= area <= 107
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "constructRectangle(4)", - "constructRectangle(37)", - "constructRectangle(122122)" + "--arg1=4", + "--arg1=37", + "--arg1=122122" ], "sample_test_results": [ - "[2, 2]", - "[37, 1]", - "[427, 286]" + "2, 2", + "37, 1", + "427, 286" ], "hidden_test_cases": [ - "constructRectangle(1)", - "constructRectangle(9)", - "constructRectangle(16)", - "constructRectangle(24)", - "constructRectangle(100)", - "constructRectangle(1000)", - "constructRectangle(10000)", - "constructRectangle(99999)", - "constructRectangle(1000000)", - "constructRectangle(9999999)" + "--arg1=1", + "--arg1=9", + "--arg1=16", + "--arg1=24", + "--arg1=100", + "--arg1=1000", + "--arg1=10000", + "--arg1=99999", + "--arg1=1000000", + "--arg1=9999999" ], "hidden_test_results": [ - "[1, 1]", - "[3, 3]", - "[4, 4]", - "[6, 4]", - "[10, 10]", - "[40, 25]", - "[100, 100]", - "[369, 271]", - "[1000, 1000]", - "[4649, 2151]" - ], - "boilerplate": "class Solution:\n def constructRectangle(self, area: int) -> List[int]:\n ", - "compare_func": "expected = eval(expected); return result[0]*result[1] == expected[0]*expected[1] and result[0] >= result[1] and abs(result[0]-result[1]) <= abs(expected[0]-expected[1])" + "1, 1", + "3, 3", + "4, 4", + "6, 4", + "10, 10", + "40, 25", + "100, 100", + "369, 271", + "1000, 1000", + "4649, 2151" + ], + "boilerplate": { + "python": "class Solution:\n def constructRectangle(self, area: int) -> List[int]:\n ", + "java": "import java.util.*;\n\nclass Solution {\n public List constructRectangle(int area) {\n List result = new ArrayList<>();\n // Placeholder for the implementation\n return result;\n }\n}", + "cpp": "class Solution {\npublic:\n std::vector constructRectangle(int area) {\n \n }\n};" + }, + "compare_func": { + "python": "expected = eval(expected); return result[0]*result[1] == expected[0]*expected[1] and result[0] >= result[1] and abs(result[0]-result[1]) <= abs(expected[0]-expected[1])", + "java": "return (result[0] * result[1] == expected[0] * expected[1]) && (result[0] >= result[1]) && (Math.abs(result[0] - result[1]) <= Math.abs(expected[0] - expected[1]));", + "cpp": "int expectedValue = std::stoi(expected);\nreturn (result[0] * result[1] == expected[0] * expected[1]) && (result[0] >= result[1]) && (std::abs(result[0] - result[1]) <= std::abs(expected[0] - expected[1]));" + }, + "explanation": "https://www.youtube.com/watch?v=-Lb4SvVyPCM&pp=ygUgTmVldENvZGUgQ29uc3RydWN0IHRoZSBSZWN0YW5nbGU%3D" }, { "title": "Teemo Attacking", @@ -1547,24 +1880,24 @@ "description": "

Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly duration seconds. More formally, an attack at second t will mean Ashe is poisoned during the inclusive time interval [t, t + duration - 1]. If Teemo attacks again before the poison effect ends, the timer for it is reset, and the poison effect will end duration seconds after the new attack.

\n\n

You are given a non-decreasing integer array timeSeries, where timeSeries[i] denotes that Teemo attacks Ashe at second timeSeries[i], and an integer duration.

\n\n

Return the total number of seconds that Ashe is poisoned.

\n\n

 

\n

Example 1:

\n\n
\nInput: timeSeries = [1,4], duration = 2\nOutput: 4\nExplanation: Teemo's attacks on Ashe go as follows:\n- At second 1, Teemo attacks, and Ashe is poisoned for seconds 1 and 2.\n- At second 4, Teemo attacks, and Ashe is poisoned for seconds 4 and 5.\nAshe is poisoned for seconds 1, 2, 4, and 5, which is 4 seconds in total.\n
\n\n

Example 2:

\n\n
\nInput: timeSeries = [1,2], duration = 2\nOutput: 3\nExplanation: Teemo's attacks on Ashe go as follows:\n- At second 1, Teemo attacks, and Ashe is poisoned for seconds 1 and 2.\n- At second 2 however, Teemo attacks again and resets the poison timer. Ashe is poisoned for seconds 2 and 3.\nAshe is poisoned for seconds 1, 2, and 3, which is 3 seconds in total.
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= timeSeries.length <= 104
  • \n\t
  • 0 <= timeSeries[i], duration <= 107
  • \n\t
  • timeSeries is sorted in non-decreasing order.
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "findPoisonedDuration([1,4], 2)", - "findPoisonedDuration([1,2], 2)" + "--arg1=1,4 --arg2=2", + "--arg1=1,2 --arg2=2" ], "sample_test_results": [ "4", "3" ], "hidden_test_cases": [ - "findPoisonedDuration([1], 1)", - "findPoisonedDuration([1,2,3,4,5], 1)", - "findPoisonedDuration([1,3,5,7,9], 3)", - "findPoisonedDuration([1,2,3,4,5], 5)", - "findPoisonedDuration([1,10,20,30], 5)", - "findPoisonedDuration([1,2,3,100], 2)", - "findPoisonedDuration([1,1,1,1], 2)", - "findPoisonedDuration([0,1,2], 1)", - "findPoisonedDuration([1,5,10], 2)", - "findPoisonedDuration([1,3], 3)" + "--arg1=1 --arg2=1", + "--arg1=1,2,3,4,5 --arg2=1", + "--arg1=1,3,5,7,9 --arg2=3", + "--arg1=1,2,3,4,5 --arg2=5", + "--arg1=1,10,20,30 --arg2=5", + "--arg1=1,2,3,100 --arg2=2", + "--arg1=1,1,1,1 --arg2=2", + "--arg1=0,1,2 --arg2=1", + "--arg1=1,5,10 --arg2=2", + "--arg1=1,3 --arg2=3" ], "hidden_test_results": [ "1", @@ -1578,8 +1911,17 @@ "6", "5" ], - "boilerplate": "class Solution:\n def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:\n ", + "java": "class Solution {\n public int findPoisonedDuration(List timeSeries, int duration) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findPoisonedDuration(vector& timeSeries, int duration) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=NejSCTIdd5k&pp=ygUYTmVldENvZGUgVGVlbW8gQXR0YWNraW5n" }, { "title": "Base 7", @@ -1587,24 +1929,24 @@ "description": "

Given an integer num, return a string of its base 7 representation.

\n\n

 

\n

Example 1:

\n
Input: num = 100\nOutput: \"202\"\n

Example 2:

\n
Input: num = -7\nOutput: \"-10\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -107 <= num <= 107
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "convertToBase7(100)", - "convertToBase7(-7)" + "--arg1=100", + "--arg1=-7" ], "sample_test_results": [ "'202'", "'-10'" ], "hidden_test_cases": [ - "convertToBase7(0)", - "convertToBase7(7)", - "convertToBase7(-49)", - "convertToBase7(1000000)", - "convertToBase7(-1000000)", - "convertToBase7(1)", - "convertToBase7(-1)", - "convertToBase7(49)", - "convertToBase7(999999)", - "convertToBase7(-999999)" + "--arg1=0", + "--arg1=7", + "--arg1=-49", + "--arg1=1000000", + "--arg1=-1000000", + "--arg1=1", + "--arg1=-1", + "--arg1=49", + "--arg1=999999", + "--arg1=-999999" ], "hidden_test_results": [ "'0'", @@ -1618,8 +1960,17 @@ "'11333310'", "'-11333310'" ], - "boilerplate": "class Solution:\n def convertToBase7(self, num: int) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def convertToBase7(self, num: int) -> str:\n ", + "java": "class Solution {\n public String convertToBase7(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::string convertToBase7(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "return result == std::stod(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=sbmq-efwOsA&pp=ygUPTmVldENvZGUgQmFzZSA3" }, { "title": "Perfect Number", @@ -1627,24 +1978,24 @@ "description": "

A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. A divisor of an integer x is an integer that can divide x evenly.

\n\n

Given an integer n, return true if n is a perfect number, otherwise return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = 28\nOutput: true\nExplanation: 28 = 1 + 2 + 4 + 7 + 14\n1, 2, 4, 7, and 14 are all divisors of 28.\n
\n\n

Example 2:

\n\n
\nInput: num = 7\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num <= 108
  • \n
\n", "difficulty": "easy", "sample_test_cases": [ - "checkPerfectNumber(28)", - "checkPerfectNumber(7)" + "--arg1=28", + "--arg1=7" ], "sample_test_results": [ "True", "False" ], "hidden_test_cases": [ - "checkPerfectNumber(1)", - "checkPerfectNumber(6)", - "checkPerfectNumber(496)", - "checkPerfectNumber(8128)", - "checkPerfectNumber(33550336)", - "checkPerfectNumber(12)", - "checkPerfectNumber(100)", - "checkPerfectNumber(1000)", - "checkPerfectNumber(10000)", - "checkPerfectNumber(100000)" + "--arg1=1", + "--arg1=6", + "--arg1=496", + "--arg1=8128", + "--arg1=33550336", + "--arg1=12", + "--arg1=100", + "--arg1=1000", + "--arg1=10000", + "--arg1=100000" ], "hidden_test_results": [ "False", @@ -1658,8 +2009,17 @@ "False", "False" ], - "boilerplate": "class Solution:\n def checkPerfectNumber(self, num: int) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def checkPerfectNumber(self, num: int) -> bool:\n ", + "java": "class Solution {\n public boolean checkPerfectNumber(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool checkPerfectNumber(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=HLZLwjzIVGo&pp=ygUXTmVldENvZGUgUGVyZmVjdCBOdW1iZXI%3D" }, { "title": "Zigzag Conversion", @@ -1667,9 +2027,9 @@ "description": "

The string "PAYPALISHIRING" 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)

\n\n
\nP   A   H   N\nA P L S I I G\nY   I   R\n
\n\n

And then read line by line: "PAHNAPLSIIGYIR"

\n\n

Write the code that will take a string and make this conversion given a number of rows:

\n\n
\nstring convert(string s, int numRows);\n
\n\n

 

\n

Example 1:

\n\n
\nInput: s = "PAYPALISHIRING", numRows = 3\nOutput: "PAHNAPLSIIGYIR"\n
\n\n

Example 2:

\n\n
\nInput: s = "PAYPALISHIRING", numRows = 4\nOutput: "PINALSIGYAHRPI"\nExplanation:\nP     I    N\nA   L S  I G\nY A   H R\nP     I\n
\n\n

Example 3:

\n\n
\nInput: s = "A", numRows = 1\nOutput: "A"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 1000
  • \n\t
  • s consists of English letters (lower-case and upper-case), ',' and '.'.
  • \n\t
  • 1 <= numRows <= 1000
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "convert('PAYPALISHIRING', 3)", - "convert('PAYPALISHIRING', 4)", - "convert('A', 1)" + "--arg1='PAYPALISHIRING' --arg2=3", + "--arg1='PAYPALISHIRING' --arg2=4", + "--arg1='A' --arg2=1" ], "sample_test_results": [ "'PAHNAPLSIIGYIR'", @@ -1677,16 +2037,16 @@ "'A'" ], "hidden_test_cases": [ - "convert('ABCDEF', 2)", - "convert('HELLO', 1)", - "convert('WORLD', 5)", - "convert('TEST.TEST', 3)", - "convert('A,B,C', 2)", - "convert('abcdefghijklmnop', 4)", - "convert('ANTHROPIC', 3)", - "convert('Testing123', 2)", - "convert('', 1)", - "convert('AB', 1)" + "--arg1='ABCDEF' --arg2=2", + "--arg1='HELLO' --arg2=1", + "--arg1='WORLD' --arg2=5", + "--arg1='TEST.TEST' --arg2=3", + "--arg1='A --arg2=B --arg3=C' --arg4=2", + "--arg1='abcdefghijklmnop' --arg2=4", + "--arg1='ANTHROPIC' --arg2=3", + "--arg1='Testing123' --arg2=2", + "--arg1='' --arg2=1", + "--arg1='AB' --arg2=1" ], "hidden_test_results": [ "'ACEBDF'", @@ -1700,8 +2060,17 @@ "''", "'AB'" ], - "boilerplate": "class Solution:\n def convert(self, s: str, numRows: int) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def convert(self, s: str, numRows: int) -> str:\n ", + "java": "class Solution {\n public String convert(String s, int numRows) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::string convert(std::string s, int numRows) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stol(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Q2Tw6gcVEwc&pp=ygUaTmVldENvZGUgWmlnemFnIENvbnZlcnNpb24%3D" }, { "title": "Container With Most Water", @@ -1709,24 +2078,24 @@ "description": "

You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).

\n\n

Find two lines that together with the x-axis form a container, such that the container contains the most water.

\n\n

Return the maximum amount of water a container can store.

\n\n

Notice that you may not slant the container.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: height = [1,8,6,2,5,4,8,3,7]\nOutput: 49\nExplanation: The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49.\n
\n\n

Example 2:

\n\n
\nInput: height = [1,1]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == height.length
  • \n\t
  • 2 <= n <= 105
  • \n\t
  • 0 <= height[i] <= 104
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "maxArea([1,8,6,2,5,4,8,3,7])", - "maxArea([1,1])" + "--arg1=1,8,6,2,5,4,8,3,7", + "--arg1=1,1" ], "sample_test_results": [ "49", "1" ], "hidden_test_cases": [ - "maxArea([4,3,2,1,4])", - "maxArea([1,2,4,3])", - "maxArea([1,2])", - "maxArea([1,1,1])", - "maxArea([2,3,4,5,18,17,6])", - "maxArea([1,8,100,2,100,4,8,3,7])", - "maxArea([1,2,3,4,5,6])", - "maxArea([6,5,4,3,2,1])", - "maxArea([0,0])", - "maxArea([10000,1])" + "--arg1=4,3,2,1,4", + "--arg1=1,2,4,3", + "--arg1=1,2", + "--arg1=1,1,1", + "--arg1=2,3,4,5,18,17,6", + "--arg1=1,8,100,2,100,4,8,3,7", + "--arg1=1,2,3,4,5,6", + "--arg1=6,5,4,3,2,1", + "--arg1=0,0", + "--arg1=10000,1" ], "hidden_test_results": [ "16", @@ -1740,8 +2109,17 @@ "0", "1" ], - "boilerplate": "class Solution:\n def maxArea(self, height: List[int]) -> int:\n ", - "compare_func": "return result == int(expected)" + "boilerplate": { + "python": "class Solution:\n def maxArea(self, height: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int maxArea(List height) {\n\n }\n}", + "cpp": "class Solution {\npublic:\n int maxArea(vector& height) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=UuiTKBwPgAo&pp=ygUiTmVldENvZGUgQ29udGFpbmVyIFdpdGggTW9zdCBXYXRlcg%3D%3D" }, { "title": "3Sum Closest", @@ -1749,24 +2127,24 @@ "description": "

Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target.

\n\n

Return the sum of the three integers.

\n\n

You may assume that each input would have exactly one solution.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [-1,2,1,-4], target = 1\nOutput: 2\nExplanation: The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,0,0], target = 1\nOutput: 0\nExplanation: The sum that is closest to the target is 0. (0 + 0 + 0 = 0).\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 3 <= nums.length <= 500
  • \n\t
  • -1000 <= nums[i] <= 1000
  • \n\t
  • -104 <= target <= 104
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "threeSumClosest([-1,2,1,-4], 1)", - "threeSumClosest([0,0,0], 1)" + "--arg1=-1,2,1,-4 --arg2=1", + "--arg1=0,0,0 --arg2=1" ], "sample_test_results": [ "2", "0" ], "hidden_test_cases": [ - "threeSumClosest([1,1,1,0], 100)", - "threeSumClosest([-1,0,1,2,3], 1)", - "threeSumClosest([0,0,0,0], 1)", - "threeSumClosest([-5,-4,-3,-2,-1], 0)", - "threeSumClosest([1,2,3,4,5], 10)", - "threeSumClosest([-1,-2,-3,1,2,3], 0)", - "threeSumClosest([1,1,-1,-1,3], -1)", - "threeSumClosest([-100,-50,0,50,100], 23)", - "threeSumClosest([-1,2,1,-4,3,-3], 0)", - "threeSumClosest([-1000,1000,1000], 100)" + "--arg1=1,1,1,0 --arg2=100", + "--arg1=-1,0,1,2,3 --arg2=1", + "--arg1=0,0,0,0 --arg2=1", + "--arg1=-5,-4,-3,-2,-1 --arg2=0", + "--arg1=1,2,3,4,5 --arg2=10", + "--arg1=-1,-2,-3,1,2,3 --arg2=0", + "--arg1=1,1,-1,-1,3 --arg2=-1", + "--arg1=-100,-50,0,50,100 --arg2=23", + "--arg1=-1,2,1,-4,3,-3 --arg2=0", + "--arg1=-1000,1000,1000 --arg2=100" ], "hidden_test_results": [ "3", @@ -1780,8 +2158,17 @@ "0", "1000" ], - "boilerplate": "class Solution:\n def threeSumClosest(self, nums: List[int], target: int) -> int:\n ", - "compare_func": "return result == int(expected)" + "boilerplate": { + "python": "class Solution:\n def threeSumClosest(self, nums: List[int], target: int) -> int:\n ", + "java": "class Solution {\n public int threeSumClosest(int[] nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int threeSumClosest(vector& nums, int target) {\n return 0;\n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=PXWT4wzkA6M&pp=ygUVTmVldENvZGUgM1N1bSBDbG9zZXN0" }, { "title": "Search in Rotated Sorted Array", @@ -1789,9 +2176,9 @@ "description": "

There is an integer array nums sorted in ascending order (with distinct values).

\n\n

Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2].

\n\n

Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n
Input: nums = [4,5,6,7,0,1,2], target = 0\nOutput: 4\n

Example 2:

\n
Input: nums = [4,5,6,7,0,1,2], target = 3\nOutput: -1\n

Example 3:

\n
Input: nums = [1], target = 0\nOutput: -1\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 5000
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • All values of nums are unique.
  • \n\t
  • nums is an ascending array that is possibly rotated.
  • \n\t
  • -104 <= target <= 104
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "search([4,5,6,7,0,1,2], 0)", - "search([4,5,6,7,0,1,2], 3)", - "search([1], 0)" + "--arg1=4,5,6,7,0,1,2 --arg2=0", + "--arg1=4,5,6,7,0,1,2 --arg2=3", + "--arg1=1 --arg2=0" ], "sample_test_results": [ "4", @@ -1799,16 +2186,16 @@ "-1" ], "hidden_test_cases": [ - "search([3,1], 1)", - "search([1,3,5], 3)", - "search([5,1,2,3,4], 1)", - "search([4,5,6,7,0,1,2], 5)", - "search([1], 1)", - "search([1,3], 3)", - "search([3,5,1], 3)", - "search([5,1,3], 5)", - "search([4,5,6,7,8,1,2,3], 8)", - "search([1,2,3,4,5], 6)" + "--arg1=3,1 --arg2=1", + "--arg1=1,3,5 --arg2=3", + "--arg1=5,1,2,3,4 --arg2=1", + "--arg1=4,5,6,7,0,1,2 --arg2=5", + "--arg1=1 --arg2=1", + "--arg1=1,3 --arg2=3", + "--arg1=3,5,1 --arg2=3", + "--arg1=5,1,3 --arg2=5", + "--arg1=4,5,6,7,8,1,2,3 --arg2=8", + "--arg1=1,2,3,4,5 --arg2=6" ], "hidden_test_results": [ "1", @@ -1822,8 +2209,17 @@ "4", "-1" ], - "boilerplate": "class Solution:\n def search(self, nums: List[int], target: int) -> int:\n ", - "compare_func": "return result == int(expected)" + "boilerplate": { + "python": "class Solution:\n def search(self, nums: List[int], target: int) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int search(List nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int search(vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return Integer.valueOf(result).equals(Integer.valueOf(expected));", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=U8XENwh8Oy8&pp=ygUnTmVldENvZGUgU2VhcmNoIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5" }, { "title": "Find First and Last Position of Element in Sorted Array", @@ -1831,9 +2227,9 @@ "description": "

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.

\n\n

If target is not found in the array, return [-1, -1].

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n
Input: nums = [5,7,7,8,8,10], target = 8\nOutput: [3,4]\n

Example 2:

\n
Input: nums = [5,7,7,8,8,10], target = 6\nOutput: [-1,-1]\n

Example 3:

\n
Input: nums = [], target = 0\nOutput: [-1,-1]\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • nums is a non-decreasing array.
  • \n\t
  • -109 <= target <= 109
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "searchRange([5,7,7,8,8,10], 8)", - "searchRange([5,7,7,8,8,10], 6)", - "searchRange([], 0)" + "--arg1=5,7,7,8,8,10 --arg2=8", + "--arg1=5,7,7,8,8,10 --arg2=6", + "--arg1= --arg2=0" ], "sample_test_results": [ "(3, 4)", @@ -1841,16 +2237,16 @@ "(-1, -1)" ], "hidden_test_cases": [ - "searchRange([1], 1)", - "searchRange([1,1,1,1], 1)", - "searchRange([1,2,3,4,5], 3)", - "searchRange([1,2,2,3,4,4,4], 4)", - "searchRange([1,1,2], 2)", - "searchRange([1], 2)", - "searchRange([1,2,3], 4)", - "searchRange([1,1,1,2,2,3], 2)", - "searchRange([1,2,3,3,3,4,5], 3)", - "searchRange([1,2,3,4,5,5,5,5,6], 5)" + "--arg1=1 --arg2=1", + "--arg1=1,1,1,1 --arg2=1", + "--arg1=1,2,3,4,5 --arg2=3", + "--arg1=1,2,2,3,4,4,4 --arg2=4", + "--arg1=1,1,2 --arg2=2", + "--arg1=1 --arg2=2", + "--arg1=1,2,3 --arg2=4", + "--arg1=1,1,1,2,2,3 --arg2=2", + "--arg1=1,2,3,3,3,4,5 --arg2=3", + "--arg1=1,2,3,4,5,5,5,5,6 --arg2=5" ], "hidden_test_results": [ "(0, 0)", @@ -1864,8 +2260,17 @@ "(2, 4)", "(4, 7)" ], - "boilerplate": "class Solution:\n def searchRange(self, nums: List[int], target: int) -> List[int]:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def searchRange(self, nums: List[int], target: int) -> List[int]:\n ", + "java": "class Solution {\n public int[] searchRange(int[] nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector searchRange(vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "Object eval(String expression);\n\nObject resultVal = eval(result);\nObject expectedVal = eval(expected);\nreturn resultVal.equals(expectedVal);", + "cpp": "try {\n return result == std::stoi(expected);\n} catch (std::invalid_argument& e) {\n return false;\n} catch (std::out_of_range& e) {\n return false;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=4sQL7R5ySUU&pp=ygVATmVldENvZGUgRmluZCBGaXJzdCBhbmQgTGFzdCBQb3NpdGlvbiBvZiBFbGVtZW50IGluIFNvcnRlZCBBcnJheQ%3D%3D" }, { "title": "Count and Say", @@ -1873,9 +2278,9 @@ "description": "

The count-and-say sequence is a sequence of digit strings defined by the recursive formula:

\n\n
    \n\t
  • countAndSay(1) = "1"
  • \n\t
  • countAndSay(n) is the run-length encoding of countAndSay(n - 1).
  • \n
\n\n

Run-length encoding (RLE) is a string compression method that works by replacing consecutive identical characters (repeated 2 or more times) with the concatenation of the character and the number marking the count of the characters (length of the run). For example, to compress the string "3322251" we replace "33" with "23", replace "222" with "32", replace "5" with "15" and replace "1" with "11". Thus the compressed string becomes "23321511".

\n\n

Given a positive integer n, return the nth element of the count-and-say sequence.

\n\n

 

\n

Example 1:

\n\n
\n

Input: n = 4

\n\n

Output: "1211"

\n\n

Explanation:

\n\n
\ncountAndSay(1) = "1"\ncountAndSay(2) = RLE of "1" = "11"\ncountAndSay(3) = RLE of "11" = "21"\ncountAndSay(4) = RLE of "21" = "1211"\n
\n
\n\n

Example 2:

\n\n
\n

Input: n = 1

\n\n

Output: "1"

\n\n

Explanation:

\n\n

This is the base case.

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 30
  • \n
\n\n

 

\nFollow up: Could you solve it iteratively?", "difficulty": "medium", "sample_test_cases": [ - "countAndSay(4)", - "countAndSay(1)", - "countAndSay(5)" + "--arg1=4", + "--arg1=1", + "--arg1=5" ], "sample_test_results": [ "'1211'", @@ -1883,16 +2288,16 @@ "'111221'" ], "hidden_test_cases": [ - "countAndSay(2)", - "countAndSay(3)", - "countAndSay(6)", - "countAndSay(7)", - "countAndSay(8)", - "countAndSay(9)", - "countAndSay(10)", - "countAndSay(15)", - "countAndSay(20)", - "countAndSay(30)" + "--arg1=2", + "--arg1=3", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9", + "--arg1=10", + "--arg1=15", + "--arg1=20", + "--arg1=30" ], "hidden_test_results": [ "'11'", @@ -1906,8 +2311,17 @@ "'11131221131211132221232112111312111213111213211231132132211211131221131211221321123113213221123113112221131112311332211211131221131211132211121312211231131112311211232221121321132132211331121321231231121113112221121321133112132112312321123113112221121113122113121113123112112322111213211322211312113211'", "'3113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112212211131221121321131211132221123113112221131112311332211211133112111311222112111312211311123113322112111312211312111322212321121113121112133221121321132132211331121321132213211231132132211211131221232112111312212221121123222112311311222113111231133211121321321122111312211312111322211213211321322123211211131211121332211231131122211311123113321112131221123113111231121123222112111331121113112221121113122113111231133221121113122113121113221112131221123113111231121123222112111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321132132211322132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211322113321132211221121332211231131122211311123113321112131221123113111231121113311211131221121321131211132221123113112211121312211231131122211211133112111311222112111312211312111322211213211321223112111311222112132113213221133122211311221122111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321132132211322132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211322113321132211221121332211213211321322113311213212312311211131122211213211331121321123123211231131122211211131221131112311332211213211321223112111311222112132113213221123123211231132132211231131122211311123113322112111312211312111322111213122112311311123112112322211213211321322113312211223113112221121113122113111231133221121321132132211331222113321112131122211332113221122112133221123113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112311332111213122112311311123112112322211322311311222113111231133211121312211231131112311211232221121113122113121113222123211211131221132211131221121321131211132221123113112211121312211231131122113221122112133221121321132132211331121321231231121113121113122122311311222113111231133221121113122113121113221112131221123113111231121123222112132113213221133112132123123112111312211322311211133112111312211213211311123113223112111321322123122113222122211211232221121113122113121113222123211211131211121311121321123113213221121113122123211211131221121311121312211213211321322112311311222113311213212322211211131221131211221321123113213221121113122113121113222112131112131221121321131211132221121321132132211331121321232221123113112221131112311322311211131122211213211331121321122112133221121113122113121113222123112221221321132132211231131122211331121321232221121113122113121113222123211211131211121332211213111213122112132113121113222112132113213221232112111312111213322112132113213221133112132123123112111311222112132113311213211221121332211231131122211311123113321112131221123113112221132231131122211211131221131112311332211213211321223112111311222112132113212221132221222112112322211211131221131211132221232112111312111213111213211231131112311311221122132113213221133112132123222112311311222113111231132231121113112221121321133112132112211213322112111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121311121312211213211312111322211213211321322123211211131211121332211213211321322113311213211322132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321133112132112312321123113112221121113122113111231133221121321132122311211131122211213211321222113222122211211232221123113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112311332111213213211221113122113121113222112132113213221232112111312111213322112132113213221133112132123123112111312211322311211133112111312212221121123222112132113213221133112132123222113223113112221131112311332111213122112311311123112112322211211131221131211132221232112111312111213111213211231132132211211131221131211221321123113213221123113112221131112211322212322211231131122211322111312211312111322211213211321322113311213211331121113122122211211132213211231131122212322211331222113112211'" ], - "boilerplate": "class Solution:\n def countAndSay(self, n: int) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def countAndSay(self, n: int) -> str:\n ", + "java": "class Solution {\n public String countAndSay(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string countAndSay(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(evaluate(expected));\n// Implement the evaluate(String expression) function to parse and evaluate the expression within expected", + "cpp": "return result == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=iP4RH2zespg&pp=ygUWTmVldENvZGUgQ291bnQgYW5kIFNheQ%3D%3D" }, { "title": "Combination Sum II", @@ -1915,41 +2329,50 @@ "description": "

Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target.

\n\n

Each number in candidates may only be used once in the combination.

\n\n

Note: The solution set must not contain duplicate combinations.

\n\n

 

\n

Example 1:

\n\n
\nInput: candidates = [10,1,2,7,6,1,5], target = 8\nOutput: \n[\n[1,1,6],\n[1,2,5],\n[1,7],\n[2,6]\n]\n
\n\n

Example 2:

\n\n
\nInput: candidates = [2,5,2,1,2], target = 5\nOutput: \n[\n[1,2,2],\n[5]\n]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= candidates.length <= 100
  • \n\t
  • 1 <= candidates[i] <= 50
  • \n\t
  • 1 <= target <= 30
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "combinationSum2([10,1,2,7,6,1,5], 8)", - "combinationSum2([2,5,2,1,2], 5)", - "combinationSum2([1,1,1,1,1,1,1], 3)" + "--arg1=10,1,2,7,6,1,5 --arg2=8", + "--arg1=2,5,2,1,2 --arg2=5", + "--arg1=1,1,1,1,1,1,1 --arg2=3" ], "sample_test_results": [ - "[[1, 1, 6], [1, 2, 5], [1, 7], [2, 6]]", - "[[1, 2, 2], [5]]", - "[[1, 1, 1]]" + "[1, 1, 6], [1, 2, 5], [1, 7], [2, 6]", + "[1, 2, 2], [5]", + "[1, 1, 1]" ], "hidden_test_cases": [ - "combinationSum2([1], 1)", - "combinationSum2([1,2,3], 6)", - "combinationSum2([1,1,1,2,2], 3)", - "combinationSum2([10,20,30,40,50], 60)", - "combinationSum2([2,2,2,2,2], 4)", - "combinationSum2([1,2,3,4,5], 10)", - "combinationSum2([1,1,1,1,1,1,1,1,1,1], 5)", - "combinationSum2([5,4,3,2,1], 8)", - "combinationSum2([10,1,2,7,6,1,5], 9)", - "combinationSum2([1,2,2,2,2,2,3], 7)" + "--arg1=1 --arg2=1", + "--arg1=1,2,3 --arg2=6", + "--arg1=1,1,1,2,2 --arg2=3", + "--arg1=10,20,30,40,50 --arg2=60", + "--arg1=2,2,2,2,2 --arg2=4", + "--arg1=1,2,3,4,5 --arg2=10", + "--arg1=1,1,1,1,1,1,1,1,1,1 --arg2=5", + "--arg1=5,4,3,2,1 --arg2=8", + "--arg1=10,1,2,7,6,1,5 --arg2=9", + "--arg1=1,2,2,2,2,2,3 --arg2=7" ], "hidden_test_results": [ - "[[1]]", - "[[1, 2, 3]]", - "[[1, 1, 1], [1, 2]]", - "[[10, 20, 30], [10, 50], [20, 40]]", - "[[2, 2]]", - "[[1, 2, 3, 4], [1, 4, 5], [2, 3, 5]]", - "[[1, 1, 1, 1, 1]]", - "[[1, 2, 5], [1, 3, 4], [3, 5]]", - "[[1, 1, 2, 5], [1, 1, 7], [1, 2, 6], [2, 7]]", - "[[1, 2, 2, 2], [2, 2, 3]]" - ], - "boilerplate": "class Solution:\n def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:\n ", - "compare_func": "return sorted([sorted(x) for x in result]) == eval(expected)" + "[1]", + "[1, 2, 3]", + "[1, 1, 1], [1, 2]", + "[10, 20, 30], [10, 50], [20, 40]", + "[2, 2]", + "[1, 2, 3, 4], [1, 4, 5], [2, 3, 5]", + "[1, 1, 1, 1, 1]", + "[1, 2, 5], [1, 3, 4], [3, 5]", + "[1, 1, 2, 5], [1, 1, 7], [1, 2, 6], [2, 7]", + "[1, 2, 2, 2], [2, 2, 3]" + ], + "boilerplate": { + "python": "class Solution:\n def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:\n ", + "java": "class Solution {\n public List> combinationSum2(List candidates, int target) {\n // code goes here\n return null; // placeholder return value\n }\n}", + "cpp": "class Solution {\npublic:\n vector> combinationSum2(vector& candidates, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted([sorted(x) for x in result]) == eval(expected)", + "java": "Collections.sort(resultSet, new Comparator>() {\n @Override\n public int compare(List a, List b) {\n Collections.sort(a);\n Collections.sort(b);\n return a.equals(b) ? 0 : -1;\n }\n});\nreturn resultSet.equals(expectedSet);", + "cpp": "std::vector> sortNestedVectors(const std::vector>& v) {\n std::vector> sorted_v = v;\n for (auto& vec : sorted_v) {\n std::sort(vec.begin(), vec.end());\n }\n std::sort(sorted_v.begin(), sorted_v.end());\n return sorted_v;\n}\n\nbool compareFunction(const std::vector>& result, const std::string& expected) {\n std::vector> expected_vec;\n // Assuming a function `stringToVector` is defined to convert the string representation to a vector of vectors\n expected_vec = stringToVector(expected);\n return sortNestedVectors(result) == expected_vec;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=FOyRpNUSFeA&pp=ygUbTmVldENvZGUgQ29tYmluYXRpb24gU3VtIElJ" }, { "title": "Multiply Strings", @@ -1957,9 +2380,9 @@ "description": "

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

\n\n

Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.

\n\n

 

\n

Example 1:

\n
Input: num1 = \"2\", num2 = \"3\"\nOutput: \"6\"\n

Example 2:

\n
Input: num1 = \"123\", num2 = \"456\"\nOutput: \"56088\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num1.length, num2.length <= 200
  • \n\t
  • num1 and num2 consist of digits only.
  • \n\t
  • Both num1 and num2 do not contain any leading zero, except the number 0 itself.
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "multiply(\"2\", \"3\")", - "multiply(\"123\", \"456\")", - "multiply(\"9999\", \"9999\")" + "--arg1=\"2\" --arg2=\"3\"", + "--arg1=\"123\" --arg2=\"456\"", + "--arg1=\"9999\" --arg2=\"9999\"" ], "sample_test_results": [ "'6'", @@ -1967,16 +2390,16 @@ "'99980001'" ], "hidden_test_cases": [ - "multiply(\"0\", \"0\")", - "multiply(\"1\", \"1\")", - "multiply(\"999\", \"999\")", - "multiply(\"1234\", \"5678\")", - "multiply(\"99999\", \"99999\")", - "multiply(\"123456789\", \"987654321\")", - "multiply(\"1000000\", \"1000000\")", - "multiply(\"11111111\", \"11111111\")", - "multiply(\"12345678901234567890\", \"12345678901234567890\")", - "multiply(\"0\", \"1234567890\")" + "--arg1=\"0\" --arg2=\"0\"", + "--arg1=\"1\" --arg2=\"1\"", + "--arg1=\"999\" --arg2=\"999\"", + "--arg1=\"1234\" --arg2=\"5678\"", + "--arg1=\"99999\" --arg2=\"99999\"", + "--arg1=\"123456789\" --arg2=\"987654321\"", + "--arg1=\"1000000\" --arg2=\"1000000\"", + "--arg1=\"11111111\" --arg2=\"11111111\"", + "--arg1=\"12345678901234567890\" --arg2=\"12345678901234567890\"", + "--arg1=\"0\" --arg2=\"1234567890\"" ], "hidden_test_results": [ "'0'", @@ -1990,8 +2413,17 @@ "'152415787532388367501905199875019052100'", "'0'" ], - "boilerplate": "class Solution:\n def multiply(self, num1: str, num2: str) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def multiply(self, num1: str, num2: str) -> str:\n ", + "java": "class Solution {\n public String multiply(String num1, String num2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string multiply(string num1, string num2) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=1vZswirL8Y8&pp=ygUZTmVldENvZGUgTXVsdGlwbHkgU3RyaW5ncw%3D%3D" }, { "title": "Jump Game II", @@ -1999,9 +2431,9 @@ "description": "

You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0].

\n\n

Each element nums[i] represents the maximum length of a forward jump from index i. In other words, if you are at nums[i], you can jump to any nums[i + j] where:

\n\n
    \n\t
  • 0 <= j <= nums[i] and
  • \n\t
  • i + j < n
  • \n
\n\n

Return the minimum number of jumps to reach nums[n - 1]. The test cases are generated such that you can reach nums[n - 1].

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [2,3,1,1,4]\nOutput: 2\nExplanation: The minimum number of jumps to reach the last index is 2. Jump 1 step from index 0 to 1, then 3 steps to the last index.\n
\n\n

Example 2:

\n\n
\nInput: nums = [2,3,0,1,4]\nOutput: 2\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 104
  • \n\t
  • 0 <= nums[i] <= 1000
  • \n\t
  • It's guaranteed that you can reach nums[n - 1].
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "jump([2,3,1,1,4])", - "jump([2,3,0,1,4])", - "jump([1,2,3,4,5])" + "--arg1=2,3,1,1,4", + "--arg1=2,3,0,1,4", + "--arg1=1,2,3,4,5" ], "sample_test_results": [ "2", @@ -2009,16 +2441,16 @@ "3" ], "hidden_test_cases": [ - "jump([1])", - "jump([2,1])", - "jump([1,1,1,1])", - "jump([3,2,1])", - "jump([1,2,1,1,1])", - "jump([5,9,3,2,1,0,2,3,3,1,0,0])", - "jump([1,2,3,4,5])", - "jump([4,1,1,3,1,1,1])", - "jump([1,1,1,1,1,1,1,1,1,1])", - "jump([10,9,8,7,6,5,4,3,2,1])" + "--arg1=1", + "--arg1=2,1", + "--arg1=1,1,1,1", + "--arg1=3,2,1", + "--arg1=1,2,1,1,1", + "--arg1=5,9,3,2,1,0,2,3,3,1,0,0", + "--arg1=1,2,3,4,5", + "--arg1=4,1,1,3,1,1,1", + "--arg1=1,1,1,1,1,1,1,1,1,1", + "--arg1=10,9,8,7,6,5,4,3,2,1" ], "hidden_test_results": [ "0", @@ -2032,8 +2464,17 @@ "9", "1" ], - "boilerplate": "class Solution:\n def jump(self, nums: List[int]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def jump(self, nums: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int jump(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int jump(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=dJ7sWiOoK7g&pp=ygUVTmVldENvZGUgSnVtcCBHYW1lIElJ" }, { "title": "Maximum Subarray", @@ -2041,9 +2482,9 @@ "description": "

Given an integer array nums, find the subarray with the largest sum, and return its sum.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [-2,1,-3,4,-1,2,1,-5,4]\nOutput: 6\nExplanation: The subarray [4,-1,2,1] has the largest sum 6.\n
\n\n

Example 2:

\n\n
\nInput: nums = [1]\nOutput: 1\nExplanation: The subarray [1] has the largest sum 1.\n
\n\n

Example 3:

\n\n
\nInput: nums = [5,4,-1,7,8]\nOutput: 23\nExplanation: The subarray [5,4,-1,7,8] has the largest sum 23.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -104 <= nums[i] <= 104
  • \n
\n\n

 

\n

Follow up: If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle.

\n", "difficulty": "medium", "sample_test_cases": [ - "maxSubArray([-2,1,-3,4,-1,2,1,-5,4])", - "maxSubArray([1])", - "maxSubArray([5,4,-1,7,8])" + "--arg1=-2,1,-3,4,-1,2,1,-5,4", + "--arg1=1", + "--arg1=5,4,-1,7,8" ], "sample_test_results": [ "6", @@ -2051,16 +2492,16 @@ "23" ], "hidden_test_cases": [ - "maxSubArray([-1])", - "maxSubArray([-2,-1])", - "maxSubArray([1,2,3,4,5])", - "maxSubArray([-1,-2,-3,-4,-5])", - "maxSubArray([1,-1,1,-1,1,-1])", - "maxSubArray([-2,1,-3,4,-1,2,1,-5,4])", - "maxSubArray([0,0,0,0])", - "maxSubArray([-1,0,-2,2])", - "maxSubArray([1,-2,3,-4,5,-6,7,-8])", - "maxSubArray([-1,-1,2,-1,-1])" + "--arg1=-1", + "--arg1=-2,-1", + "--arg1=1,2,3,4,5", + "--arg1=-1,-2,-3,-4,-5", + "--arg1=1,-1,1,-1,1,-1", + "--arg1=-2,1,-3,4,-1,2,1,-5,4", + "--arg1=0,0,0,0", + "--arg1=-1,0,-2,2", + "--arg1=1,-2,3,-4,5,-6,7,-8", + "--arg1=-1,-1,2,-1,-1" ], "hidden_test_results": [ "-1", @@ -2074,8 +2515,17 @@ "7", "2" ], - "boilerplate": "class Solution:\n def maxSubArray(self, nums: List[int]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def maxSubArray(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int maxSubArray(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxSubArray(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=5WZl3MMT0Eg&pp=ygUZTmVldENvZGUgTWF4aW11bSBTdWJhcnJheQ%3D%3D" }, { "title": "Spiral Matrix", @@ -2083,39 +2533,48 @@ "description": "

Given an m x n matrix, return all elements of the matrix in spiral order.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [[1,2,3],[4,5,6],[7,8,9]]\nOutput: [1,2,3,6,9,8,7,4,5]\n
\n\n

Example 2:

\n\"\"\n
\nInput: matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]\nOutput: [1,2,3,4,8,12,11,10,9,5,6,7]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == matrix.length
  • \n\t
  • n == matrix[i].length
  • \n\t
  • 1 <= m, n <= 10
  • \n\t
  • -100 <= matrix[i][j] <= 100
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "spiralOrder([[1,2,3],[4,5,6],[7,8,9]])", - "spiralOrder([[1,2,3,4],[5,6,7,8],[9,10,11,12]])" + "--arg1=[1,2,3 --arg2=4,5,6 --arg3=7,8,9 --arg4=]", + "--arg1=[1,2,3,4 --arg2=5,6,7,8 --arg3=9,10,11,12 --arg4=]" ], "sample_test_results": [ - "[1, 2, 3, 6, 9, 8, 7, 4, 5]", - "[1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]" + "1, 2, 3, 6, 9, 8, 7, 4, 5", + "1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7" ], "hidden_test_cases": [ - "spiralOrder([[1]])", - "spiralOrder([[1,2],[3,4]])", - "spiralOrder([[1,2,3]])", - "spiralOrder([[1],[2],[3]])", - "spiralOrder([[1,2,3,4],[5,6,7,8]])", - "spiralOrder([[1,2],[3,4],[5,6]])", - "spiralOrder([[]])", - "spiralOrder([])", - "spiralOrder([[1,2,3],[4,5,6]])", - "spiralOrder([[1,2],[3,4],[5,6],[7,8]])" + "--arg1=[1 --arg2=]", + "--arg1=[1,2 --arg2=3,4 --arg3=]", + "--arg1=[1,2,3 --arg2=]", + "--arg1=[1 --arg2=2 --arg3=3 --arg4=]", + "--arg1=[1,2,3,4 --arg2=5,6,7,8 --arg3=]", + "--arg1=[1,2 --arg2=3,4 --arg3=5,6 --arg4=]", + "--arg1=[ --arg2=]", + "--arg1=", + "--arg1=[1,2,3 --arg2=4,5,6 --arg3=]", + "--arg1=[1,2 --arg2=3,4 --arg3=5,6 --arg4=7,8 --arg5=]" ], "hidden_test_results": [ - "[1]", - "[1, 2, 4, 3]", - "[1, 2, 3]", - "[1, 2, 3]", - "[1, 2, 3, 4, 8, 7, 6, 5]", - "[1, 2, 4, 6, 5, 3]", - "[]", - "[]", - "[1, 2, 3, 6, 5, 4]", - "[1, 2, 4, 6, 8, 7, 5, 3]" - ], - "boilerplate": "class Solution:\n def spiralOrder(self, matrix: List[List[int]]) -> List[int]:\n ", - "compare_func": "return str(result) == expected" + "1", + "1, 2, 4, 3", + "1, 2, 3", + "1, 2, 3", + "1, 2, 3, 4, 8, 7, 6, 5", + "1, 2, 4, 6, 5, 3", + "", + "", + "1, 2, 3, 6, 5, 4", + "1, 2, 4, 6, 8, 7, 5, 3" + ], + "boilerplate": { + "python": "class Solution:\n def spiralOrder(self, matrix: List[List[int]]) -> List[int]:\n ", + "java": "import java.util.ArrayList;\nimport java.util.List;\n\nclass Solution {\n public List spiralOrder(int[][] matrix) {\n List result = new ArrayList<>();\n // Implement the logic here\n return result;\n }\n}\n", + "cpp": "class Solution {\npublic:\n vector spiralOrder(vector>& matrix) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=BJnMZNwUk1M&pp=ygUWTmVldENvZGUgU3BpcmFsIE1hdHJpeA%3D%3D" }, { "title": "Merge Intervals", @@ -2123,39 +2582,48 @@ "description": "

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.

\n\n

 

\n

Example 1:

\n\n
\nInput: intervals = [[1,3],[2,6],[8,10],[15,18]]\nOutput: [[1,6],[8,10],[15,18]]\nExplanation: Since intervals [1,3] and [2,6] overlap, merge them into [1,6].\n
\n\n

Example 2:

\n\n
\nInput: intervals = [[1,4],[4,5]]\nOutput: [[1,5]]\nExplanation: Intervals [1,4] and [4,5] are considered overlapping.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= intervals.length <= 104
  • \n\t
  • intervals[i].length == 2
  • \n\t
  • 0 <= starti <= endi <= 104
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "merge([[1,3],[2,6],[8,10],[15,18]])", - "merge([[1,4],[4,5]])" + "--arg1=[1,3 --arg2=2,6 --arg3=8,10 --arg4=15,18 --arg5=]", + "--arg1=[1,4 --arg2=4,5 --arg3=]" ], "sample_test_results": [ - "[[1, 6], [8, 10], [15, 18]]", - "[[1, 5]]" + "[1, 6], [8, 10], [15, 18]", + "[1, 5]" ], "hidden_test_cases": [ - "merge([[1,4],[0,4]])", - "merge([[1,4],[2,3]])", - "merge([[1,4],[0,0]])", - "merge([[1,4]])", - "merge([[1,4],[5,6]])", - "merge([[1,10],[2,3],[4,5],[6,7],[8,9]])", - "merge([[1,2],[2,3],[3,4],[4,5]])", - "merge([[1,5],[2,3]])", - "merge([[1,4],[1,5]])", - "merge([[1,4],[4,6],[5,7],[6,8]])" + "--arg1=[1,4 --arg2=0,4 --arg3=]", + "--arg1=[1,4 --arg2=2,3 --arg3=]", + "--arg1=[1,4 --arg2=0,0 --arg3=]", + "--arg1=[1,4 --arg2=]", + "--arg1=[1,4 --arg2=5,6 --arg3=]", + "--arg1=[1,10 --arg2=2,3 --arg3=4,5 --arg4=6,7 --arg5=8,9 --arg6=]", + "--arg1=[1,2 --arg2=2,3 --arg3=3,4 --arg4=4,5 --arg5=]", + "--arg1=[1,5 --arg2=2,3 --arg3=]", + "--arg1=[1,4 --arg2=1,5 --arg3=]", + "--arg1=[1,4 --arg2=4,6 --arg3=5,7 --arg4=6,8 --arg5=]" ], "hidden_test_results": [ - "[[0, 4]]", - "[[1, 4]]", - "[[0, 0], [1, 4]]", - "[[1, 4]]", - "[[1, 4], [5, 6]]", - "[[1, 10]]", - "[[1, 5]]", - "[[1, 5]]", - "[[1, 5]]", - "[[1, 8]]" - ], - "boilerplate": "class Solution:\n def merge(self, intervals: List[List[int]]) -> List[List[int]]:\n ", - "compare_func": "return str(sorted(result)) == str(eval(expected))" + "[0, 4]", + "[1, 4]", + "[0, 0], [1, 4]", + "[1, 4]", + "[1, 4], [5, 6]", + "[1, 10]", + "[1, 5]", + "[1, 5]", + "[1, 5]", + "[1, 8]" + ], + "boilerplate": { + "python": "class Solution:\n def merge(self, intervals: List[List[int]]) -> List[List[int]]:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public List> merge(List> intervals) {\n \n return null;\n }\n}", + "cpp": "class Solution {\npublic:\n vector> merge(vector>& intervals) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(sorted(result)) == str(eval(expected))", + "java": "return Arrays.toString(Arrays.stream(result).sorted().toArray()).equals(Arrays.toString(eval(expected)));", + "cpp": "std::string resultStr;\nstd::string expectedStr;\nfor (const auto &elem : result) {\n resultStr += std::to_string(elem) + \",\";\n}\nexpectedStr = expected;\nreturn resultStr == expectedStr;" + }, + "explanation": "https://www.youtube.com/watch?v=44H3cEC2fFM&pp=ygUYTmVldENvZGUgTWVyZ2UgSW50ZXJ2YWxz" }, { "title": "Insert Interval", @@ -2163,39 +2631,48 @@ "description": "

You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and intervals is sorted in ascending order by starti. You are also given an interval newInterval = [start, end] that represents the start and end of another interval.

\n\n

Insert newInterval into intervals such that intervals is still sorted in ascending order by starti and intervals still does not have any overlapping intervals (merge overlapping intervals if necessary).

\n\n

Return intervals after the insertion.

\n\n

Note that you don't need to modify intervals in-place. You can make a new array and return it.

\n\n

 

\n

Example 1:

\n\n
\nInput: intervals = [[1,3],[6,9]], newInterval = [2,5]\nOutput: [[1,5],[6,9]]\n
\n\n

Example 2:

\n\n
\nInput: intervals = [[1,2],[3,5],[6,7],[8,10],[12,16]], newInterval = [4,8]\nOutput: [[1,2],[3,10],[12,16]]\nExplanation: Because the new interval [4,8] overlaps with [3,5],[6,7],[8,10].\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= intervals.length <= 104
  • \n\t
  • intervals[i].length == 2
  • \n\t
  • 0 <= starti <= endi <= 105
  • \n\t
  • intervals is sorted by starti in ascending order.
  • \n\t
  • newInterval.length == 2
  • \n\t
  • 0 <= start <= end <= 105
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "insert([[1,3],[6,9]], [2,5])", - "insert([[1,2],[3,5],[6,7],[8,10],[12,16]], [4,8])" + "--arg1=[1,3 --arg2=6,9 --arg3=] --arg4=[2 --arg5=5]", + "--arg1=[1,2 --arg2=3,5 --arg3=6,7 --arg4=8,10 --arg5=12,16 --arg6=] --arg7=[4 --arg8=8]" ], "sample_test_results": [ - "[[1, 5], [6, 9]]", - "[[1, 2], [3, 10], [12, 16]]" + "[1, 5], [6, 9]", + "[1, 2], [3, 10], [12, 16]" ], "hidden_test_cases": [ - "insert([], [5,7])", - "insert([[1,5]], [2,3])", - "insert([[1,5]], [2,7])", - "insert([[1,5]], [6,8])", - "insert([[1,5]], [0,3])", - "insert([[3,5],[12,15]], [6,6])", - "insert([[1,2],[3,5],[6,7],[8,10],[12,16]], [4,8])", - "insert([[1,5]], [0,0])", - "insert([[3,5],[12,15]], [1,2])", - "insert([[1,5],[6,7]], [0,8])" + "--arg1= --arg2=[5 --arg3=7]", + "--arg1=[1,5 --arg2=] --arg3=[2 --arg4=3]", + "--arg1=[1,5 --arg2=] --arg3=[2 --arg4=7]", + "--arg1=[1,5 --arg2=] --arg3=[6 --arg4=8]", + "--arg1=[1,5 --arg2=] --arg3=[0 --arg4=3]", + "--arg1=[3,5 --arg2=12,15 --arg3=] --arg4=[6 --arg5=6]", + "--arg1=[1,2 --arg2=3,5 --arg3=6,7 --arg4=8,10 --arg5=12,16 --arg6=] --arg7=[4 --arg8=8]", + "--arg1=[1,5 --arg2=] --arg3=[0 --arg4=0]", + "--arg1=[3,5 --arg2=12,15 --arg3=] --arg4=[1 --arg5=2]", + "--arg1=[1,5 --arg2=6,7 --arg3=] --arg4=[0 --arg5=8]" ], "hidden_test_results": [ - "[[5, 7]]", - "[[1, 5]]", - "[[1, 7]]", - "[[1, 5], [6, 8]]", - "[[0, 5]]", - "[[3, 5], [6, 6], [12, 15]]", - "[[1, 2], [3, 10], [12, 16]]", - "[[0, 0], [1, 5]]", - "[[1, 2], [3, 5], [12, 15]]", - "[[0, 8]]" - ], - "boilerplate": "class Solution:\n def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:\n ", - "compare_func": "return str(sorted(result)) == str(eval(expected))" + "[5, 7]", + "[1, 5]", + "[1, 7]", + "[1, 5], [6, 8]", + "[0, 5]", + "[3, 5], [6, 6], [12, 15]", + "[1, 2], [3, 10], [12, 16]", + "[0, 0], [1, 5]", + "[1, 2], [3, 5], [12, 15]", + "[0, 8]" + ], + "boilerplate": { + "python": "class Solution:\n def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List> insert(List> intervals, List newInterval) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector> insert(vector>& intervals, vector& newInterval) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(sorted(result)) == str(eval(expected))", + "java": "return Arrays.toString(Arrays.stream(result).sorted().toArray()).equals(evalExpected(expected));\n\nString evalExpected(String expected) {\n // Implement a method to evaluate the expected string\n // This may involve parsing the expected notation and constructing an equivalent Java object\n return someConstructedValue;\n}", + "cpp": "#include \n#include \n#include \n\nbool compareFunction(const std::vector& result, const std::string& expected) {\n std::vector sortedResult = result; // Make a copy of result\n std::sort(sortedResult.begin(), sortedResult.end()); // Sort the copy\n \n std::stringstream ss;\n ss << \"[\";\n for(size_t i = 0; i < sortedResult.size(); ++i) {\n ss << sortedResult[i];\n if (i != sortedResult.size() - 1) {\n ss << \", \";\n }\n }\n ss << \"]\";\n\n return ss.str() == expected;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=A8NUOmlwOlM&pp=ygUYTmVldENvZGUgSW5zZXJ0IEludGVydmFs" }, { "title": "Unique Paths II", @@ -2203,24 +2680,24 @@ "description": "

You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time.

\n\n

An obstacle and space are marked as 1 or 0 respectively in grid. A path that the robot takes cannot include any square that is an obstacle.

\n\n

Return the number of possible unique paths that the robot can take to reach the bottom-right corner.

\n\n

The testcases are generated so that the answer will be less than or equal to 2 * 109.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: obstacleGrid = [[0,0,0],[0,1,0],[0,0,0]]\nOutput: 2\nExplanation: There is one obstacle in the middle of the 3x3 grid above.\nThere are two ways to reach the bottom-right corner:\n1. Right -> Right -> Down -> Down\n2. Down -> Down -> Right -> Right\n
\n\n

Example 2:

\n\"\"\n
\nInput: obstacleGrid = [[0,1],[0,0]]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == obstacleGrid.length
  • \n\t
  • n == obstacleGrid[i].length
  • \n\t
  • 1 <= m, n <= 100
  • \n\t
  • obstacleGrid[i][j] is 0 or 1.
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "uniquePathsWithObstacles([[0,0,0],[0,1,0],[0,0,0]])", - "uniquePathsWithObstacles([[0,1],[0,0]])" + "--arg1=[0,0,0 --arg2=0,1,0 --arg3=0,0,0 --arg4=]", + "--arg1=[0,1 --arg2=0,0 --arg3=]" ], "sample_test_results": [ "2", "1" ], "hidden_test_cases": [ - "uniquePathsWithObstacles([[0]])", - "uniquePathsWithObstacles([[1]])", - "uniquePathsWithObstacles([[0,0],[0,1]])", - "uniquePathsWithObstacles([[0,0],[1,0]])", - "uniquePathsWithObstacles([[0,0,0]])", - "uniquePathsWithObstacles([[0],[0],[0]])", - "uniquePathsWithObstacles([[1,0]])", - "uniquePathsWithObstacles([[0,1],[1,0]])", - "uniquePathsWithObstacles([[0,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,0]])", - "uniquePathsWithObstacles([[0,0,0],[0,0,0],[0,0,1]])" + "--arg1=[0 --arg2=]", + "--arg1=[1 --arg2=]", + "--arg1=[0,0 --arg2=0,1 --arg3=]", + "--arg1=[0,0 --arg2=1,0 --arg3=]", + "--arg1=[0,0,0 --arg2=]", + "--arg1=[0 --arg2=0 --arg3=0 --arg4=]", + "--arg1=[1,0 --arg2=]", + "--arg1=[0,1 --arg2=1,0 --arg3=]", + "--arg1=[0,0,0,0 --arg2=0,1,0,0 --arg3=0,0,1,0 --arg4=0,0,0,0 --arg5=]", + "--arg1=[0,0,0 --arg2=0,0,0 --arg3=0,0,1 --arg4=]" ], "hidden_test_results": [ "1", @@ -2234,8 +2711,17 @@ "4", "0" ], - "boilerplate": "class Solution:\n def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:\n ", + "java": "class Solution {\n public int uniquePathsWithObstacles(int[][] obstacleGrid) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int uniquePathsWithObstacles(vector>& obstacleGrid) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=d3UOz7zdE4I&pp=ygUYTmVldENvZGUgVW5pcXVlIFBhdGhzIElJ" }, { "title": "Simplify Path", @@ -2243,11 +2729,11 @@ "description": "

You are given an absolute path for a Unix-style file system, which always begins with a slash '/'. Your task is to transform this absolute path into its simplified canonical path.

\n\n

The rules of a Unix-style file system are as follows:

\n\n
    \n\t
  • A single period '.' represents the current directory.
  • \n\t
  • A double period '..' represents the previous/parent directory.
  • \n\t
  • Multiple consecutive slashes such as '//' and '///' are treated as a single slash '/'.
  • \n\t
  • Any sequence of periods that does not match the rules above should be treated as a valid directory or file name. For example, '...' and '....' are valid directory or file names.
  • \n
\n\n

The simplified canonical path should follow these rules:

\n\n
    \n\t
  • The path must start with a single slash '/'.
  • \n\t
  • Directories within the path must be separated by exactly one slash '/'.
  • \n\t
  • The path must not end with a slash '/', unless it is the root directory.
  • \n\t
  • The path must not have any single or double periods ('.' and '..') used to denote current or parent directories.
  • \n
\n\n

Return the simplified canonical path.

\n\n

 

\n

Example 1:

\n\n
\n

Input: path = "/home/"

\n\n

Output: "/home"

\n\n

Explanation:

\n\n

The trailing slash should be removed.

\n
\n\n

Example 2:

\n\n
\n

Input: path = "/home//foo/"

\n\n

Output: "/home/foo"

\n\n

Explanation:

\n\n

Multiple consecutive slashes are replaced by a single one.

\n
\n\n

Example 3:

\n\n
\n

Input: path = "/home/user/Documents/../Pictures"

\n\n

Output: "/home/user/Pictures"

\n\n

Explanation:

\n\n

A double period ".." refers to the directory up a level (the parent directory).

\n
\n\n

Example 4:

\n\n
\n

Input: path = "/../"

\n\n

Output: "/"

\n\n

Explanation:

\n\n

Going one level up from the root directory is not possible.

\n
\n\n

Example 5:

\n\n
\n

Input: path = "/.../a/../b/c/../d/./"

\n\n

Output: "/.../b/d"

\n\n

Explanation:

\n\n

"..." is a valid name for a directory in this problem.

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= path.length <= 3000
  • \n\t
  • path consists of English letters, digits, period '.', slash '/' or '_'.
  • \n\t
  • path is a valid absolute Unix path.
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "simplifyPath(\"/home/\")", - "simplifyPath(\"/home//foo/\")", - "simplifyPath(\"/home/user/Documents/../Pictures\")", - "simplifyPath(\"/../\")", - "simplifyPath(\"/.../a/../b/c/../d/./\")" + "--arg1=\"/home/\"", + "--arg1=\"/home//foo/\"", + "--arg1=\"/home/user/Documents/../Pictures\"", + "--arg1=\"/../\"", + "--arg1=\"/.../a/../b/c/../d/./\"" ], "sample_test_results": [ "'/home'", @@ -2257,16 +2743,16 @@ "'/.../b/d'" ], "hidden_test_cases": [ - "simplifyPath(\"/a/./b/../../c/\")", - "simplifyPath(\"/home/\")", - "simplifyPath(\"/...\")", - "simplifyPath(\"/..hidden\")", - "simplifyPath(\"//\")", - "simplifyPath(\"/a//b////c/d//././/..\")", - "simplifyPath(\"/abc/...\")", - "simplifyPath(\"/a/./b/./c/./d/\")", - "simplifyPath(\"/a/../../b/../c//.//\")", - "simplifyPath(\"/a//b//./c/d/\")" + "--arg1=\"/a/./b/../../c/\"", + "--arg1=\"/home/\"", + "--arg1=\"/...\"", + "--arg1=\"/..hidden\"", + "--arg1=\"//\"", + "--arg1=\"/a//b////c/d//././/..\"", + "--arg1=\"/abc/...\"", + "--arg1=\"/a/./b/./c/./d/\"", + "--arg1=\"/a/../../b/../c//.//\"", + "--arg1=\"/a//b//./c/d/\"" ], "hidden_test_results": [ "'/c'", @@ -2280,8 +2766,17 @@ "'/c'", "'/a/b/c/d'" ], - "boilerplate": "class Solution:\n def simplifyPath(self, path: str) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def simplifyPath(self, path: str) -> str:\n ", + "java": "class Solution {\n public String simplifyPath(String path) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string simplifyPath(string path) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=qYlHrAKJfyA&pp=ygUWTmVldENvZGUgU2ltcGxpZnkgUGF0aA%3D%3D" }, { "title": "Edit Distance", @@ -2289,9 +2784,9 @@ "description": "

Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.

\n\n

You have the following three operations permitted on a word:

\n\n
    \n\t
  • Insert a character
  • \n\t
  • Delete a character
  • \n\t
  • Replace a character
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: word1 = "horse", word2 = "ros"\nOutput: 3\nExplanation: \nhorse -> rorse (replace 'h' with 'r')\nrorse -> rose (remove 'r')\nrose -> ros (remove 'e')\n
\n\n

Example 2:

\n\n
\nInput: word1 = "intention", word2 = "execution"\nOutput: 5\nExplanation: \nintention -> inention (remove 't')\ninention -> enention (replace 'i' with 'e')\nenention -> exention (replace 'n' with 'x')\nexention -> exection (replace 'n' with 'c')\nexection -> execution (insert 'u')\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= word1.length, word2.length <= 500
  • \n\t
  • word1 and word2 consist of lowercase English letters.
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "minDistance('horse', 'ros')", - "minDistance('intention', 'execution')", - "minDistance('', 'a')" + "--arg1='horse' --arg2='ros'", + "--arg1='intention' --arg2='execution'", + "--arg1='' --arg2='a'" ], "sample_test_results": [ "3", @@ -2299,16 +2794,16 @@ "1" ], "hidden_test_cases": [ - "minDistance('', '')", - "minDistance('a', '')", - "minDistance('abc', 'abc')", - "minDistance('abcde', 'ace')", - "minDistance('sea', 'eat')", - "minDistance('leetcode', 'practice')", - "minDistance('hello', 'world')", - "minDistance('pneumonoultramicroscopicsilicovolcanoconiosis', 'ultramicroscopically')", - "minDistance('abc', 'def')", - "minDistance('aaa', 'bbb')" + "--arg1='' --arg2=''", + "--arg1='a' --arg2=''", + "--arg1='abc' --arg2='abc'", + "--arg1='abcde' --arg2='ace'", + "--arg1='sea' --arg2='eat'", + "--arg1='leetcode' --arg2='practice'", + "--arg1='hello' --arg2='world'", + "--arg1='pneumonoultramicroscopicsilicovolcanoconiosis' --arg2='ultramicroscopically'", + "--arg1='abc' --arg2='def'", + "--arg1='aaa' --arg2='bbb'" ], "hidden_test_results": [ "0", @@ -2322,8 +2817,17 @@ "3", "3" ], - "boilerplate": "class Solution:\n def minDistance(self, word1: str, word2: str) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def minDistance(self, word1: str, word2: str) -> int:\n ", + "java": "class Solution {\n public int minDistance(String word1, String word2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int minDistance(string word1, string word2) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=XYi2-LPrwm4&pp=ygUWTmVldENvZGUgRWRpdCBEaXN0YW5jZQ%3D%3D" }, { "title": "Search a 2D Matrix", @@ -2331,9 +2835,9 @@ "description": "

You are given an m x n integer matrix matrix with the following two properties:

\n\n
    \n\t
  • Each row is sorted in non-decreasing order.
  • \n\t
  • The first integer of each row is greater than the last integer of the previous row.
  • \n
\n\n

Given an integer target, return true if target is in matrix or false otherwise.

\n\n

You must write a solution in O(log(m * n)) time complexity.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3\nOutput: true\n
\n\n

Example 2:

\n\"\"\n
\nInput: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == matrix.length
  • \n\t
  • n == matrix[i].length
  • \n\t
  • 1 <= m, n <= 100
  • \n\t
  • -104 <= matrix[i][j], target <= 104
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "searchMatrix([[1,3,5,7],[10,11,16,20],[23,30,34,60]], 3)", - "searchMatrix([[1,3,5,7],[10,11,16,20],[23,30,34,60]], 13)", - "searchMatrix([[1]], 1)" + "--arg1=[1,3,5,7 --arg2=10,11,16,20 --arg3=23,30,34,60 --arg4=] --arg5=3", + "--arg1=[1,3,5,7 --arg2=10,11,16,20 --arg3=23,30,34,60 --arg4=] --arg5=13", + "--arg1=[1 --arg2=] --arg3=1" ], "sample_test_results": [ "True", @@ -2341,16 +2845,16 @@ "True" ], "hidden_test_cases": [ - "searchMatrix([[1]], 2)", - "searchMatrix([[1,2,3]], 2)", - "searchMatrix([[1],[2],[3]], 2)", - "searchMatrix([[1,2],[3,4]], 4)", - "searchMatrix([[-10,-8],[15,20]], -8)", - "searchMatrix([[1,2,3,4],[5,6,7,8]], 6)", - "searchMatrix([[1,2,3],[4,5,6],[7,8,9]], 9)", - "searchMatrix([[1]], 0)", - "searchMatrix([[1,3,5]], 5)", - "searchMatrix([[1],[3],[5]], 3)" + "--arg1=[1 --arg2=] --arg3=2", + "--arg1=[1,2,3 --arg2=] --arg3=2", + "--arg1=[1 --arg2=2 --arg3=3 --arg4=] --arg5=2", + "--arg1=[1,2 --arg2=3,4 --arg3=] --arg4=4", + "--arg1=[-10,-8 --arg2=15,20 --arg3=] --arg4=-8", + "--arg1=[1,2,3,4 --arg2=5,6,7,8 --arg3=] --arg4=6", + "--arg1=[1,2,3 --arg2=4,5,6 --arg3=7,8,9 --arg4=] --arg5=9", + "--arg1=[1 --arg2=] --arg3=0", + "--arg1=[1,3,5 --arg2=] --arg3=5", + "--arg1=[1 --arg2=3 --arg3=5 --arg4=] --arg5=3" ], "hidden_test_results": [ "False", @@ -2364,8 +2868,17 @@ "True", "True" ], - "boilerplate": "class Solution:\n def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public boolean searchMatrix(List> matrix, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool searchMatrix(std::vector>& matrix, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) == std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" + }, + "explanation": "https://www.youtube.com/watch?v=Ber2pi2C0j0&pp=ygUbTmVldENvZGUgU2VhcmNoIGEgMkQgTWF0cml4" }, { "title": "Word Search", @@ -2373,9 +2886,9 @@ "description": "

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

\n\n

The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"\nOutput: true\n
\n\n

Example 2:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "SEE"\nOutput: true\n
\n\n

Example 3:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB"\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == board.length
  • \n\t
  • n = board[i].length
  • \n\t
  • 1 <= m, n <= 6
  • \n\t
  • 1 <= word.length <= 15
  • \n\t
  • board and word consists of only lowercase and uppercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you use search pruning to make your solution faster with a larger board?

\n", "difficulty": "medium", "sample_test_cases": [ - "exist([['A','B','C','E'],['S','F','C','S'],['A','D','E','E']], 'ABCCED')", - "exist([['A','B','C','E'],['S','F','C','S'],['A','D','E','E']], 'SEE')", - "exist([['A','B','C','E'],['S','F','C','S'],['A','D','E','E']], 'ABCB')" + "--arg1=['A','B','C','E' --arg2='S','F','C','S' --arg3='A','D','E','E' --arg4=] --arg5='ABCCED'", + "--arg1=['A','B','C','E' --arg2='S','F','C','S' --arg3='A','D','E','E' --arg4=] --arg5='SEE'", + "--arg1=['A','B','C','E' --arg2='S','F','C','S' --arg3='A','D','E','E' --arg4=] --arg5='ABCB'" ], "sample_test_results": [ "True", @@ -2383,16 +2896,16 @@ "False" ], "hidden_test_cases": [ - "exist([['A']], 'A')", - "exist([['A','B'],['C','D']], 'ABDC')", - "exist([['A','B']], 'BA')", - "exist([['A','B','C'],['D','E','F']], 'CBA')", - "exist([['A']], 'B')", - "exist([['A','A']], 'AAA')", - "exist([['A','B','C']], 'ABC')", - "exist([['A'],['B'],['C']], 'ABC')", - "exist([['A','B'],['C','D']], 'AC')", - "exist([['A','B','C'],['D','E','F'],['G','H','I']], 'ABCFIHG')" + "--arg1=['A' --arg2=] --arg3='A'", + "--arg1=['A','B' --arg2='C','D' --arg3=] --arg4='ABDC'", + "--arg1=['A','B' --arg2=] --arg3='BA'", + "--arg1=['A','B','C' --arg2='D','E','F' --arg3=] --arg4='CBA'", + "--arg1=['A' --arg2=] --arg3='B'", + "--arg1=['A','A' --arg2=] --arg3='AAA'", + "--arg1=['A','B','C' --arg2=] --arg3='ABC'", + "--arg1=['A' --arg2='B' --arg3='C' --arg4=] --arg5='ABC'", + "--arg1=['A','B' --arg2='C','D' --arg3=] --arg4='AC'", + "--arg1=['A','B','C' --arg2='D','E','F' --arg3='G','H','I' --arg4=] --arg5='ABCFIHG'" ], "hidden_test_results": [ "True", @@ -2406,8 +2919,17 @@ "True", "True" ], - "boilerplate": "class Solution:\n def exist(self, board: List[List[str]], word: str) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def exist(self, board: List[List[str]], word: str) -> bool:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public boolean exist(List> board, String word) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool exist(vector>& board, string word) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return toLowerCase(result) == toLowerCase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=pfiQ_PS1g8E&pp=ygUUTmVldENvZGUgV29yZCBTZWFyY2g%3D" }, { "title": "Subsets II", @@ -2415,41 +2937,50 @@ "description": "

Given an integer array nums that may contain duplicates, return all possible subsets (the power set).

\n\n

The solution set must not contain duplicate subsets. Return the solution in any order.

\n\n

 

\n

Example 1:

\n
Input: nums = [1,2,2]\nOutput: [[],[1],[1,2],[1,2,2],[2],[2,2]]\n

Example 2:

\n
Input: nums = [0]\nOutput: [[],[0]]\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 10
  • \n\t
  • -10 <= nums[i] <= 10
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "subsetsWithDup([1,2,2])", - "subsetsWithDup([0])", - "subsetsWithDup([1,1,1])" + "--arg1=1,2,2", + "--arg1=0", + "--arg1=1,1,1" ], "sample_test_results": [ - "[[], [1], [1, 2], [1, 2, 2], [2], [2, 2]]", - "[[], [0]]", - "[[], [1], [1, 1], [1, 1, 1]]" + "[], [1], [1, 2], [1, 2, 2], [2], [2, 2]", + "[], [0]", + "[], [1], [1, 1], [1, 1, 1]" ], "hidden_test_cases": [ - "subsetsWithDup([1])", - "subsetsWithDup([1,2])", - "subsetsWithDup([1,2,3])", - "subsetsWithDup([2,2,2,2])", - "subsetsWithDup([1,2,2,3])", - "subsetsWithDup([1,1,2,2])", - "subsetsWithDup([3,2,1])", - "subsetsWithDup([-1,0,1])", - "subsetsWithDup([0,0,0])", - "subsetsWithDup([4,4,4,1,4])" + "--arg1=1", + "--arg1=1,2", + "--arg1=1,2,3", + "--arg1=2,2,2,2", + "--arg1=1,2,2,3", + "--arg1=1,1,2,2", + "--arg1=3,2,1", + "--arg1=-1,0,1", + "--arg1=0,0,0", + "--arg1=4,4,4,1,4" ], "hidden_test_results": [ - "[[], [1]]", - "[[], [1], [1, 2], [2]]", - "[[], [1], [1, 2], [1, 2, 3], [1, 3], [2], [2, 3], [3]]", - "[[], [2], [2, 2], [2, 2, 2], [2, 2, 2, 2]]", - "[[], [1], [1, 2], [1, 2, 2], [1, 2, 2, 3], [1, 2, 3], [1, 3], [2], [2, 2], [2, 2, 3], [2, 3], [3]]", - "[[], [1], [1, 1], [1, 1, 2], [1, 1, 2, 2], [1, 2], [1, 2, 2], [2], [2, 2]]", - "[[], [1], [1, 2], [1, 2, 3], [1, 3], [2], [2, 3], [3]]", - "[[], [-1], [-1, 0], [-1, 0, 1], [-1, 1], [0], [0, 1], [1]]", - "[[], [0], [0, 0], [0, 0, 0]]", - "[[], [1], [1, 4], [1, 4, 4], [1, 4, 4, 4], [1, 4, 4, 4, 4], [4], [4, 4], [4, 4, 4], [4, 4, 4, 4]]" - ], - "boilerplate": "class Solution:\n def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:\n ", - "compare_func": "return sorted([sorted(x) for x in result]) == sorted(eval(expected))" + "[], [1]", + "[], [1], [1, 2], [2]", + "[], [1], [1, 2], [1, 2, 3], [1, 3], [2], [2, 3], [3]", + "[], [2], [2, 2], [2, 2, 2], [2, 2, 2, 2]", + "[], [1], [1, 2], [1, 2, 2], [1, 2, 2, 3], [1, 2, 3], [1, 3], [2], [2, 2], [2, 2, 3], [2, 3], [3]", + "[], [1], [1, 1], [1, 1, 2], [1, 1, 2, 2], [1, 2], [1, 2, 2], [2], [2, 2]", + "[], [1], [1, 2], [1, 2, 3], [1, 3], [2], [2, 3], [3]", + "[], [-1], [-1, 0], [-1, 0, 1], [-1, 1], [0], [0, 1], [1]", + "[], [0], [0, 0], [0, 0, 0]", + "[], [1], [1, 4], [1, 4, 4], [1, 4, 4, 4], [1, 4, 4, 4, 4], [4], [4, 4], [4, 4, 4], [4, 4, 4, 4]" + ], + "boilerplate": { + "python": "class Solution:\n def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:\n ", + "java": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nclass Solution {\n public List> subsetsWithDup(int[] nums) {\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector> subsetsWithDup(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted([sorted(x) for x in result]) == sorted(eval(expected))", + "java": "List> sortedResult = new ArrayList<>();\nfor (List list : result) {\n List sortedList = new ArrayList<>(list);\n Collections.sort(sortedList);\n sortedResult.add(sortedList);\n}\nCollections.sort(sortedResult, new Comparator>() {\n public int compare(List o1, List o2) {\n for (int i = 0; i < Math.min(o1.size(), o2.size()); i++) {\n if (!o1.get(i).equals(o2.get(i))) {\n return o1.get(i) - o2.get(i);\n }\n }\n return o1.size() - o2.size();\n }\n});\n\nList> sortedExpected = new ArrayList<>();\nfor (List list : expected) {\n List sortedList = new ArrayList<>(list);\n Collections.sort(sortedList);\n sortedExpected.add(sortedList);\n}\nCollections.sort(sortedExpected, new Comparator>() {\n public int compare(List o1, List o2) {\n for (int i = 0; i < Math.min(o1.size(), o2.size()); i++) {\n if (!o1.get(i).equals(o2.get(i))) {\n return o1.get(i) - o2.get(i);\n }\n }\n return o1.size() - o2.size();\n }\n});\n\nreturn sortedResult.equals(sortedExpected);", + "cpp": "vector> sortNestedVector(const vector> &vecs) {\n vector> sortedVecs = vecs;\n for (auto &vec : sortedVecs) {\n sort(vec.begin(), vec.end());\n }\n sort(sortedVecs.begin(), sortedVecs.end());\n return sortedVecs;\n}\n\nvector> evalExpected(const string &expected) {\n vector> evalVecs; // This needs to be implemented to match Python's eval behavior\n // Some parsing logic or a mock function would be here to convert `expected` to a vector of vectors\n return evalVecs;\n}\n\ncompareFunction(const vector> &result, const string &expected) {\n vector> sortedResult = sortNestedVector(result);\n vector> sortedExpected = sortNestedVector(evalExpected(expected));\n return sortedResult == sortedExpected;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=Vn2v6ajA7U0&pp=ygUTTmVldENvZGUgU3Vic2V0cyBJSQ%3D%3D" }, { "title": "Restore IP Addresses", @@ -2457,41 +2988,50 @@ "description": "

A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclusive) and cannot have leading zeros.

\n\n
    \n\t
  • For example, "0.1.2.201" and "192.168.1.1" are valid IP addresses, but "0.011.255.245", "192.168.1.312" and "192.168@1.1" are invalid IP addresses.
  • \n
\n\n

Given a string s containing only digits, return all possible valid IP addresses that can be formed by inserting dots into s. You are not allowed to reorder or remove any digits in s. You may return the valid IP addresses in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "25525511135"\nOutput: ["255.255.11.135","255.255.111.35"]\n
\n\n

Example 2:

\n\n
\nInput: s = "0000"\nOutput: ["0.0.0.0"]\n
\n\n

Example 3:

\n\n
\nInput: s = "101023"\nOutput: ["1.0.10.23","1.0.102.3","10.1.0.23","10.10.2.3","101.0.2.3"]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 20
  • \n\t
  • s consists of digits only.
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "restoreIpAddresses('25525511135')", - "restoreIpAddresses('0000')", - "restoreIpAddresses('101023')" + "--arg1='25525511135'", + "--arg1='0000'", + "--arg1='101023'" ], "sample_test_results": [ - "['255.255.11.135', '255.255.111.35']", - "['0.0.0.0']", - "['1.0.10.23', '1.0.102.3', '10.1.0.23', '10.10.2.3', '101.0.2.3']" + "'255.255.11.135', '255.255.111.35'", + "'0.0.0.0'", + "'1.0.10.23', '1.0.102.3', '10.1.0.23', '10.10.2.3', '101.0.2.3'" ], "hidden_test_cases": [ - "restoreIpAddresses('1111')", - "restoreIpAddresses('010010')", - "restoreIpAddresses('0')", - "restoreIpAddresses('999999')", - "restoreIpAddresses('1921680')", - "restoreIpAddresses('2552551113')", - "restoreIpAddresses('00001')", - "restoreIpAddresses('100100')", - "restoreIpAddresses('12345')", - "restoreIpAddresses('1111111')" + "--arg1='1111'", + "--arg1='010010'", + "--arg1='0'", + "--arg1='999999'", + "--arg1='1921680'", + "--arg1='2552551113'", + "--arg1='00001'", + "--arg1='100100'", + "--arg1='12345'", + "--arg1='1111111'" ], "hidden_test_results": [ - "['1.1.1.1']", - "['0.10.0.10', '0.100.1.0']", - "[]", - "['9.9.99.99', '9.99.9.99', '9.99.99.9', '99.9.9.99', '99.9.99.9', '99.99.9.9']", - "['1.9.216.80', '1.92.16.80', '1.92.168.0', '19.2.16.80', '19.2.168.0', '19.21.6.80', '19.21.68.0', '19.216.8.0', '192.1.6.80', '192.1.68.0', '192.16.8.0']", - "['255.25.51.113', '255.255.1.113', '255.255.11.13', '255.255.111.3']", - "[]", - "['1.0.0.100', '10.0.10.0', '100.1.0.0']", - "['1.2.3.45', '1.2.34.5', '1.23.4.5', '12.3.4.5']", - "['1.1.11.111', '1.1.111.11', '1.11.1.111', '1.11.11.11', '1.11.111.1', '1.111.1.11', '1.111.11.1', '11.1.1.111', '11.1.11.11', '11.1.111.1', '11.11.1.11', '11.11.11.1', '11.111.1.1', '111.1.1.11', '111.1.11.1', '111.11.1.1']" - ], - "boilerplate": "class Solution:\n def restoreIpAddresses(self, s: str) -> List[str]:\n ", - "compare_func": "return sorted(result) == sorted(eval(expected))" + "'1.1.1.1'", + "'0.10.0.10', '0.100.1.0'", + "", + "'9.9.99.99', '9.99.9.99', '9.99.99.9', '99.9.9.99', '99.9.99.9', '99.99.9.9'", + "'1.9.216.80', '1.92.16.80', '1.92.168.0', '19.2.16.80', '19.2.168.0', '19.21.6.80', '19.21.68.0', '19.216.8.0', '192.1.6.80', '192.1.68.0', '192.16.8.0'", + "'255.25.51.113', '255.255.1.113', '255.255.11.13', '255.255.111.3'", + "", + "'1.0.0.100', '10.0.10.0', '100.1.0.0'", + "'1.2.3.45', '1.2.34.5', '1.23.4.5', '12.3.4.5'", + "'1.1.11.111', '1.1.111.11', '1.11.1.111', '1.11.11.11', '1.11.111.1', '1.111.1.11', '1.111.11.1', '11.1.1.111', '11.1.11.11', '11.1.111.1', '11.11.1.11', '11.11.11.1', '11.111.1.1', '111.1.1.11', '111.1.11.1', '111.11.1.1'" + ], + "boilerplate": { + "python": "class Solution:\n def restoreIpAddresses(self, s: str) -> List[str]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List restoreIpAddresses(String s) {\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector restoreIpAddresses(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray())", + "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedSorted = eval(expected);\nstd::sort(expectedSorted.begin(), expectedSorted.end());\nreturn result == expectedSorted;" + }, + "explanation": "https://www.youtube.com/watch?v=61tN4YEdiTM&pp=ygUdTmVldENvZGUgUmVzdG9yZSBJUCBBZGRyZXNzZXM%3D" }, { "title": "Interleaving String", @@ -2499,9 +3039,9 @@ "description": "

Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2.

\n\n

An interleaving of two strings s and t is a configuration where s and t are divided into n and m substrings respectively, such that:

\n\n
    \n\t
  • s = s1 + s2 + ... + sn
  • \n\t
  • t = t1 + t2 + ... + tm
  • \n\t
  • |n - m| <= 1
  • \n\t
  • The interleaving is s1 + t1 + s2 + t2 + s3 + t3 + ... or t1 + s1 + t2 + s2 + t3 + s3 + ...
  • \n
\n\n

Note: a + b is the concatenation of strings a and b.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"\nOutput: true\nExplanation: One way to obtain s3 is:\nSplit s1 into s1 = "aa" + "bc" + "c", and s2 into s2 = "dbbc" + "a".\nInterleaving the two splits, we get "aa" + "dbbc" + "bc" + "a" + "c" = "aadbbcbcac".\nSince s3 can be obtained by interleaving s1 and s2, we return true.\n
\n\n

Example 2:

\n\n
\nInput: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc"\nOutput: false\nExplanation: Notice how it is impossible to interleave s2 with any other string to obtain s3.\n
\n\n

Example 3:

\n\n
\nInput: s1 = "", s2 = "", s3 = ""\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s1.length, s2.length <= 100
  • \n\t
  • 0 <= s3.length <= 200
  • \n\t
  • s1, s2, and s3 consist of lowercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you solve it using only O(s2.length) additional memory space?

\n", "difficulty": "medium", "sample_test_cases": [ - "isInterleave('aabcc', 'dbbca', 'aadbbcbcac')", - "isInterleave('aabcc', 'dbbca', 'aadbbbaccc')", - "isInterleave('', '', '')" + "--arg1='aabcc' --arg2='dbbca' --arg3='aadbbcbcac'", + "--arg1='aabcc' --arg2='dbbca' --arg3='aadbbbaccc'", + "--arg1='' --arg2='' --arg3=''" ], "sample_test_results": [ "True", @@ -2509,16 +3049,16 @@ "True" ], "hidden_test_cases": [ - "isInterleave('abc', 'def', 'adbecf')", - "isInterleave('a', 'b', 'ab')", - "isInterleave('a', 'b', 'ba')", - "isInterleave('aa', 'ab', 'aaba')", - "isInterleave('aaa', 'bbb', 'ababab')", - "isInterleave('', 'abc', 'abc')", - "isInterleave('abc', '', 'abc')", - "isInterleave('abc', 'def', 'abcdef')", - "isInterleave('aaa', 'aaa', 'aaaaaa')", - "isInterleave('abc', 'def', 'abcef')" + "--arg1='abc' --arg2='def' --arg3='adbecf'", + "--arg1='a' --arg2='b' --arg3='ab'", + "--arg1='a' --arg2='b' --arg3='ba'", + "--arg1='aa' --arg2='ab' --arg3='aaba'", + "--arg1='aaa' --arg2='bbb' --arg3='ababab'", + "--arg1='' --arg2='abc' --arg3='abc'", + "--arg1='abc' --arg2='' --arg3='abc'", + "--arg1='abc' --arg2='def' --arg3='abcdef'", + "--arg1='aaa' --arg2='aaa' --arg3='aaaaaa'", + "--arg1='abc' --arg2='def' --arg3='abcef'" ], "hidden_test_results": [ "True", @@ -2532,8 +3072,17 @@ "True", "False" ], - "boilerplate": "class Solution:\n def isInterleave(self, s1: str, s2: str, s3: str) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def isInterleave(self, s1: str, s2: str, s3: str) -> bool:\n ", + "java": "class Solution {\n public boolean isInterleave(String s1, String s2, String s3) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isInterleave(string s1, string s2, string s3) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return to_lowercase(result) == to_lowercase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=3Rw3p9LrgvE&pp=ygUcTmVldENvZGUgSW50ZXJsZWF2aW5nIFN0cmluZw%3D%3D" }, { "title": "Triangle", @@ -2541,24 +3090,24 @@ "description": "

Given a triangle array, return the minimum path sum from top to bottom.

\n\n

For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i + 1 on the next row.

\n\n

 

\n

Example 1:

\n\n
\nInput: triangle = [[2],[3,4],[6,5,7],[4,1,8,3]]\nOutput: 11\nExplanation: The triangle looks like:\n   2\n  3 4\n 6 5 7\n4 1 8 3\nThe minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11 (underlined above).\n
\n\n

Example 2:

\n\n
\nInput: triangle = [[-10]]\nOutput: -10\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= triangle.length <= 200
  • \n\t
  • triangle[0].length == 1
  • \n\t
  • triangle[i].length == triangle[i - 1].length + 1
  • \n\t
  • -104 <= triangle[i][j] <= 104
  • \n
\n\n

 

\nFollow up: Could you do this using only O(n) extra space, where n is the total number of rows in the triangle?", "difficulty": "medium", "sample_test_cases": [ - "minimumTotal([[2],[3,4],[6,5,7],[4,1,8,3]])", - "minimumTotal([[-10]])" + "--arg1=[2 --arg2=3,4 --arg3=6,5,7 --arg4=4,1,8,3 --arg5=]", + "--arg1=[-10 --arg2=]" ], "sample_test_results": [ "11", "-10" ], "hidden_test_cases": [ - "minimumTotal([[1]])", - "minimumTotal([[1],[2,3]])", - "minimumTotal([[-1],[2,3],[1,-1,3]])", - "minimumTotal([[1],[1,2],[1,2,3],[1,2,3,4]])", - "minimumTotal([[0],[-1,2],[1,-2,3],[-3,1,-1,2]])", - "minimumTotal([[1],[-5,2],[2,-1,3],[1,2,-4,5]])", - "minimumTotal([[0],[0,0],[0,0,0]])", - "minimumTotal([[1],[-1,-2],[3,-3,1],[-4,5,-6,2]])", - "minimumTotal([[10],[-2,-3],[1,2,-1]])", - "minimumTotal([[1],[2,1],[3,3,1]])" + "--arg1=[1 --arg2=]", + "--arg1=[1 --arg2=2,3 --arg3=]", + "--arg1=[-1 --arg2=2,3 --arg3=1,-1,3 --arg4=]", + "--arg1=[1 --arg2=1,2 --arg3=1,2,3 --arg4=1,2,3,4 --arg5=]", + "--arg1=[0 --arg2=-1,2 --arg3=1,-2,3 --arg4=-3,1,-1,2 --arg5=]", + "--arg1=[1 --arg2=-5,2 --arg3=2,-1,3 --arg4=1,2,-4,5 --arg5=]", + "--arg1=[0 --arg2=0,0 --arg3=0,0,0 --arg4=]", + "--arg1=[1 --arg2=-1,-2 --arg3=3,-3,1 --arg4=-4,5,-6,2 --arg5=]", + "--arg1=[10 --arg2=-2,-3 --arg3=1,2,-1 --arg4=]", + "--arg1=[1 --arg2=2,1 --arg3=3,3,1 --arg4=]" ], "hidden_test_results": [ "1", @@ -2572,8 +3121,17 @@ "6", "3" ], - "boilerplate": "class Solution:\n def minimumTotal(self, triangle: List[List[int]]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def minimumTotal(self, triangle: List[List[int]]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int minimumTotal(List> triangle) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int minimumTotal(vector>& triangle) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=OM1MTokvxs4&pp=ygURTmVldENvZGUgVHJpYW5nbGU%3D" }, { "title": "Longest Consecutive Sequence", @@ -2581,24 +3139,24 @@ "description": "

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.

\n\n

You must write an algorithm that runs in O(n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [100,4,200,1,3,2]\nOutput: 4\nExplanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,3,7,2,5,8,4,6,0,1]\nOutput: 9\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "longestConsecutive([100,4,200,1,3,2])", - "longestConsecutive([0,3,7,2,5,8,4,6,0,1])" + "--arg1=100,4,200,1,3,2", + "--arg1=0,3,7,2,5,8,4,6,0,1" ], "sample_test_results": [ "4", "9" ], "hidden_test_cases": [ - "longestConsecutive([])", - "longestConsecutive([1])", - "longestConsecutive([1,2,3,4,5])", - "longestConsecutive([1,3,5,7,9])", - "longestConsecutive([-5,-4,-3,-2,-1])", - "longestConsecutive([1,1,1,1,1])", - "longestConsecutive([1,2,0,1])", - "longestConsecutive([0,-1,2,-2,3,-3])", - "longestConsecutive([1000,1,2,3,4,999])", - "longestConsecutive([5,4,3,2,1,6,7,8,9])" + "--arg1=", + "--arg1=1", + "--arg1=1,2,3,4,5", + "--arg1=1,3,5,7,9", + "--arg1=-5,-4,-3,-2,-1", + "--arg1=1,1,1,1,1", + "--arg1=1,2,0,1", + "--arg1=0,-1,2,-2,3,-3", + "--arg1=1000,1,2,3,4,999", + "--arg1=5,4,3,2,1,6,7,8,9" ], "hidden_test_results": [ "0", @@ -2612,8 +3170,17 @@ "4", "9" ], - "boilerplate": "class Solution:\n def longestConsecutive(self, nums: List[int]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def longestConsecutive(self, nums: List[int]) -> int:\n ", + "java": "import java.util.List;\nimport java.util.HashSet;\n\nclass Solution {\n public int longestConsecutive(List nums) {\n \n }\n}", + "cpp": "#include \n#include \n\nclass Solution {\npublic:\n int longestConsecutive(std::vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=P6RZZMu_maU&pp=ygUlTmVldENvZGUgTG9uZ2VzdCBDb25zZWN1dGl2ZSBTZXF1ZW5jZQ%3D%3D" }, { "title": "Gas Station", @@ -2621,24 +3188,24 @@ "description": "

There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i].

\n\n

You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from the ith station to its next (i + 1)th station. You begin the journey with an empty tank at one of the gas stations.

\n\n

Given two integer arrays gas and cost, return the starting gas station's index if you can travel around the circuit once in the clockwise direction, otherwise return -1. If there exists a solution, it is guaranteed to be unique.

\n\n

 

\n

Example 1:

\n\n
\nInput: gas = [1,2,3,4,5], cost = [3,4,5,1,2]\nOutput: 3\nExplanation:\nStart at station 3 (index 3) and fill up with 4 unit of gas. Your tank = 0 + 4 = 4\nTravel to station 4. Your tank = 4 - 1 + 5 = 8\nTravel to station 0. Your tank = 8 - 2 + 1 = 7\nTravel to station 1. Your tank = 7 - 3 + 2 = 6\nTravel to station 2. Your tank = 6 - 4 + 3 = 5\nTravel to station 3. The cost is 5. Your gas is just enough to travel back to station 3.\nTherefore, return 3 as the starting index.\n
\n\n

Example 2:

\n\n
\nInput: gas = [2,3,4], cost = [3,4,3]\nOutput: -1\nExplanation:\nYou can't start at station 0 or 1, as there is not enough gas to travel to the next station.\nLet's start at station 2 and fill up with 4 unit of gas. Your tank = 0 + 4 = 4\nTravel to station 0. Your tank = 4 - 3 + 2 = 3\nTravel to station 1. Your tank = 3 - 3 + 3 = 3\nYou cannot travel back to station 2, as it requires 4 unit of gas but you only have 3.\nTherefore, you can't travel around the circuit once no matter where you start.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == gas.length == cost.length
  • \n\t
  • 1 <= n <= 105
  • \n\t
  • 0 <= gas[i], cost[i] <= 104
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "canCompleteCircuit([1,2,3,4,5], [3,4,5,1,2])", - "canCompleteCircuit([2,3,4], [3,4,3])" + "--arg1=1,2,3,4,5 --arg2=[3 --arg3=4 --arg4=5 --arg5=1 --arg6=2]", + "--arg1=2,3,4 --arg2=[3 --arg3=4 --arg4=3]" ], "sample_test_results": [ "3", "-1" ], "hidden_test_cases": [ - "canCompleteCircuit([1], [1])", - "canCompleteCircuit([2], [1])", - "canCompleteCircuit([1,2], [2,1])", - "canCompleteCircuit([5,1,2,3,4], [4,4,1,5,1])", - "canCompleteCircuit([4,5,2,6,5,3], [3,2,7,3,2,9])", - "canCompleteCircuit([1,2,3], [2,3,1])", - "canCompleteCircuit([3,1,1], [1,2,2])", - "canCompleteCircuit([5,8,2,8], [6,5,6,6])", - "canCompleteCircuit([1,1,1], [1,1,1])", - "canCompleteCircuit([2,0,1], [1,1,1])" + "--arg1=1 --arg2=1", + "--arg1=2 --arg2=1", + "--arg1=1,2 --arg2=[2 --arg3=1]", + "--arg1=5,1,2,3,4 --arg2=[4 --arg3=4 --arg4=1 --arg5=5 --arg6=1]", + "--arg1=4,5,2,6,5,3 --arg2=[3 --arg3=2 --arg4=7 --arg5=3 --arg6=2 --arg7=9]", + "--arg1=1,2,3 --arg2=[2 --arg3=3 --arg4=1]", + "--arg1=3,1,1 --arg2=[1 --arg3=2 --arg4=2]", + "--arg1=5,8,2,8 --arg2=[6 --arg3=5 --arg4=6 --arg5=6]", + "--arg1=1,1,1 --arg2=[1 --arg3=1 --arg4=1]", + "--arg1=2,0,1 --arg2=[1 --arg3=1 --arg4=1]" ], "hidden_test_results": [ "0", @@ -2652,8 +3219,17 @@ "0", "0" ], - "boilerplate": "class Solution:\n def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:\n ", + "java": "class Solution {\n public int canCompleteCircuit(int[] gas, int[] cost) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int canCompleteCircuit(vector& gas, vector& cost) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result != null && result.toString().equals(expected);", + "cpp": "std::string compareFunction(const std::string &result, const std::string &expected) {\n return result == expected;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=lJwbPZGo05A&pp=ygUUTmVldENvZGUgR2FzIFN0YXRpb24%3D" }, { "title": "Word Break", @@ -2661,9 +3237,9 @@ "description": "

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

\n\n

Note that the same word in the dictionary may be reused multiple times in the segmentation.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "leetcode", wordDict = ["leet","code"]\nOutput: true\nExplanation: Return true because "leetcode" can be segmented as "leet code".\n
\n\n

Example 2:

\n\n
\nInput: s = "applepenapple", wordDict = ["apple","pen"]\nOutput: true\nExplanation: Return true because "applepenapple" can be segmented as "apple pen apple".\nNote that you are allowed to reuse a dictionary word.\n
\n\n

Example 3:

\n\n
\nInput: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"]\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 300
  • \n\t
  • 1 <= wordDict.length <= 1000
  • \n\t
  • 1 <= wordDict[i].length <= 20
  • \n\t
  • s and wordDict[i] consist of only lowercase English letters.
  • \n\t
  • All the strings of wordDict are unique.
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "wordBreak('leetcode', ['leet','code'])", - "wordBreak('applepenapple', ['apple','pen'])", - "wordBreak('catsandog', ['cats','dog','sand','and','cat'])" + "--arg1='leetcode' --arg2=['leet' --arg3='code']", + "--arg1='applepenapple' --arg2=['apple' --arg3='pen']", + "--arg1='catsandog' --arg2=['cats' --arg3='dog' --arg4='sand' --arg5='and' --arg6='cat']" ], "sample_test_results": [ "True", @@ -2671,16 +3247,16 @@ "False" ], "hidden_test_cases": [ - "wordBreak('a', ['a'])", - "wordBreak('ab', ['a','b'])", - "wordBreak('cars', ['car','ca','rs'])", - "wordBreak('goalspecial', ['go','goal','goals','special'])", - "wordBreak('aaaaaaa', ['aaa','aaaa'])", - "wordBreak('impossible', ['imp','possible'])", - "wordBreak('python', ['py','thon'])", - "wordBreak('abcd', ['ab','abc','cd','abcd'])", - "wordBreak('helloworld', ['hello','world','hell','or'])", - "wordBreak('noway', ['no','way','now','ay'])" + "--arg1='a' --arg2='a'", + "--arg1='ab' --arg2=['a' --arg3='b']", + "--arg1='cars' --arg2=['car' --arg3='ca' --arg4='rs']", + "--arg1='goalspecial' --arg2=['go' --arg3='goal' --arg4='goals' --arg5='special']", + "--arg1='aaaaaaa' --arg2=['aaa' --arg3='aaaa']", + "--arg1='impossible' --arg2=['imp' --arg3='possible']", + "--arg1='python' --arg2=['py' --arg3='thon']", + "--arg1='abcd' --arg2=['ab' --arg3='abc' --arg4='cd' --arg5='abcd']", + "--arg1='helloworld' --arg2=['hello' --arg3='world' --arg4='hell' --arg5='or']", + "--arg1='noway' --arg2=['no' --arg3='way' --arg4='now' --arg5='ay']" ], "hidden_test_results": [ "True", @@ -2694,8 +3270,17 @@ "True", "True" ], - "boilerplate": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> bool:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public boolean wordBreak(String s, List wordDict) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool wordBreak(std::string s, std::vector& wordDict) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Sx9NNgInc3A&pp=ygUTTmVldENvZGUgV29yZCBCcmVhaw%3D%3D" }, { "title": "Evaluate Reverse Polish Notation", @@ -2703,9 +3288,9 @@ "description": "

You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation.

\n\n

Evaluate the expression. Return an integer that represents the value of the expression.

\n\n

Note that:

\n\n
    \n\t
  • The valid operators are '+', '-', '*', and '/'.
  • \n\t
  • Each operand may be an integer or another expression.
  • \n\t
  • The division between two integers always truncates toward zero.
  • \n\t
  • There will not be any division by zero.
  • \n\t
  • The input represents a valid arithmetic expression in a reverse polish notation.
  • \n\t
  • The answer and all the intermediate calculations can be represented in a 32-bit integer.
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: tokens = ["2","1","+","3","*"]\nOutput: 9\nExplanation: ((2 + 1) * 3) = 9\n
\n\n

Example 2:

\n\n
\nInput: tokens = ["4","13","5","/","+"]\nOutput: 6\nExplanation: (4 + (13 / 5)) = 6\n
\n\n

Example 3:

\n\n
\nInput: tokens = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"]\nOutput: 22\nExplanation: ((10 * (6 / ((9 + 3) * -11))) + 17) + 5\n= ((10 * (6 / (12 * -11))) + 17) + 5\n= ((10 * (6 / -132)) + 17) + 5\n= ((10 * 0) + 17) + 5\n= (0 + 17) + 5\n= 17 + 5\n= 22\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= tokens.length <= 104
  • \n\t
  • tokens[i] is either an operator: "+", "-", "*", or "/", or an integer in the range [-200, 200].
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "evalRPN([\"2\",\"1\",\"+\",\"3\",\"*\"])", - "evalRPN([\"4\",\"13\",\"5\",\"/\",\"+\"])", - "evalRPN([\"10\",\"6\",\"9\",\"3\",\"+\",\"-11\",\"*\",\"/\",\"*\",\"17\",\"+\",\"5\",\"+\"])" + "--arg1=\"2\",\"1\",\"+\",\"3\",\"*\"", + "--arg1=\"4\",\"13\",\"5\",\"/\",\"+\"", + "--arg1=\"10\",\"6\",\"9\",\"3\",\"+\",\"-11\",\"*\",\"/\",\"*\",\"17\",\"+\",\"5\",\"+\"" ], "sample_test_results": [ "9", @@ -2713,16 +3298,16 @@ "22" ], "hidden_test_cases": [ - "evalRPN([\"1\"])", - "evalRPN([\"2\",\"3\",\"+\"])", - "evalRPN([\"4\",\"5\",\"*\"])", - "evalRPN([\"10\",\"5\",\"/\"])", - "evalRPN([\"15\",\"7\",\"-\"])", - "evalRPN([\"2\",\"1\",\"3\",\"*\",\"+\"])", - "evalRPN([\"-2\",\"3\",\"*\",\"4\",\"+\"])", - "evalRPN([\"10\",\"2\",\"*\",\"3\",\"4\",\"*\",\"+\"])", - "evalRPN([\"5\",\"3\",\"/\",\"2\",\"*\"])", - "evalRPN([\"100\",\"200\",\"+\",\"2\",\"/\"])" + "--arg1=\"1\"", + "--arg1=\"2\",\"3\",\"+\"", + "--arg1=\"4\",\"5\",\"*\"", + "--arg1=\"10\",\"5\",\"/\"", + "--arg1=\"15\",\"7\",\"-\"", + "--arg1=\"2\",\"1\",\"3\",\"*\",\"+\"", + "--arg1=\"-2\",\"3\",\"*\",\"4\",\"+\"", + "--arg1=\"10\",\"2\",\"*\",\"3\",\"4\",\"*\",\"+\"", + "--arg1=\"5\",\"3\",\"/\",\"2\",\"*\"", + "--arg1=\"100\",\"200\",\"+\",\"2\",\"/\"" ], "hidden_test_results": [ "1", @@ -2736,8 +3321,17 @@ "2", "150" ], - "boilerplate": "class Solution:\n def evalRPN(self, tokens: List[str]) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def evalRPN(self, tokens: List[str]) -> int:\n ", + "java": "import java.util.List;\nimport java.util.Stack;\n\nclass Solution {\n public int evalRPN(List tokens) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int evalRPN(vector& tokens) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return stoi(result) == stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=iu0082c4HDE&pp=ygUpTmVldENvZGUgRXZhbHVhdGUgUmV2ZXJzZSBQb2xpc2ggTm90YXRpb24%3D" }, { "title": "Reverse Words in a String", @@ -2745,9 +3339,9 @@ "description": "

Given an input string s, reverse the order of the words.

\n\n

A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space.

\n\n

Return a string of the words in reverse order concatenated by a single space.

\n\n

Note that s may contain leading or trailing spaces or multiple spaces between two words. The returned string should only have a single space separating the words. Do not include any extra spaces.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "the sky is blue"\nOutput: "blue is sky the"\n
\n\n

Example 2:

\n\n
\nInput: s = "  hello world  "\nOutput: "world hello"\nExplanation: Your reversed string should not contain leading or trailing spaces.\n
\n\n

Example 3:

\n\n
\nInput: s = "a good   example"\nOutput: "example good a"\nExplanation: You need to reduce multiple spaces between two words to a single space in the reversed string.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s contains English letters (upper-case and lower-case), digits, and spaces ' '.
  • \n\t
  • There is at least one word in s.
  • \n
\n\n

 

\n

Follow-up: If the string data type is mutable in your language, can you solve it in-place with O(1) extra space?

\n", "difficulty": "medium", "sample_test_cases": [ - "reverseWords(\"the sky is blue\")", - "reverseWords(\" hello world \")", - "reverseWords(\"a good example\")" + "--arg1=\"the sky is blue\"", + "--arg1=\" hello world \"", + "--arg1=\"a good example\"" ], "sample_test_results": [ "'blue is sky the'", @@ -2755,16 +3349,16 @@ "'example good a'" ], "hidden_test_cases": [ - "reverseWords(\"hello\")", - "reverseWords(\" spaces \")", - "reverseWords(\"first second third\")", - "reverseWords(\" multiple spaces here \")", - "reverseWords(\"1 2 3 4 5\")", - "reverseWords(\"a\")", - "reverseWords(\" start end \")", - "reverseWords(\"comma,no space\")", - "reverseWords(\"mixed Case woRDs\")", - "reverseWords(\" lots of spaces \")" + "--arg1=\"hello\"", + "--arg1=\" spaces \"", + "--arg1=\"first second third\"", + "--arg1=\" multiple spaces here \"", + "--arg1=\"1 2 3 4 5\"", + "--arg1=\"a\"", + "--arg1=\" start end \"", + "--arg1=\"comma --arg2=no space\"", + "--arg1=\"mixed Case woRDs\"", + "--arg1=\" lots of spaces \"" ], "hidden_test_results": [ "'hello'", @@ -2778,8 +3372,17 @@ "'woRDs Case mixed'", "'spaces of lots'" ], - "boilerplate": "class Solution:\n def reverseWords(self, s: str) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def reverseWords(self, s: str) -> str:\n ", + "java": "class Solution {\n public String reverseWords(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string reverseWords(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=7kUEwiwwnlA&pp=ygUiTmVldENvZGUgUmV2ZXJzZSBXb3JkcyBpbiBhIFN0cmluZw%3D%3D" }, { "title": "Find Minimum in Rotated Sorted Array", @@ -2787,9 +3390,9 @@ "description": "

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:

\n\n
    \n\t
  • [4,5,6,7,0,1,2] if it was rotated 4 times.
  • \n\t
  • [0,1,2,4,5,6,7] if it was rotated 7 times.
  • \n
\n\n

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

\n\n

Given the sorted rotated array nums of unique elements, return the minimum element of this array.

\n\n

You must write an algorithm that runs in O(log n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [3,4,5,1,2]\nOutput: 1\nExplanation: The original array was [1,2,3,4,5] rotated 3 times.\n
\n\n

Example 2:

\n\n
\nInput: nums = [4,5,6,7,0,1,2]\nOutput: 0\nExplanation: The original array was [0,1,2,4,5,6,7] and it was rotated 4 times.\n
\n\n

Example 3:

\n\n
\nInput: nums = [11,13,15,17]\nOutput: 11\nExplanation: The original array was [11,13,15,17] and it was rotated 4 times. \n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == nums.length
  • \n\t
  • 1 <= n <= 5000
  • \n\t
  • -5000 <= nums[i] <= 5000
  • \n\t
  • All the integers of nums are unique.
  • \n\t
  • nums is sorted and rotated between 1 and n times.
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "findMin([3,4,5,1,2])", - "findMin([4,5,6,7,0,1,2])", - "findMin([11,13,15,17])" + "--arg1=3,4,5,1,2", + "--arg1=4,5,6,7,0,1,2", + "--arg1=11,13,15,17" ], "sample_test_results": [ "1", @@ -2797,16 +3400,16 @@ "11" ], "hidden_test_cases": [ - "findMin([45, 19, 22, 27, 32, 36, 41])", - "findMin([-29])", - "findMin([29, 30, 35, 38, 41, 46, 50, 54, 59, 61, 63, 68, 20, 22, 26])", - "findMin([56, 16, 19, 23, 26, 31, 34, 35, 36, 37, 41, 44, 46, 49, 51])", - "findMin([11, 16, 19, 21, 26, 30, 35, 37, 41, -3, -2, 0, 5, 6, 7])", - "findMin([43, 47, 29, 30, 35, 40, 41])", - "findMin([14, 19, 20, 25, 28, 29, -1, 2, 6, 9])", - "findMin([14, 19, 20, 25, 28, 29, -1, 2, 6, 9])", - "findMin([31, 33, 29, 30])", - "findMin([47, 48, 52, 14, 18, 23, 26, 29, 34, 39, 44])" + "--arg1=45,19,22,27,32,36,41", + "--arg1=-29", + "--arg1=29,30,35,38,41,46,50,54,59,61,63,68,20,22,26", + "--arg1=56,16,19,23,26,31,34,35,36,37,41,44,46,49,51", + "--arg1=11,16,19,21,26,30,35,37,41,-3,-2,0,5,6,7", + "--arg1=43,47,29,30,35,40,41", + "--arg1=14,19,20,25,28,29,-1,2,6,9", + "--arg1=14,19,20,25,28,29,-1,2,6,9", + "--arg1=31,33,29,30", + "--arg1=47,48,52,14,18,23,26,29,34,39,44" ], "hidden_test_results": [ "19", @@ -2820,8 +3423,17 @@ "29", "14" ], - "boilerplate": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int findMin(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findMin(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=nIVW4P8b1VA&pp=ygUtTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5" }, { "title": "Find Peak Element", @@ -2829,24 +3441,24 @@ "description": "

A peak element is an element that is strictly greater than its neighbors.

\n\n

Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks.

\n\n

You may imagine that nums[-1] = nums[n] = -∞. In other words, an element is always considered to be strictly greater than a neighbor that is outside the array.

\n\n

You must write an algorithm that runs in O(log n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,3,1]\nOutput: 2\nExplanation: 3 is a peak element and your function should return the index number 2.
\n\n

Example 2:

\n\n
\nInput: nums = [1,2,1,3,5,6,4]\nOutput: 5\nExplanation: Your function can return either index number 1 where the peak element is 2, or index number 5 where the peak element is 6.
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 1000
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n\t
  • nums[i] != nums[i + 1] for all valid i.
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "findPeakElement([1,2,3,1])", - "findPeakElement([1,2,1,3,5,6,4])" + "--arg1=1,2,3,1", + "--arg1=1,2,1,3,5,6,4" ], "sample_test_results": [ "2", "5" ], "hidden_test_cases": [ - "findPeakElement([1])", - "findPeakElement([1,2])", - "findPeakElement([2,1])", - "findPeakElement([1,2,3])", - "findPeakElement([3,2,1])", - "findPeakElement([1,3,2,4,5])", - "findPeakElement([5,4,3,2,1])", - "findPeakElement([1,5,3,7,4])", - "findPeakElement([1,2,3,4,3])", - "findPeakElement([3,1,4,5,2])" + "--arg1=1", + "--arg1=1,2", + "--arg1=2,1", + "--arg1=1,2,3", + "--arg1=3,2,1", + "--arg1=1,3,2,4,5", + "--arg1=5,4,3,2,1", + "--arg1=1,5,3,7,4", + "--arg1=1,2,3,4,3", + "--arg1=3,1,4,5,2" ], "hidden_test_results": [ "0", @@ -2860,8 +3472,17 @@ "3", "3" ], - "boilerplate": "class Solution:\n def findPeakElement(self, nums: List[int]) -> int:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def findPeakElement(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int findPeakElement(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findPeakElement(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "import java.util.function.Function;\n\npublic class Solution {\n public static boolean compareFunction(String result, Function evalFunction, String expected) {\n try {\n return result.equals(evalFunction.apply(expected).toString());\n } catch (Exception e) {\n e.printStackTrace();\n return false;\n }\n }\n}", + "cpp": "return result == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=kMzJy9es7Hc&pp=ygUaTmVldENvZGUgRmluZCBQZWFrIEVsZW1lbnQ%3D" }, { "title": "Maximum Gap", @@ -2869,24 +3490,24 @@ "description": "

Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the array contains less than two elements, return 0.

\n\n

You must write an algorithm that runs in linear time and uses linear extra space.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [3,6,9,1]\nOutput: 3\nExplanation: The sorted form of the array is [1,3,6,9], either (3,6) or (6,9) has the maximum difference 3.\n
\n\n

Example 2:

\n\n
\nInput: nums = [10]\nOutput: 0\nExplanation: The array contains less than 2 elements, therefore return 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • 0 <= nums[i] <= 109
  • \n
\n", "difficulty": "medium", "sample_test_cases": [ - "maximumGap([3,6,9,1])", - "maximumGap([10])" + "--arg1=3,6,9,1", + "--arg1=10" ], "sample_test_results": [ "3", "0" ], "hidden_test_cases": [ - "maximumGap([1,2,3,4])", - "maximumGap([1,10])", - "maximumGap([1,1,1,1])", - "maximumGap([1,3,100])", - "maximumGap([1])", - "maximumGap([1,5,2,8,3])", - "maximumGap([87,53,100,1])", - "maximumGap([1000,1,500,2])", - "maximumGap([1,10000,1,10000])", - "maximumGap([1,2,3,5,6,7,8,9,10,100])" + "--arg1=1,2,3,4", + "--arg1=1,10", + "--arg1=1,1,1,1", + "--arg1=1,3,100", + "--arg1=1", + "--arg1=1,5,2,8,3", + "--arg1=87,53,100,1", + "--arg1=1000,1,500,2", + "--arg1=1,10000,1,10000", + "--arg1=1,2,3,5,6,7,8,9,10,100" ], "hidden_test_results": [ "1", @@ -2900,8 +3521,17 @@ "9999", "90" ], - "boilerplate": "class Solution:\n def maximumGap(self, nums: List[int]) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def maximumGap(self, nums: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int maximumGap(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maximumGap(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=imCKT3T2Oao&pp=ygUUTmVldENvZGUgTWF4aW11bSBHYXA%3D" }, { "title": "Median of Two Sorted Arrays", @@ -2909,9 +3539,9 @@ "description": "

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

\n\n

The overall run time complexity should be O(log (m+n)).

\n\n

 

\n

Example 1:

\n\n
\nInput: nums1 = [1,3], nums2 = [2]\nOutput: 2.00000\nExplanation: merged array = [1,2,3] and median is 2.\n
\n\n

Example 2:

\n\n
\nInput: nums1 = [1,2], nums2 = [3,4]\nOutput: 2.50000\nExplanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • nums1.length == m
  • \n\t
  • nums2.length == n
  • \n\t
  • 0 <= m <= 1000
  • \n\t
  • 0 <= n <= 1000
  • \n\t
  • 1 <= m + n <= 2000
  • \n\t
  • -106 <= nums1[i], nums2[i] <= 106
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "findMedianSortedArrays([1,3], [2])", - "findMedianSortedArrays([1,2], [3,4])", - "findMedianSortedArrays([], [1])" + "--arg1=1,3 --arg2=2", + "--arg1=1,2 --arg2=[3 --arg3=4]", + "--arg1= --arg2=1" ], "sample_test_results": [ "2", @@ -2919,16 +3549,16 @@ "1" ], "hidden_test_cases": [ - "findMedianSortedArrays([1], [1])", - "findMedianSortedArrays([1,2,3,4,5], [])", - "findMedianSortedArrays([], [1,2,3,4,5])", - "findMedianSortedArrays([1], [2,3,4,5,6])", - "findMedianSortedArrays([1,2,3,4,5], [6])", - "findMedianSortedArrays([1,3,5,7], [2,4,6,8])", - "findMedianSortedArrays([1,1,1,1], [1,1,1,1])", - "findMedianSortedArrays([-1,0,1], [-2,2])", - "findMedianSortedArrays([10000], [-10000])", - "findMedianSortedArrays([1,2], [1,2,3])" + "--arg1=1 --arg2=1", + "--arg1=1,2,3,4,5 --arg2=", + "--arg1= --arg2=[1 --arg3=2 --arg4=3 --arg5=4 --arg6=5]", + "--arg1=1 --arg2=[2 --arg3=3 --arg4=4 --arg5=5 --arg6=6]", + "--arg1=1,2,3,4,5 --arg2=6", + "--arg1=1,3,5,7 --arg2=[2 --arg3=4 --arg4=6 --arg5=8]", + "--arg1=1,1,1,1 --arg2=[1 --arg3=1 --arg4=1 --arg5=1]", + "--arg1=-1,0,1 --arg2=[-2 --arg3=2]", + "--arg1=10000 --arg2=-10000", + "--arg1=1,2 --arg2=[1 --arg3=2 --arg4=3]" ], "hidden_test_results": [ "1.0", @@ -2942,8 +3572,17 @@ "0.0", "2" ], - "boilerplate": "class Solution:\n def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:\n ", - "compare_func": "return abs(float(result) - float(expected)) < 0.00001" + "boilerplate": { + "python": "class Solution:\n def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:\n ", + "java": "class Solution {\n public double findMedianSortedArrays(int[] nums1, int[] nums2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n double findMedianSortedArrays(vector& nums1, vector& nums2) {\n \n }\n};" + }, + "compare_func": { + "python": "return abs(float(result) - float(expected)) < 0.00001", + "java": "return Math.abs(Double.parseDouble(result) - Double.parseDouble(expected)) < 0.00001;", + "cpp": "return std::fabs(static_cast(result) - static_cast(expected)) < 0.00001;" + }, + "explanation": "https://www.youtube.com/watch?v=q6IEA26hvXc&pp=ygUkTmVldENvZGUgTWVkaWFuIG9mIFR3byBTb3J0ZWQgQXJyYXlz" }, { "title": "First Missing Positive", @@ -2951,9 +3590,9 @@ "description": "

Given an unsorted integer array nums. Return the smallest positive integer that is not present in nums.

\n\n

You must implement an algorithm that runs in O(n) time and uses O(1) auxiliary space.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,0]\nOutput: 3\nExplanation: The numbers in the range [1,2] are all in the array.\n
\n\n

Example 2:

\n\n
\nInput: nums = [3,4,-1,1]\nOutput: 2\nExplanation: 1 is in the array but 2 is missing.\n
\n\n

Example 3:

\n\n
\nInput: nums = [7,8,9,11,12]\nOutput: 1\nExplanation: The smallest positive integer 1 is missing.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "firstMissingPositive([1,2,0])", - "firstMissingPositive([3,4,-1,1])", - "firstMissingPositive([7,8,9,11,12])" + "--arg1=1,2,0", + "--arg1=3,4,-1,1", + "--arg1=7,8,9,11,12" ], "sample_test_results": [ "3", @@ -2961,16 +3600,16 @@ "1" ], "hidden_test_cases": [ - "firstMissingPositive([1])", - "firstMissingPositive([1,1])", - "firstMissingPositive([-1,-2,-3])", - "firstMissingPositive([1,2,3,4,5])", - "firstMissingPositive([2])", - "firstMissingPositive([1,2,4])", - "firstMissingPositive([1,1,1,1,1])", - "firstMissingPositive([2147483647])", - "firstMissingPositive([-2147483648])", - "firstMissingPositive([1,2,3,3,3])" + "--arg1=1", + "--arg1=1,1", + "--arg1=-1,-2,-3", + "--arg1=1,2,3,4,5", + "--arg1=2", + "--arg1=1,2,4", + "--arg1=1,1,1,1,1", + "--arg1=2147483647", + "--arg1=-2147483648", + "--arg1=1,2,3,3,3" ], "hidden_test_results": [ "2", @@ -2984,8 +3623,17 @@ "1", "4" ], - "boilerplate": "class Solution:\n def firstMissingPositive(self, nums: List[int]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def firstMissingPositive(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int firstMissingPositive(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int firstMissingPositive(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=8g78yfzMlao&pp=ygUfTmVldENvZGUgRmlyc3QgTWlzc2luZyBQb3NpdGl2ZQ%3D%3D" }, { "title": "Permutation Sequence", @@ -2993,9 +3641,9 @@ "description": "

The set [1, 2, 3, ..., n] contains a total of n! unique permutations.

\n\n

By listing and labeling all of the permutations in order, we get the following sequence for n = 3:

\n\n
    \n\t
  1. "123"
  2. \n\t
  3. "132"
  4. \n\t
  5. "213"
  6. \n\t
  7. "231"
  8. \n\t
  9. "312"
  10. \n\t
  11. "321"
  12. \n
\n\n

Given n and k, return the kth permutation sequence.

\n\n

 

\n

Example 1:

\n
Input: n = 3, k = 3\nOutput: \"213\"\n

Example 2:

\n
Input: n = 4, k = 9\nOutput: \"2314\"\n

Example 3:

\n
Input: n = 3, k = 1\nOutput: \"123\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 9
  • \n\t
  • 1 <= k <= n!
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "getPermutation(3, 3)", - "getPermutation(4, 9)", - "getPermutation(3, 1)" + "--arg1=3 --arg2=3", + "--arg1=4 --arg2=9", + "--arg1=3 --arg2=1" ], "sample_test_results": [ "'213'", @@ -3003,16 +3651,16 @@ "'123'" ], "hidden_test_cases": [ - "getPermutation(1, 1)", - "getPermutation(2, 1)", - "getPermutation(2, 2)", - "getPermutation(3, 6)", - "getPermutation(4, 1)", - "getPermutation(4, 24)", - "getPermutation(5, 5)", - "getPermutation(6, 720)", - "getPermutation(7, 1)", - "getPermutation(8, 40320)" + "--arg1=1 --arg2=1", + "--arg1=2 --arg2=1", + "--arg1=2 --arg2=2", + "--arg1=3 --arg2=6", + "--arg1=4 --arg2=1", + "--arg1=4 --arg2=24", + "--arg1=5 --arg2=5", + "--arg1=6 --arg2=720", + "--arg1=7 --arg2=1", + "--arg1=8 --arg2=40320" ], "hidden_test_results": [ "'1'", @@ -3026,8 +3674,17 @@ "'1234567'", "'87654321'" ], - "boilerplate": "class Solution:\n def getPermutation(self, n: int, k: int) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def getPermutation(self, n: int, k: int) -> str:\n ", + "java": "class Solution {\n public String getPermutation(int n, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::string getPermutation(int n, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "#include \n#include \n#include // For numeric comparisons, if required\n\nbool compareFunction(const std::string& result, const std::string& expected) {\n std::istringstream resultStream(result);\n std::istringstream expectedStream(expected);\n \n // Assuming the result and expected values are of the same type (e.g., integers, doubles, etc.)\n double resultValue, expectedValue;\n resultStream >> resultValue;\n expectedStream >> expectedValue;\n \n // For numerical comparisons considering the floating-point precision\n return std::abs(resultValue - expectedValue) < 1e-9;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=W9SIlE2jhBQ&pp=ygUdTmVldENvZGUgUGVybXV0YXRpb24gU2VxdWVuY2U%3D" }, { "title": "Text Justification", @@ -3035,41 +3692,50 @@ "description": "

Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified.

\n\n

You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces ' ' when necessary so that each line has exactly maxWidth characters.

\n\n

Extra spaces between words should be distributed as evenly as possible. If the number of spaces on a line does not divide evenly between words, the empty slots on the left will be assigned more spaces than the slots on the right.

\n\n

For the last line of text, it should be left-justified, and no extra space is inserted between words.

\n\n

Note:

\n\n
    \n\t
  • A word is defined as a character sequence consisting of non-space characters only.
  • \n\t
  • Each word's length is guaranteed to be greater than 0 and not exceed maxWidth.
  • \n\t
  • The input array words contains at least one word.
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: words = ["This", "is", "an", "example", "of", "text", "justification."], maxWidth = 16\nOutput:\n[\n   "This    is    an",\n   "example  of text",\n   "justification.  "\n]
\n\n

Example 2:

\n\n
\nInput: words = ["What","must","be","acknowledgment","shall","be"], maxWidth = 16\nOutput:\n[\n  "What   must   be",\n  "acknowledgment  ",\n  "shall be        "\n]\nExplanation: Note that the last line is "shall be    " instead of "shall     be", because the last line must be left-justified instead of fully-justified.\nNote that the second line is also left-justified because it contains only one word.
\n\n

Example 3:

\n\n
\nInput: words = ["Science","is","what","we","understand","well","enough","to","explain","to","a","computer.","Art","is","everything","else","we","do"], maxWidth = 20\nOutput:\n[\n  "Science  is  what we",\n  "understand      well",\n  "enough to explain to",\n  "a  computer.  Art is",\n  "everything  else  we",\n  "do                  "\n]
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= words.length <= 300
  • \n\t
  • 1 <= words[i].length <= 20
  • \n\t
  • words[i] consists of only English letters and symbols.
  • \n\t
  • 1 <= maxWidth <= 100
  • \n\t
  • words[i].length <= maxWidth
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "fullJustify(['This', 'is', 'an', 'example', 'of', 'text', 'justification.'], 16)", - "fullJustify(['What','must','be','acknowledgment','shall','be'], 16)", - "fullJustify(['Science','is','what','we','understand','well','enough','to','explain','to','a','computer.','Art','is','everything','else','we','do'], 20)" + "--arg1='This','is','an','example','of','text','justification.' --arg2=16", + "--arg1='What','must','be','acknowledgment','shall','be' --arg2=16", + "--arg1='Science','is','what','we','understand','well','enough','to','explain','to','a','computer.','Art','is','everything','else','we','do' --arg2=20" ], "sample_test_results": [ - "['This is an', 'example of text', 'justification. ']", - "['What must be', 'acknowledgment ', 'shall be ']", - "['Science is what we', 'understand well', 'enough to explain to', 'a computer. Art is', 'everything else we', 'do ']" + "'This is an', 'example of text', 'justification. '", + "'What must be', 'acknowledgment ', 'shall be '", + "'Science is what we', 'understand well', 'enough to explain to', 'a computer. Art is', 'everything else we', 'do '" ], "hidden_test_cases": [ - "fullJustify(['a'], 1)", - "fullJustify(['a','b','c'], 1)", - "fullJustify(['hello'], 10)", - "fullJustify(['a','b','c','d'], 3)", - "fullJustify(['This','is','a','test'], 4)", - "fullJustify(['ab','cd','ef'], 10)", - "fullJustify(['a','b'], 4)", - "fullJustify(['word'], 5)", - "fullJustify(['a','b','c','d','e'], 3)", - "fullJustify(['Hello','World'], 12)" + "--arg1='a' --arg2=1", + "--arg1='a','b','c' --arg2=1", + "--arg1='hello' --arg2=10", + "--arg1='a','b','c','d' --arg2=3", + "--arg1='This','is','a','test' --arg2=4", + "--arg1='ab','cd','ef' --arg2=10", + "--arg1='a','b' --arg2=4", + "--arg1='word' --arg2=5", + "--arg1='a','b','c','d','e' --arg2=3", + "--arg1='Hello','World' --arg2=12" ], "hidden_test_results": [ - "['a']", - "['a', 'b', 'c']", - "['hello ']", - "['a b', 'c d']", - "['This', 'is a', 'test']", - "['ab cd ef ']", - "['a b ']", - "['word ']", - "['a b', 'c d', 'e ']", - "['Hello World ']" - ], - "boilerplate": "class Solution:\n def fullJustify(self, words: List[str], maxWidth: int) -> List[str]:\n ", - "compare_func": "return result == eval(expected)" + "'a'", + "'a', 'b', 'c'", + "'hello '", + "'a b', 'c d'", + "'This', 'is a', 'test'", + "'ab cd ef '", + "'a b '", + "'word '", + "'a b', 'c d', 'e '", + "'Hello World '" + ], + "boilerplate": { + "python": "class Solution:\n def fullJustify(self, words: List[str], maxWidth: int) -> List[str]:\n ", + "java": "class Solution {\n public List fullJustify(List words, int maxWidth) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector fullJustify(vector& words, int maxWidth) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoll(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=TzMl4Z7pVh8&pp=ygUbTmVldENvZGUgVGV4dCBKdXN0aWZpY2F0aW9u" }, { "title": "Minimum Window Substring", @@ -3077,9 +3743,9 @@ "description": "

Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string "".

\n\n

The testcases will be generated such that the answer is unique.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "ADOBECODEBANC", t = "ABC"\nOutput: "BANC"\nExplanation: The minimum window substring "BANC" includes 'A', 'B', and 'C' from string t.\n
\n\n

Example 2:

\n\n
\nInput: s = "a", t = "a"\nOutput: "a"\nExplanation: The entire string s is the minimum window.\n
\n\n

Example 3:

\n\n
\nInput: s = "a", t = "aa"\nOutput: ""\nExplanation: Both 'a's from t must be included in the window.\nSince the largest window of s only has one 'a', return empty string.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == s.length
  • \n\t
  • n == t.length
  • \n\t
  • 1 <= m, n <= 105
  • \n\t
  • s and t consist of uppercase and lowercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you find an algorithm that runs in O(m + n) time?

\n", "difficulty": "hard", "sample_test_cases": [ - "minWindow('ADOBECODEBANC', 'ABC')", - "minWindow('a', 'a')", - "minWindow('a', 'aa')" + "--arg1='ADOBECODEBANC' --arg2='ABC'", + "--arg1='a' --arg2='a'", + "--arg1='a' --arg2='aa'" ], "sample_test_results": [ "'BANC'", @@ -3087,16 +3753,16 @@ "''" ], "hidden_test_cases": [ - "minWindow('a', 'b')", - "minWindow('ab', 'a')", - "minWindow('ABCDEFG', 'AC')", - "minWindow('aaaaaaa', 'a')", - "minWindow('ADOBECODEBANC', 'ABBC')", - "minWindow('this is a test string', 'tist')", - "minWindow('ADOBECODEBANC', 'ABCDE')", - "minWindow('aaabbaaba', 'abb')", - "minWindow('abc', 'cba')", - "minWindow('bba', 'ab')" + "--arg1='a' --arg2='b'", + "--arg1='ab' --arg2='a'", + "--arg1='ABCDEFG' --arg2='AC'", + "--arg1='aaaaaaa' --arg2='a'", + "--arg1='ADOBECODEBANC' --arg2='ABBC'", + "--arg1='this is a test string' --arg2='tist'", + "--arg1='ADOBECODEBANC' --arg2='ABCDE'", + "--arg1='aaabbaaba' --arg2='abb'", + "--arg1='abc' --arg2='cba'", + "--arg1='bba' --arg2='ab'" ], "hidden_test_results": [ "''", @@ -3110,8 +3776,17 @@ "'abc'", "'ba'" ], - "boilerplate": "class Solution:\n def minWindow(self, s: str, t: str) -> str:\n ", - "compare_func": "return result == eval(expected)" + "boilerplate": { + "python": "class Solution:\n def minWindow(self, s: str, t: str) -> str:\n ", + "java": "class Solution {\n public String minWindow(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::string minWindow(std::string s, std::string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=jSto0O4AJbM&pp=ygUhTmVldENvZGUgTWluaW11bSBXaW5kb3cgU3Vic3RyaW5n" }, { "title": "Largest Rectangle in Histogram", @@ -3119,24 +3794,24 @@ "description": "

Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: heights = [2,1,5,6,2,3]\nOutput: 10\nExplanation: The above is a histogram where width of each bar is 1.\nThe largest rectangle is shown in the red area, which has an area = 10 units.\n
\n\n

Example 2:

\n\"\"\n
\nInput: heights = [2,4]\nOutput: 4\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= heights.length <= 105
  • \n\t
  • 0 <= heights[i] <= 104
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "largestRectangleArea([2,1,5,6,2,3])", - "largestRectangleArea([2,4])" + "--arg1=2,1,5,6,2,3", + "--arg1=2,4" ], "sample_test_results": [ "10", "4" ], "hidden_test_cases": [ - "largestRectangleArea([2,1,2])", - "largestRectangleArea([1])", - "largestRectangleArea([0])", - "largestRectangleArea([1,1,1,1])", - "largestRectangleArea([2,1,2,3,1])", - "largestRectangleArea([5,4,3,2,1])", - "largestRectangleArea([1,2,3,4,5])", - "largestRectangleArea([2,2,2,2])", - "largestRectangleArea([1,2,3,4,5,4,3,2,1])", - "largestRectangleArea([0,0,0])" + "--arg1=2,1,2", + "--arg1=1", + "--arg1=0", + "--arg1=1,1,1,1", + "--arg1=2,1,2,3,1", + "--arg1=5,4,3,2,1", + "--arg1=1,2,3,4,5", + "--arg1=2,2,2,2", + "--arg1=1,2,3,4,5,4,3,2,1", + "--arg1=0,0,0" ], "hidden_test_results": [ "3", @@ -3150,8 +3825,17 @@ "15", "0" ], - "boilerplate": "class Solution:\n def largestRectangleArea(self, heights: List[int]) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def largestRectangleArea(self, heights: List[int]) -> int:\n ", + "java": "class Solution {\n public int largestRectangleArea(int[] heights) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int largestRectangleArea(vector& heights) {\n // \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=zx5Sw9130L0&pp=ygUnTmVldENvZGUgTGFyZ2VzdCBSZWN0YW5nbGUgaW4gSGlzdG9ncmFt" }, { "title": "Maximal Rectangle", @@ -3159,9 +3843,9 @@ "description": "

Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]\nOutput: 6\nExplanation: The maximal rectangle is shown in the above picture.\n
\n\n

Example 2:

\n\n
\nInput: matrix = [["0"]]\nOutput: 0\n
\n\n

Example 3:

\n\n
\nInput: matrix = [["1"]]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • rows == matrix.length
  • \n\t
  • cols == matrix[i].length
  • \n\t
  • 1 <= row, cols <= 200
  • \n\t
  • matrix[i][j] is '0' or '1'.
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "maximalRectangle([[\"1\",\"0\",\"1\",\"0\",\"0\"],[\"1\",\"0\",\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\",\"1\",\"1\"],[\"1\",\"0\",\"0\",\"1\",\"0\"]])", - "maximalRectangle([[\"0\"]])", - "maximalRectangle([[\"1\"]])" + "--arg1=[\"1\",\"0\",\"1\",\"0\",\"0\" --arg2=\"1\",\"0\",\"1\",\"1\",\"1\" --arg3=\"1\",\"1\",\"1\",\"1\",\"1\" --arg4=\"1\",\"0\",\"0\",\"1\",\"0\" --arg5=]", + "--arg1=[\"0\" --arg2=]", + "--arg1=[\"1\" --arg2=]" ], "sample_test_results": [ "6", @@ -3169,16 +3853,16 @@ "1" ], "hidden_test_cases": [ - "maximalRectangle([[\"1\",\"1\"],[\"1\",\"1\"]])", - "maximalRectangle([[\"0\",\"0\"],[\"0\",\"0\"]])", - "maximalRectangle([[\"1\"],[\"1\"]])", - "maximalRectangle([[\"1\",\"0\"],[\"1\",\"0\"]])", - "maximalRectangle([[\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\"]])", - "maximalRectangle([[\"1\",\"0\",\"1\"],[\"0\",\"1\",\"0\"],[\"1\",\"0\",\"1\"]])", - "maximalRectangle([[\"0\",\"1\"],[\"1\",\"0\"]])", - "maximalRectangle([[\"1\",\"1\",\"1\"],[\"1\",\"0\",\"1\"],[\"1\",\"1\",\"1\"]])", - "maximalRectangle([[\"1\"],[\"1\"],[\"1\"]])", - "maximalRectangle([[\"0\",\"0\",\"0\"],[\"0\",\"0\",\"0\"]])" + "--arg1=[\"1\",\"1\" --arg2=\"1\",\"1\" --arg3=]", + "--arg1=[\"0\",\"0\" --arg2=\"0\",\"0\" --arg3=]", + "--arg1=[\"1\" --arg2=\"1\" --arg3=]", + "--arg1=[\"1\",\"0\" --arg2=\"1\",\"0\" --arg3=]", + "--arg1=[\"1\",\"1\",\"1\" --arg2=\"1\",\"1\",\"1\" --arg3=\"1\",\"1\",\"1\" --arg4=]", + "--arg1=[\"1\",\"0\",\"1\" --arg2=\"0\",\"1\",\"0\" --arg3=\"1\",\"0\",\"1\" --arg4=]", + "--arg1=[\"0\",\"1\" --arg2=\"1\",\"0\" --arg3=]", + "--arg1=[\"1\",\"1\",\"1\" --arg2=\"1\",\"0\",\"1\" --arg3=\"1\",\"1\",\"1\" --arg4=]", + "--arg1=[\"1\" --arg2=\"1\" --arg3=\"1\" --arg4=]", + "--arg1=[\"0\",\"0\",\"0\" --arg2=\"0\",\"0\",\"0\" --arg3=]" ], "hidden_test_results": [ "4", @@ -3192,8 +3876,17 @@ "3", "0" ], - "boilerplate": "class Solution:\n def maximalRectangle(self, matrix: List[List[str]]) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def maximalRectangle(self, matrix: List[List[str]]) -> int:\n ", + "java": "class Solution {\n public int maximalRectangle(char[][] matrix) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maximalRectangle(vector>& matrix) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=tOylVCugy9k&pp=ygUaTmVldENvZGUgTWF4aW1hbCBSZWN0YW5nbGU%3D" }, { "title": "Scramble String", @@ -3201,9 +3894,9 @@ "description": "

We can scramble a string s to get a string t using the following algorithm:

\n\n
    \n\t
  1. If the length of the string is 1, stop.
  2. \n\t
  3. If the length of the string is > 1, do the following:\n\t
      \n\t\t
    • Split the string into two non-empty substrings at a random index, i.e., if the string is s, divide it to x and y where s = x + y.
    • \n\t\t
    • Randomly decide to swap the two substrings or to keep them in the same order. i.e., after this step, s may become s = x + y or s = y + x.
    • \n\t\t
    • Apply step 1 recursively on each of the two substrings x and y.
    • \n\t
    \n\t
  4. \n
\n\n

Given two strings s1 and s2 of the same length, return true if s2 is a scrambled string of s1, otherwise, return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: s1 = "great", s2 = "rgeat"\nOutput: true\nExplanation: One possible scenario applied on s1 is:\n"great" --> "gr/eat" // divide at random index.\n"gr/eat" --> "gr/eat" // random decision is not to swap the two substrings and keep them in order.\n"gr/eat" --> "g/r / e/at" // apply the same algorithm recursively on both substrings. divide at random index each of them.\n"g/r / e/at" --> "r/g / e/at" // random decision was to swap the first substring and to keep the second substring in the same order.\n"r/g / e/at" --> "r/g / e/ a/t" // again apply the algorithm recursively, divide "at" to "a/t".\n"r/g / e/ a/t" --> "r/g / e/ a/t" // random decision is to keep both substrings in the same order.\nThe algorithm stops now, and the result string is "rgeat" which is s2.\nAs one possible scenario led s1 to be scrambled to s2, we return true.\n
\n\n

Example 2:

\n\n
\nInput: s1 = "abcde", s2 = "caebd"\nOutput: false\n
\n\n

Example 3:

\n\n
\nInput: s1 = "a", s2 = "a"\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • s1.length == s2.length
  • \n\t
  • 1 <= s1.length <= 30
  • \n\t
  • s1 and s2 consist of lowercase English letters.
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "isScramble(\"great\", \"rgeat\")", - "isScramble(\"abcde\", \"caebd\")", - "isScramble(\"a\", \"a\")" + "--arg1=\"great\" --arg2=\"rgeat\"", + "--arg1=\"abcde\" --arg2=\"caebd\"", + "--arg1=\"a\" --arg2=\"a\"" ], "sample_test_results": [ "True", @@ -3211,16 +3904,16 @@ "True" ], "hidden_test_cases": [ - "isScramble(\"ab\", \"ba\")", - "isScramble(\"abc\", \"bac\")", - "isScramble(\"abc\", \"cab\")", - "isScramble(\"abb\", \"bba\")", - "isScramble(\"aaab\", \"abaa\")", - "isScramble(\"abcd\", \"bdac\")", - "isScramble(\"abcde\", \"badce\")", - "isScramble(\"abc\", \"acb\")", - "isScramble(\"abcdbdacbdac\", \"bdacabcdbdac\")", - "isScramble(\"xstjzkfpkggnhjzkpfjoguxvkbuopi\", \"xbouipkvxugojfpkzjhnggkpfzjts\")" + "--arg1=\"ab\" --arg2=\"ba\"", + "--arg1=\"abc\" --arg2=\"bac\"", + "--arg1=\"abc\" --arg2=\"cab\"", + "--arg1=\"abb\" --arg2=\"bba\"", + "--arg1=\"aaab\" --arg2=\"abaa\"", + "--arg1=\"abcd\" --arg2=\"bdac\"", + "--arg1=\"abcde\" --arg2=\"badce\"", + "--arg1=\"abc\" --arg2=\"acb\"", + "--arg1=\"abcdbdacbdac\" --arg2=\"bdacabcdbdac\"", + "--arg1=\"xstjzkfpkggnhjzkpfjoguxvkbuopi\" --arg2=\"xbouipkvxugojfpkzjhnggkpfzjts\"" ], "hidden_test_results": [ "True", @@ -3234,8 +3927,17 @@ "True", "False" ], - "boilerplate": "class Solution:\n def isScramble(self, s1: str, s2: str) -> bool:\n ", - "compare_func": "return str(result).lower() == expected.lower()" + "boilerplate": { + "python": "class Solution:\n def isScramble(self, s1: str, s2: str) -> bool:\n ", + "java": "class Solution {\n public boolean isScramble(String s1, String s2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isScramble(string s1, string s2) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=MDmZm_aVDF8&pp=ygUYTmVldENvZGUgU2NyYW1ibGUgU3RyaW5n" }, { "title": "Distinct Subsequences", @@ -3243,24 +3945,24 @@ "description": "

Given two strings s and t, return the number of distinct subsequences of s which equals t.

\n\n

The test cases are generated so that the answer fits on a 32-bit signed integer.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "rabbbit", t = "rabbit"\nOutput: 3\nExplanation:\nAs shown below, there are 3 ways you can generate "rabbit" from s.\nrabbbit\nrabbbit\nrabbbit\n
\n\n

Example 2:

\n\n
\nInput: s = "babgbag", t = "bag"\nOutput: 5\nExplanation:\nAs shown below, there are 5 ways you can generate "bag" from s.\nbabgbag\nbabgbag\nbabgbag\nbabgbag\nbabgbag
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length, t.length <= 1000
  • \n\t
  • s and t consist of English letters.
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "numDistinct(\"rabbbit\", \"rabbit\")", - "numDistinct(\"babgbag\", \"bag\")" + "--arg1=\"rabbbit\" --arg2=\"rabbit\"", + "--arg1=\"babgbag\" --arg2=\"bag\"" ], "sample_test_results": [ "3", "5" ], "hidden_test_cases": [ - "numDistinct(\"a\", \"a\")", - "numDistinct(\"aa\", \"a\")", - "numDistinct(\"aaa\", \"aa\")", - "numDistinct(\"abc\", \"abc\")", - "numDistinct(\"abcde\", \"ace\")", - "numDistinct(\"aabb\", \"ab\")", - "numDistinct(\"xslledayhxhadmctrliaxqpokyezcfhzaskeykchkmhpyjipxtsuljkwkovmvelvwxzwieeuqnjozrfwmzsylcwvsthnxujvrkszqwtglewkycikdaiocglwzukwovsghkhyidevhbgffoqkpabthmqihcfxxzdejletqjoxmwftlxfcxgxgvpperwbqvhxgsbbkmphyomtbjzdjhcrcsggleiczpbfjcgtpycpmrjnckslrwduqlccqmgrdhxolfjafmsrfdghnatexyanldrdpxvvgujsztuffoymrfteholgonuaqndinadtumnuhkboyzaqguwqijwxxszngextfcozpetyownmyneehdwqmtpjloztswmzzdzqhuoxrblppqvyvsqhnhryvqsqogpnlqfulurexdtovqpqkfxxnqykgscxaskmksivoazlducanrqxynxlgvwonalpsyddqmaemcrrwvrjmjjnygyebwtqxehrclwsxzylbqexnxjcgspeynlbmetlkacnnbhmaizbadynajpibepbuacggxrqavfnwpcwxbzxfymhjcslghmajrirqzjqxpgtgisfjreqrqabssobbadmtmdknmakdigjqyqcruujlwmfoagrckdwyiglviyyrekjealvvigiesnvuumxgsveadrxlpwetioxibtdjblowblqvzpbrmhupyrdophjxvhgzclidzybajuxllacyhyphssvhcffxonysahvzhzbttyeeyiefhunbokiqrpqfcoxdxvefugapeevdoakxwzykmhbdytjbhigffkmbqmqxsoaiomgmmgwapzdosorcxxhejvgajyzdmzlcntqbapbpofdjtulstuzdrffafedufqwsknumcxbschdybosxkrabyfdejgyozwillcxpcaiehlelczioskqtptzaczobvyojdlyflilvwqgyrqmjaeepydrcchfyftjighntqzoo\", \"rwmimatmhydhbujebqehjprarwfkoebcxxqfktayaaeheys\")", - "numDistinct(\"aaaaaaaaaa\", \"aaaaaaa\")", - "numDistinct(\"abcdef\", \"xyz\")", - "numDistinct(\"wbyhqihmwwux\", \"byhwu\")" + "--arg1=\"a\" --arg2=\"a\"", + "--arg1=\"aa\" --arg2=\"a\"", + "--arg1=\"aaa\" --arg2=\"aa\"", + "--arg1=\"abc\" --arg2=\"abc\"", + "--arg1=\"abcde\" --arg2=\"ace\"", + "--arg1=\"aabb\" --arg2=\"ab\"", + "--arg1=\"xslledayhxhadmctrliaxqpokyezcfhzaskeykchkmhpyjipxtsuljkwkovmvelvwxzwieeuqnjozrfwmzsylcwvsthnxujvrkszqwtglewkycikdaiocglwzukwovsghkhyidevhbgffoqkpabthmqihcfxxzdejletqjoxmwftlxfcxgxgvpperwbqvhxgsbbkmphyomtbjzdjhcrcsggleiczpbfjcgtpycpmrjnckslrwduqlccqmgrdhxolfjafmsrfdghnatexyanldrdpxvvgujsztuffoymrfteholgonuaqndinadtumnuhkboyzaqguwqijwxxszngextfcozpetyownmyneehdwqmtpjloztswmzzdzqhuoxrblppqvyvsqhnhryvqsqogpnlqfulurexdtovqpqkfxxnqykgscxaskmksivoazlducanrqxynxlgvwonalpsyddqmaemcrrwvrjmjjnygyebwtqxehrclwsxzylbqexnxjcgspeynlbmetlkacnnbhmaizbadynajpibepbuacggxrqavfnwpcwxbzxfymhjcslghmajrirqzjqxpgtgisfjreqrqabssobbadmtmdknmakdigjqyqcruujlwmfoagrckdwyiglviyyrekjealvvigiesnvuumxgsveadrxlpwetioxibtdjblowblqvzpbrmhupyrdophjxvhgzclidzybajuxllacyhyphssvhcffxonysahvzhzbttyeeyiefhunbokiqrpqfcoxdxvefugapeevdoakxwzykmhbdytjbhigffkmbqmqxsoaiomgmmgwapzdosorcxxhejvgajyzdmzlcntqbapbpofdjtulstuzdrffafedufqwsknumcxbschdybosxkrabyfdejgyozwillcxpcaiehlelczioskqtptzaczobvyojdlyflilvwqgyrqmjaeepydrcchfyftjighntqzoo\" --arg2=\"rwmimatmhydhbujebqehjprarwfkoebcxxqfktayaaeheys\"", + "--arg1=\"aaaaaaaaaa\" --arg2=\"aaaaaaa\"", + "--arg1=\"abcdef\" --arg2=\"xyz\"", + "--arg1=\"wbyhqihmwwux\" --arg2=\"byhwu\"" ], "hidden_test_results": [ "1", @@ -3274,8 +3976,17 @@ "0", "4" ], - "boilerplate": "class Solution:\n def numDistinct(self, s: str, t: str) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def numDistinct(self, s: str, t: str) -> int:\n ", + "java": "class Solution {\n public int numDistinct(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int numDistinct(std::string s, std::string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=-RDzMJ33nx8&pp=ygUeTmVldENvZGUgRGlzdGluY3QgU3Vic2VxdWVuY2Vz" }, { "title": "Best Time to Buy and Sell Stock III", @@ -3283,9 +3994,9 @@ "description": "

You are given an array prices where prices[i] is the price of a given stock on the ith day.

\n\n

Find the maximum profit you can achieve. You may complete at most two transactions.

\n\n

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

\n\n

 

\n

Example 1:

\n\n
\nInput: prices = [3,3,5,0,0,3,1,4]\nOutput: 6\nExplanation: Buy on day 4 (price = 0) and sell on day 6 (price = 3), profit = 3-0 = 3.\nThen buy on day 7 (price = 1) and sell on day 8 (price = 4), profit = 4-1 = 3.
\n\n

Example 2:

\n\n
\nInput: prices = [1,2,3,4,5]\nOutput: 4\nExplanation: Buy on day 1 (price = 1) and sell on day 5 (price = 5), profit = 5-1 = 4.\nNote that you cannot buy on day 1, buy on day 2 and sell them later, as you are engaging multiple transactions at the same time. You must sell before buying again.\n
\n\n

Example 3:

\n\n
\nInput: prices = [7,6,4,3,1]\nOutput: 0\nExplanation: In this case, no transaction is done, i.e. max profit = 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= prices.length <= 105
  • \n\t
  • 0 <= prices[i] <= 105
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "maxProfit([3,3,5,0,0,3,1,4])", - "maxProfit([1,2,3,4,5])", - "maxProfit([7,6,4,3,1])" + "--arg1=3,3,5,0,0,3,1,4", + "--arg1=1,2,3,4,5", + "--arg1=7,6,4,3,1" ], "sample_test_results": [ "6", @@ -3293,16 +4004,16 @@ "0" ], "hidden_test_cases": [ - "maxProfit([1])", - "maxProfit([1,2])", - "maxProfit([2,1])", - "maxProfit([1,2,4,2,5,7,2,4,9,0])", - "maxProfit([0,0,0,0])", - "maxProfit([1,2,3,4,5,4,3,2,1])", - "maxProfit([3,2,6,5,0,3])", - "maxProfit([1,4,5,7,6,3,2,9])", - "maxProfit([8,3,6,2,8,8,8,4,2,0,7,2,9,4,9])", - "maxProfit([1,2,4,2,5,7,2,4,9,0,9])" + "--arg1=1", + "--arg1=1,2", + "--arg1=2,1", + "--arg1=1,2,4,2,5,7,2,4,9,0", + "--arg1=0,0,0,0", + "--arg1=1,2,3,4,5,4,3,2,1", + "--arg1=3,2,6,5,0,3", + "--arg1=1,4,5,7,6,3,2,9", + "--arg1=8,3,6,2,8,8,8,4,2,0,7,2,9,4,9", + "--arg1=1,2,4,2,5,7,2,4,9,0,9" ], "hidden_test_results": [ "0", @@ -3316,8 +4027,17 @@ "15", "17" ], - "boilerplate": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", + "java": "class Solution {\n public int maxProfit(List prices) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxProfit(vector& prices) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=37s1_xBiqH0&pp=ygUsTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJSUk%3D" }, { "title": "Word Ladder", @@ -3325,9 +4045,9 @@ "description": "

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that:

\n\n
    \n\t
  • Every adjacent pair of words differs by a single letter.
  • \n\t
  • Every si for 1 <= i <= k is in wordList. Note that beginWord does not need to be in wordList.
  • \n\t
  • sk == endWord
  • \n
\n\n

Given two words, beginWord and endWord, and a dictionary wordList, return the number of words in the shortest transformation sequence from beginWord to endWord, or 0 if no such sequence exists.

\n\n

 

\n

Example 1:

\n\n
\nInput: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]\nOutput: 5\nExplanation: One shortest transformation sequence is "hit" -> "hot" -> "dot" -> "dog" -> cog", which is 5 words long.\n
\n\n

Example 2:

\n\n
\nInput: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"]\nOutput: 0\nExplanation: The endWord "cog" is not in wordList, therefore there is no valid transformation sequence.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= beginWord.length <= 10
  • \n\t
  • endWord.length == beginWord.length
  • \n\t
  • 1 <= wordList.length <= 5000
  • \n\t
  • wordList[i].length == beginWord.length
  • \n\t
  • beginWord, endWord, and wordList[i] consist of lowercase English letters.
  • \n\t
  • beginWord != endWord
  • \n\t
  • All the words in wordList are unique.
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "ladderLength('hit', 'cog', ['hot','dot','dog','lot','log','cog'])", - "ladderLength('hit', 'cog', ['hot','dot','dog','lot','log'])", - "ladderLength('lost', 'cost', ['most','cost','lost'])" + "--arg1='hit' --arg2='cog' --arg3=['hot' --arg4='dot' --arg5='dog' --arg6='lot' --arg7='log' --arg8='cog']", + "--arg1='hit' --arg2='cog' --arg3=['hot' --arg4='dot' --arg5='dog' --arg6='lot' --arg7='log']", + "--arg1='lost' --arg2='cost' --arg3=['most' --arg4='cost' --arg5='lost']" ], "sample_test_results": [ "5", @@ -3335,16 +4055,16 @@ "2" ], "hidden_test_cases": [ - "ladderLength('hit', 'dog', ['hot','dot','dog'])", - "ladderLength('cat', 'rat', ['hat','rat','cat'])", - "ladderLength('a', 'c', ['a','b','c'])", - "ladderLength('red', 'tax', ['ted','tex','red','tax','tad'])", - "ladderLength('log', 'dog', ['fog','fig','dig','dog','log'])", - "ladderLength('abc', 'def', ['abf','acf','aef','def'])", - "ladderLength('hot', 'dog', ['hot','dog'])", - "ladderLength('hit', 'cog', [])", - "ladderLength('cat', 'cat', ['cat'])", - "ladderLength('hit', 'hat', ['hat','hot'])" + "--arg1='hit' --arg2='dog' --arg3=['hot' --arg4='dot' --arg5='dog']", + "--arg1='cat' --arg2='rat' --arg3=['hat' --arg4='rat' --arg5='cat']", + "--arg1='a' --arg2='c' --arg3=['a' --arg4='b' --arg5='c']", + "--arg1='red' --arg2='tax' --arg3=['ted' --arg4='tex' --arg5='red' --arg6='tax' --arg7='tad']", + "--arg1='log' --arg2='dog' --arg3=['fog' --arg4='fig' --arg5='dig' --arg6='dog' --arg7='log']", + "--arg1='abc' --arg2='def' --arg3=['abf' --arg4='acf' --arg5='aef' --arg6='def']", + "--arg1='hot' --arg2='dog' --arg3=['hot' --arg4='dog']", + "--arg1='hit' --arg2='cog' --arg3=", + "--arg1='cat' --arg2='cat' --arg3='cat'", + "--arg1='hit' --arg2='hat' --arg3=['hat' --arg4='hot']" ], "hidden_test_results": [ "4", @@ -3358,8 +4078,17 @@ "2", "2" ], - "boilerplate": "class Solution:\n def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:\n ", + "java": "class Solution {\n public int ladderLength(String beginWord, String endWord, List wordList) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int ladderLength(string beginWord, string endWord, vector& wordList) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=h9iTnkgv05E&pp=ygUUTmVldENvZGUgV29yZCBMYWRkZXI%3D" }, { "title": "Candy", @@ -3367,9 +4096,9 @@ "description": "

There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings.

\n\n

You are giving candies to these children subjected to the following requirements:

\n\n
    \n\t
  • Each child must have at least one candy.
  • \n\t
  • Children with a higher rating get more candies than their neighbors.
  • \n
\n\n

Return the minimum number of candies you need to have to distribute the candies to the children.

\n\n

 

\n

Example 1:

\n\n
\nInput: ratings = [1,0,2]\nOutput: 5\nExplanation: You can allocate to the first, second and third child with 2, 1, 2 candies respectively.\n
\n\n

Example 2:

\n\n
\nInput: ratings = [1,2,2]\nOutput: 4\nExplanation: You can allocate to the first, second and third child with 1, 2, 1 candies respectively.\nThe third child gets 1 candy because it satisfies the above two conditions.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == ratings.length
  • \n\t
  • 1 <= n <= 2 * 104
  • \n\t
  • 0 <= ratings[i] <= 2 * 104
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "candy([1,0,2])", - "candy([1,2,2])", - "candy([1,3,2,2,1])" + "--arg1=1,0,2", + "--arg1=1,2,2", + "--arg1=1,3,2,2,1" ], "sample_test_results": [ "5", @@ -3377,16 +4106,16 @@ "7" ], "hidden_test_cases": [ - "candy([1,2,3,4,5])", - "candy([5,4,3,2,1])", - "candy([1,1,1,1,1])", - "candy([1,3,4,5,2])", - "candy([1,2,87,87,87,2,1])", - "candy([1,2,2,3,1,2])", - "candy([0])", - "candy([1,0,1,0,1])", - "candy([2,0,1,0,2])", - "candy([1,6,10,8,7,3,2])" + "--arg1=1,2,3,4,5", + "--arg1=5,4,3,2,1", + "--arg1=1,1,1,1,1", + "--arg1=1,3,4,5,2", + "--arg1=1,2,87,87,87,2,1", + "--arg1=1,2,2,3,1,2", + "--arg1=0", + "--arg1=1,0,1,0,1", + "--arg1=2,0,1,0,2", + "--arg1=1,6,10,8,7,3,2" ], "hidden_test_results": [ "15", @@ -3400,8 +4129,17 @@ "8", "18" ], - "boilerplate": "class Solution:\n def candy(self, ratings: List[int]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def candy(self, ratings: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int candy(List ratings) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int candy(vector& ratings) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=1IzCRCcK17A&pp=ygUOTmVldENvZGUgQ2FuZHk%3D" }, { "title": "Word Break II", @@ -3409,41 +4147,50 @@ "description": "

Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order.

\n\n

Note that the same word in the dictionary may be reused multiple times in the segmentation.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "catsanddog", wordDict = ["cat","cats","and","sand","dog"]\nOutput: ["cats and dog","cat sand dog"]\n
\n\n

Example 2:

\n\n
\nInput: s = "pineapplepenapple", wordDict = ["apple","pen","applepen","pine","pineapple"]\nOutput: ["pine apple pen apple","pineapple pen apple","pine applepen apple"]\nExplanation: Note that you are allowed to reuse a dictionary word.\n
\n\n

Example 3:

\n\n
\nInput: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"]\nOutput: []\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 20
  • \n\t
  • 1 <= wordDict.length <= 1000
  • \n\t
  • 1 <= wordDict[i].length <= 10
  • \n\t
  • s and wordDict[i] consist of only lowercase English letters.
  • \n\t
  • All the strings of wordDict are unique.
  • \n\t
  • Input is generated in a way that the length of the answer doesn't exceed 105.
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "wordBreak('catsanddog', ['cat','cats','and','sand','dog'])", - "wordBreak('pineapplepenapple', ['apple','pen','applepen','pine','pineapple'])", - "wordBreak('catsandog', ['cats','dog','sand','and','cat'])" + "--arg1='catsanddog' --arg2=['cat' --arg3='cats' --arg4='and' --arg5='sand' --arg6='dog']", + "--arg1='pineapplepenapple' --arg2=['apple' --arg3='pen' --arg4='applepen' --arg5='pine' --arg6='pineapple']", + "--arg1='catsandog' --arg2=['cats' --arg3='dog' --arg4='sand' --arg5='and' --arg6='cat']" ], "sample_test_results": [ - "['cat sand dog', 'cats and dog']", - "['pine apple pen apple', 'pine applepen apple', 'pineapple pen apple']", - "[]" + "'cat sand dog', 'cats and dog'", + "'pine apple pen apple', 'pine applepen apple', 'pineapple pen apple'", + "" ], "hidden_test_cases": [ - "wordBreak('leetcode', ['leet','code'])", - "wordBreak('applepenapple', ['apple','pen'])", - "wordBreak('a', ['a'])", - "wordBreak('aaaa', ['a','aa','aaa'])", - "wordBreak('cars', ['car','ca','rs'])", - "wordBreak('bb', ['a','b','bbb'])", - "wordBreak('catsanddogs', ['cats','cat','and','sand','dog','dogs'])", - "wordBreak('ab', ['a','b'])", - "wordBreak('impossible', ['imp','possible'])", - "wordBreak('aaa', ['a','aa'])" + "--arg1='leetcode' --arg2=['leet' --arg3='code']", + "--arg1='applepenapple' --arg2=['apple' --arg3='pen']", + "--arg1='a' --arg2='a'", + "--arg1='aaaa' --arg2=['a' --arg3='aa' --arg4='aaa']", + "--arg1='cars' --arg2=['car' --arg3='ca' --arg4='rs']", + "--arg1='bb' --arg2=['a' --arg3='b' --arg4='bbb']", + "--arg1='catsanddogs' --arg2=['cats' --arg3='cat' --arg4='and' --arg5='sand' --arg6='dog' --arg7='dogs']", + "--arg1='ab' --arg2=['a' --arg3='b']", + "--arg1='impossible' --arg2=['imp' --arg3='possible']", + "--arg1='aaa' --arg2=['a' --arg3='aa']" ], "hidden_test_results": [ - "['leet code']", - "['apple pen apple']", - "['a']", - "['a a a a', 'a a aa', 'a aa a', 'a aaa', 'aa a a', 'aa aa', 'aaa a']", - "['ca rs']", - "['b b']", - "['cat sand dogs', 'cats and dogs']", - "['a b']", - "[]", - "['a a a', 'a aa', 'aa a']" - ], - "boilerplate": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> List[str]:\n ", - "compare_func": "def normalize(s): return sorted([x.strip() for x in eval(s)])\n return normalize(str(result)) == normalize(expected)" + "'leet code'", + "'apple pen apple'", + "'a'", + "'a a a a', 'a a aa', 'a aa a', 'a aaa', 'aa a a', 'aa aa', 'aaa a'", + "'ca rs'", + "'b b'", + "'cat sand dogs', 'cats and dogs'", + "'a b'", + "", + "'a a a', 'a aa', 'aa a'" + ], + "boilerplate": { + "python": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> List[str]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List wordBreak(String s, List wordDict) {\n // Your code here\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n std::vector wordBreak(std::string s, const std::vector& wordDict) {\n \n }\n};" + }, + "compare_func": { + "python": "def normalize(s): return sorted([x.strip() for x in eval(s)])\n return normalize(str(result)) == normalize(expected)", + "java": "import java.util.List;\nimport java.util.Arrays;\nimport java.util.stream.Collectors;\n\npublic class Solution {\n public boolean compareFunction(String result, String expected) {\n List normalize(String s) {\n return Arrays.stream(s.split(\",\"))\n .map(String::strip)\n .sorted()\n .collect(Collectors.toList());\n }\n\n return normalize(result).equals(normalize(expected));\n }\n}", + "cpp": "bool compareFunction(string result, string expected) {\n // Function to normalize and evaluate a string expression\n auto normalize = [](const string& s) -> vector {\n string trimmed;\n vector elements;\n stringstream ss(eval(s));\n while (getline(ss, trimmed, ',')) {\n trimmed.erase(trimmed.find_last_not_of(' ') + 1); // Trim right\n trimmed.erase(0, trimmed.find_first_not_of(' ')); // Trim left\n elements.push_back(trimmed);\n }\n sort(elements.begin(), elements.end());\n return elements;\n };\n return normalize(result) == normalize(expected);\n}" + }, + "explanation": "https://www.youtube.com/watch?v=QgLKdluDo08&pp=ygUWTmVldENvZGUgV29yZCBCcmVhayBJSQ%3D%3D" }, { "title": "Find Minimum in Rotated Sorted Array II", @@ -3451,9 +4198,9 @@ "description": "

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become:

\n\n
    \n\t
  • [4,5,6,7,0,1,4] if it was rotated 4 times.
  • \n\t
  • [0,1,4,4,5,6,7] if it was rotated 7 times.
  • \n
\n\n

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

\n\n

Given the sorted rotated array nums that may contain duplicates, return the minimum element of this array.

\n\n

You must decrease the overall operation steps as much as possible.

\n\n

 

\n

Example 1:

\n
Input: nums = [1,3,5]\nOutput: 1\n

Example 2:

\n
Input: nums = [2,2,2,0,1]\nOutput: 0\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • n == nums.length
  • \n\t
  • 1 <= n <= 5000
  • \n\t
  • -5000 <= nums[i] <= 5000
  • \n\t
  • nums is sorted and rotated between 1 and n times.
  • \n
\n\n

 

\n

Follow up: This problem is similar to Find Minimum in Rotated Sorted Array, but nums may contain duplicates. Would this affect the runtime complexity? How and why?

\n\n

 

\n", "difficulty": "hard", "sample_test_cases": [ - "findMin([1,3,5])", - "findMin([2,2,2,0,1])", - "findMin([3,1,3])" + "--arg1=1,3,5", + "--arg1=2,2,2,0,1", + "--arg1=3,1,3" ], "sample_test_results": [ "1", @@ -3461,16 +4208,16 @@ "1" ], "hidden_test_cases": [ - "findMin([1,1,1,1,1])", - "findMin([3,3,1,3])", - "findMin([2,2,2,0,1,2])", - "findMin([4,5,6,7,0,1,2])", - "findMin([1,1,1,0,1])", - "findMin([3,4,5,1,2])", - "findMin([5,1,2,3,4])", - "findMin([2,2,2,2,2,2])", - "findMin([3,1,1,1,1])", - "findMin([4,4,5,5,6,6,7,0])" + "--arg1=1,1,1,1,1", + "--arg1=3,3,1,3", + "--arg1=2,2,2,0,1,2", + "--arg1=4,5,6,7,0,1,2", + "--arg1=1,1,1,0,1", + "--arg1=3,4,5,1,2", + "--arg1=5,1,2,3,4", + "--arg1=2,2,2,2,2,2", + "--arg1=3,1,1,1,1", + "--arg1=4,4,5,5,6,6,7,0" ], "hidden_test_results": [ "1", @@ -3484,8 +4231,17 @@ "1", "0" ], - "boilerplate": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int findMin(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findMin(std::vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=oUnF7o88_Xc&pp=ygUwTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5IElJ" }, { "title": "Best Time to Buy and Sell Stock IV", @@ -3493,9 +4249,9 @@ "description": "

You are given an integer array prices where prices[i] is the price of a given stock on the ith day, and an integer k.

\n\n

Find the maximum profit you can achieve. You may complete at most k transactions: i.e. you may buy at most k times and sell at most k times.

\n\n

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

\n\n

 

\n

Example 1:

\n\n
\nInput: k = 2, prices = [2,4,1]\nOutput: 2\nExplanation: Buy on day 1 (price = 2) and sell on day 2 (price = 4), profit = 4-2 = 2.\n
\n\n

Example 2:

\n\n
\nInput: k = 2, prices = [3,2,6,5,0,3]\nOutput: 7\nExplanation: Buy on day 2 (price = 2) and sell on day 3 (price = 6), profit = 6-2 = 4. Then buy on day 5 (price = 0) and sell on day 6 (price = 3), profit = 3-0 = 3.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= k <= 100
  • \n\t
  • 1 <= prices.length <= 1000
  • \n\t
  • 0 <= prices[i] <= 1000
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "maxProfit(2, [2,4,1])", - "maxProfit(2, [3,2,6,5,0,3])", - "maxProfit(1, [1,2])" + "--arg1=2 --arg2=[2 --arg3=4 --arg4=1]", + "--arg1=2 --arg2=[3 --arg3=2 --arg4=6 --arg5=5 --arg6=0 --arg7=3]", + "--arg1=1 --arg2=[1 --arg3=2]" ], "sample_test_results": [ "2", @@ -3503,16 +4259,16 @@ "1" ], "hidden_test_cases": [ - "maxProfit(2, [1,2,4,2,5,7,2,4,9,0])", - "maxProfit(1, [7,1,5,3,6,4])", - "maxProfit(3, [3,3,5,0,0,3,1,4])", - "maxProfit(4, [1,2,3,4,5])", - "maxProfit(2, [1,4,5,7,6,3,2,1])", - "maxProfit(3, [1])", - "maxProfit(1, [7,6,5,4,3,2])", - "maxProfit(2, [1,2,3,4,5,6])", - "maxProfit(5, [3,2,6,5,0,3,1,4])", - "maxProfit(2, [2,1,4,5,2,9,7])" + "--arg1=2 --arg2=[1 --arg3=2 --arg4=4 --arg5=2 --arg6=5 --arg7=7 --arg8=2 --arg9=4 --arg10=9 --arg11=0]", + "--arg1=1 --arg2=[7 --arg3=1 --arg4=5 --arg5=3 --arg6=6 --arg7=4]", + "--arg1=3 --arg2=[3 --arg3=3 --arg4=5 --arg5=0 --arg6=0 --arg7=3 --arg8=1 --arg9=4]", + "--arg1=4 --arg2=[1 --arg3=2 --arg4=3 --arg5=4 --arg6=5]", + "--arg1=2 --arg2=[1 --arg3=4 --arg4=5 --arg5=7 --arg6=6 --arg7=3 --arg8=2 --arg9=1]", + "--arg1=3 --arg2=1", + "--arg1=1 --arg2=[7 --arg3=6 --arg4=5 --arg5=4 --arg6=3 --arg7=2]", + "--arg1=2 --arg2=[1 --arg3=2 --arg4=3 --arg5=4 --arg6=5 --arg7=6]", + "--arg1=5 --arg2=[3 --arg3=2 --arg4=6 --arg5=5 --arg6=0 --arg7=3 --arg8=1 --arg9=4]", + "--arg1=2 --arg2=[2 --arg3=1 --arg4=4 --arg5=5 --arg6=2 --arg7=9 --arg8=7]" ], "hidden_test_results": [ "13", @@ -3526,8 +4282,17 @@ "10", "11" ], - "boilerplate": "class Solution:\n def maxProfit(self, k: int, prices: List[int]) -> int:\n ", - "compare_func": "return str(result) == expected" + "boilerplate": { + "python": "class Solution:\n def maxProfit(self, k: int, prices: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int maxProfit(int k, List prices) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxProfit(int k, vector& prices) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "std::to_string(result) == expected" + }, + "explanation": "https://www.youtube.com/watch?v=NshLjAWa03c&pp=ygUrTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJVg%3D%3D" }, { "title": "The Skyline Problem", @@ -3535,39 +4300,48 @@ "description": "

A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of all the buildings, return the skyline formed by these buildings collectively.

\n\n

The geometric information of each building is given in the array buildings where buildings[i] = [lefti, righti, heighti]:

\n\n
    \n\t
  • lefti is the x coordinate of the left edge of the ith building.
  • \n\t
  • righti is the x coordinate of the right edge of the ith building.
  • \n\t
  • heighti is the height of the ith building.
  • \n
\n\n

You may assume all buildings are perfect rectangles grounded on an absolutely flat surface at height 0.

\n\n

The skyline should be represented as a list of "key points" sorted by their x-coordinate in the form [[x1,y1],[x2,y2],...]. Each key point is the left endpoint of some horizontal segment in the skyline except the last point in the list, which always has a y-coordinate 0 and is used to mark the skyline's termination where the rightmost building ends. Any ground between the leftmost and rightmost buildings should be part of the skyline's contour.

\n\n

Note: There must be no consecutive horizontal lines of equal height in the output skyline. For instance, [...,[2 3],[4 5],[7 5],[11 5],[12 7],...] is not acceptable; the three lines of height 5 should be merged into one in the final output as such: [...,[2 3],[4 5],[12 7],...]

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: buildings = [[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]\nOutput: [[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]\nExplanation:\nFigure A shows the buildings of the input.\nFigure B shows the skyline formed by those buildings. The red points in figure B represent the key points in the output list.\n
\n\n

Example 2:

\n\n
\nInput: buildings = [[0,2,3],[2,5,3]]\nOutput: [[0,3],[5,0]]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= buildings.length <= 104
  • \n\t
  • 0 <= lefti < righti <= 231 - 1
  • \n\t
  • 1 <= heighti <= 231 - 1
  • \n\t
  • buildings is sorted by lefti in non-decreasing order.
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "getSkyline([[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]])", - "getSkyline([[0,2,3],[2,5,3]])" + "--arg1=[2,9,10 --arg2=3,7,15 --arg3=5,12,12 --arg4=15,20,10 --arg5=19,24,8 --arg6=]", + "--arg1=[0,2,3 --arg2=2,5,3 --arg3=]" ], "sample_test_results": [ - "[[2, 10], [3, 15], [7, 12], [12, 0], [15, 10], [20, 8], [24, 0]]", - "[[0, 3], [5, 0]]" + "[2, 10], [3, 15], [7, 12], [12, 0], [15, 10], [20, 8], [24, 0]", + "[0, 3], [5, 0]" ], "hidden_test_cases": [ - "getSkyline([[1,5,11],[2,7,6],[3,9,13],[12,16,7],[14,25,3],[19,22,18],[23,29,13],[24,28,4]])", - "getSkyline([[1,2,1],[1,2,2],[1,2,3]])", - "getSkyline([[1,10,10]])", - "getSkyline([[1,5,3],[2,4,4]])", - "getSkyline([[1,5,11],[2,3,13]])", - "getSkyline([[0,3,3],[1,5,3],[2,4,3]])", - "getSkyline([[2,4,70],[3,8,30],[6,100,41],[7,15,70],[10,30,102],[15,25,76],[60,80,91],[70,90,72],[85,120,59]])", - "getSkyline([[1,20,1],[1,21,2],[1,22,3]])", - "getSkyline([[0,5,7],[5,10,7],[5,10,12],[10,15,7],[15,20,7],[15,20,12],[20,25,7]])", - "getSkyline([[1,2,1]])" + "--arg1=[1,5,11 --arg2=2,7,6 --arg3=3,9,13 --arg4=12,16,7 --arg5=14,25,3 --arg6=19,22,18 --arg7=23,29,13 --arg8=24,28,4 --arg9=]", + "--arg1=[1,2,1 --arg2=1,2,2 --arg3=1,2,3 --arg4=]", + "--arg1=[1,10,10 --arg2=]", + "--arg1=[1,5,3 --arg2=2,4,4 --arg3=]", + "--arg1=[1,5,11 --arg2=2,3,13 --arg3=]", + "--arg1=[0,3,3 --arg2=1,5,3 --arg3=2,4,3 --arg4=]", + "--arg1=[2,4,70 --arg2=3,8,30 --arg3=6,100,41 --arg4=7,15,70 --arg5=10,30,102 --arg6=15,25,76 --arg7=60,80,91 --arg8=70,90,72 --arg9=85,120,59 --arg10=]", + "--arg1=[1,20,1 --arg2=1,21,2 --arg3=1,22,3 --arg4=]", + "--arg1=[0,5,7 --arg2=5,10,7 --arg3=5,10,12 --arg4=10,15,7 --arg5=15,20,7 --arg6=15,20,12 --arg7=20,25,7 --arg8=]", + "--arg1=[1,2,1 --arg2=]" ], "hidden_test_results": [ - "[[1, 11], [3, 13], [9, 0], [12, 7], [16, 3], [19, 18], [22, 3], [23, 13], [29, 0]]", - "[[1, 3], [2, 0]]", - "[[1, 10], [10, 0]]", - "[[1, 3], [2, 4], [4, 3], [5, 0]]", - "[[1, 11], [2, 13], [3, 11], [5, 0]]", - "[[0, 3], [5, 0]]", - "[[2, 70], [4, 30], [6, 41], [7, 70], [10, 102], [30, 41], [60, 91], [80, 72], [90, 59], [120, 0]]", - "[[1, 3], [22, 0]]", - "[[0, 7], [5, 12], [10, 7], [15, 12], [20, 7], [25, 0]]", - "[[1, 1], [2, 0]]" - ], - "boilerplate": "class Solution:\n def getSkyline(self, buildings: List[List[int]]) -> List[List[int]]:\n ", - "compare_func": "return result == eval(expected)" + "[1, 11], [3, 13], [9, 0], [12, 7], [16, 3], [19, 18], [22, 3], [23, 13], [29, 0]", + "[1, 3], [2, 0]", + "[1, 10], [10, 0]", + "[1, 3], [2, 4], [4, 3], [5, 0]", + "[1, 11], [2, 13], [3, 11], [5, 0]", + "[0, 3], [5, 0]", + "[2, 70], [4, 30], [6, 41], [7, 70], [10, 102], [30, 41], [60, 91], [80, 72], [90, 59], [120, 0]", + "[1, 3], [22, 0]", + "[0, 7], [5, 12], [10, 7], [15, 12], [20, 7], [25, 0]", + "[1, 1], [2, 0]" + ], + "boilerplate": { + "python": "class Solution:\n def getSkyline(self, buildings: List[List[int]]) -> List[List[int]]:\n ", + "java": "class Solution {\n public List> getSkyline(List> buildings) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector> getSkyline(vector>& buildings) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=XhzHXj7wrwo&pp=ygUcTmVldENvZGUgVGhlIFNreWxpbmUgUHJvYmxlbQ%3D%3D" }, { "title": "Basic Calculator", @@ -3575,9 +4349,9 @@ "description": "

Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation.

\n\n

Note: You are not allowed to use any built-in function which evaluates strings as mathematical expressions, such as eval().

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "1 + 1"\nOutput: 2\n
\n\n

Example 2:

\n\n
\nInput: s = " 2-1 + 2 "\nOutput: 3\n
\n\n

Example 3:

\n\n
\nInput: s = "(1+(4+5+2)-3)+(6+8)"\nOutput: 23\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 3 * 105
  • \n\t
  • s consists of digits, '+', '-', '(', ')', and ' '.
  • \n\t
  • s represents a valid expression.
  • \n\t
  • '+' is not used as a unary operation (i.e., "+1" and "+(2 + 3)" is invalid).
  • \n\t
  • '-' could be used as a unary operation (i.e., "-1" and "-(2 + 3)" is valid).
  • \n\t
  • There will be no two consecutive operators in the input.
  • \n\t
  • Every number and running calculation will fit in a signed 32-bit integer.
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "calculate(\"1 + 1\")", - "calculate(\" 2-1 + 2 \")", - "calculate(\"(1+(4+5+2)-3)+(6+8)\")" + "--arg1=\"1 + 1\"", + "--arg1=\" 2-1 + 2 \"", + "--arg1=\"(1+(4+5+2)-3)+(6+8)\"" ], "sample_test_results": [ "2", @@ -3585,16 +4359,16 @@ "23" ], "hidden_test_cases": [ - "calculate(\"2147483647\")", - "calculate(\"1 + (2 + 3)\")", - "calculate(\"-(2 + 3)\")", - "calculate(\"(1+(4+5+2)-3)+(6+8)\")", - "calculate(\"2-4-(8+2-6+(8+4-(1)+8-10))\")", - "calculate(\"(5-(1+(5)))\")", - "calculate(\"(-2)+3\")", - "calculate(\"1-(-2)\")", - "calculate(\"1+2-3+(4+5-6)\")", - "calculate(\"(7)-(0)+(4)\")" + "--arg1=\"2147483647\"", + "--arg1=\"1 + (2 + 3)\"", + "--arg1=\"-(2 + 3)\"", + "--arg1=\"(1+(4+5+2)-3)+(6+8)\"", + "--arg1=\"2-4-(8+2-6+(8+4-(1)+8-10))\"", + "--arg1=\"(5-(1+(5)))\"", + "--arg1=\"(-2)+3\"", + "--arg1=\"1-(-2)\"", + "--arg1=\"1+2-3+(4+5-6)\"", + "--arg1=\"(7)-(0)+(4)\"" ], "hidden_test_results": [ "2147483647", @@ -3608,8 +4382,17 @@ "3", "11" ], - "boilerplate": "class Solution:\n def calculate(self, s: str) -> int:\n ", - "compare_func": "return int(result) == int(expected)" + "boilerplate": { + "python": "class Solution:\n def calculate(self, s: str) -> int:\n ", + "java": "class Solution {\n public int calculate(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int calculate(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return stoi(result) == stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=zsJ-J08Qgdk&pp=ygUZTmVldENvZGUgQmFzaWMgQ2FsY3VsYXRvcg%3D%3D" }, { "title": "Sliding Window Maximum", @@ -3617,39 +4400,48 @@ "description": "

You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.

\n\n

Return the max sliding window.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,3,-1,-3,5,3,6,7], k = 3\nOutput: [3,3,5,5,6,7]\nExplanation: \nWindow position                Max\n---------------               -----\n[1  3  -1] -3  5  3  6  7       3\n 1 [3  -1  -3] 5  3  6  7       3\n 1  3 [-1  -3  5] 3  6  7       5\n 1  3  -1 [-3  5  3] 6  7       5\n 1  3  -1  -3 [5  3  6] 7       6\n 1  3  -1  -3  5 [3  6  7]      7\n
\n\n

Example 2:

\n\n
\nInput: nums = [1], k = 1\nOutput: [1]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • 1 <= k <= nums.length
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "maxSlidingWindow([1,3,-1,-3,5,3,6,7], 3)", - "maxSlidingWindow([1], 1)" + "--arg1=1,3,-1,-3,5,3,6,7 --arg2=3", + "--arg1=1 --arg2=1" ], "sample_test_results": [ - "[3, 3, 5, 5, 6, 7]", - "[1]" + "3, 3, 5, 5, 6, 7", + "1" ], "hidden_test_cases": [ - "maxSlidingWindow([1,3,1,2,0,5], 3)", - "maxSlidingWindow([7,2,4], 2)", - "maxSlidingWindow([1,-1], 1)", - "maxSlidingWindow([1,2,3,4,5], 5)", - "maxSlidingWindow([1,2,3,4,5,6], 1)", - "maxSlidingWindow([-7,-8,7,5,7,1,6,0], 4)", - "maxSlidingWindow([1,1,1,1], 2)", - "maxSlidingWindow([4,2,0,-1,3,5], 3)", - "maxSlidingWindow([-1,-2,-3,-4], 2)", - "maxSlidingWindow([1,2,3,2,1], 3)" + "--arg1=1,3,1,2,0,5 --arg2=3", + "--arg1=7,2,4 --arg2=2", + "--arg1=1,-1 --arg2=1", + "--arg1=1,2,3,4,5 --arg2=5", + "--arg1=1,2,3,4,5,6 --arg2=1", + "--arg1=-7,-8,7,5,7,1,6,0 --arg2=4", + "--arg1=1,1,1,1 --arg2=2", + "--arg1=4,2,0,-1,3,5 --arg2=3", + "--arg1=-1,-2,-3,-4 --arg2=2", + "--arg1=1,2,3,2,1 --arg2=3" ], "hidden_test_results": [ - "[3, 3, 2, 5]", - "[7, 4]", - "[1, -1]", - "[5]", - "[1, 2, 3, 4, 5, 6]", - "[7, 7, 7, 7, 7]", - "[1, 1, 1]", - "[4, 2, 3, 5]", - "[-1, -2, -3]", - "[3, 3, 3]" - ], - "boilerplate": "class Solution:\n def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:\n ", - "compare_func": "return result == eval(expected)" + "3, 3, 2, 5", + "7, 4", + "1, -1", + "5", + "1, 2, 3, 4, 5, 6", + "7, 7, 7, 7, 7", + "1, 1, 1", + "4, 2, 3, 5", + "-1, -2, -3", + "3, 3, 3" + ], + "boilerplate": { + "python": "class Solution:\n def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:\n ", + "java": "class Solution {\n public List maxSlidingWindow(List nums, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::vector maxSlidingWindow(std::vector& nums, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == eval(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=DfljaUwZsOk&pp=ygUfTmVldENvZGUgU2xpZGluZyBXaW5kb3cgTWF4aW11bQ%3D%3D" }, { "title": "Expression Add Operators", @@ -3657,41 +4449,50 @@ "description": "

Given a string num that contains only digits and an integer target, return all possibilities to insert the binary operators '+', '-', and/or '*' between the digits of num so that the resultant expression evaluates to the target value.

\n\n

Note that operands in the returned expressions should not contain leading zeros.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = "123", target = 6\nOutput: ["1*2*3","1+2+3"]\nExplanation: Both "1*2*3" and "1+2+3" evaluate to 6.\n
\n\n

Example 2:

\n\n
\nInput: num = "232", target = 8\nOutput: ["2*3+2","2+3*2"]\nExplanation: Both "2*3+2" and "2+3*2" evaluate to 8.\n
\n\n

Example 3:

\n\n
\nInput: num = "3456237490", target = 9191\nOutput: []\nExplanation: There are no expressions that can be created from "3456237490" to evaluate to 9191.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num.length <= 10
  • \n\t
  • num consists of only digits.
  • \n\t
  • -231 <= target <= 231 - 1
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "addOperators(\"123\", 6)", - "addOperators(\"232\", 8)", - "addOperators(\"3456237490\", 9191)" + "--arg1=\"123\" --arg2=6", + "--arg1=\"232\" --arg2=8", + "--arg1=\"3456237490\" --arg2=9191" ], "sample_test_results": [ - "['1+2+3', '1*2*3']", - "['2+3*2', '2*3+2']", - "[]" + "'1+2+3', '1*2*3'", + "'2+3*2', '2*3+2'", + "" ], "hidden_test_cases": [ - "addOperators(\"123\", 6)", - "addOperators(\"232\", 8)", - "addOperators(\"105\", 5)", - "addOperators(\"00\", 0)", - "addOperators(\"3456237490\", 9191)", - "addOperators(\"1000000009\", 9)", - "addOperators(\"2147483648\", -2147483648)", - "addOperators(\"999999999\", 999999999)", - "addOperators(\"01\", 1)", - "addOperators(\"1234\", 11)" + "--arg1=\"123\" --arg2=6", + "--arg1=\"232\" --arg2=8", + "--arg1=\"105\" --arg2=5", + "--arg1=\"00\" --arg2=0", + "--arg1=\"3456237490\" --arg2=9191", + "--arg1=\"1000000009\" --arg2=9", + "--arg1=\"2147483648\" --arg2=-2147483648", + "--arg1=\"999999999\" --arg2=999999999", + "--arg1=\"01\" --arg2=1", + "--arg1=\"1234\" --arg2=11" ], "hidden_test_results": [ - "['1+2+3', '1*2*3']", - "['2+3*2', '2*3+2']", - "['1*0+5', '10-5']", - "['0+0', '0-0', '0*0']", - "[]", - "['1*0+0+0+0+0+0+0+0+9', '1*0+0+0+0+0+0+0-0+9', '1*0+0+0+0+0+0+0*0+9', '1*0+0+0+0+0+0-0+0+9', '1*0+0+0+0+0+0-0-0+9', '1*0+0+0+0+0+0-0*0+9', '1*0+0+0+0+0+0*0+0+9', '1*0+0+0+0+0+0*0-0+9', '1*0+0+0+0+0+0*0*0+9', '1*0+0+0+0+0-0+0+0+9', '1*0+0+0+0+0-0+0-0+9', '1*0+0+0+0+0-0+0*0+9', '1*0+0+0+0+0-0-0+0+9', '1*0+0+0+0+0-0-0-0+9', '1*0+0+0+0+0-0-0*0+9', '1*0+0+0+0+0-0*0+0+9', '1*0+0+0+0+0-0*0-0+9', '1*0+0+0+0+0-0*0*0+9', '1*0+0+0+0+0*0+0+0+9', '1*0+0+0+0+0*0+0-0+9', '1*0+0+0+0+0*0+0*0+9', '1*0+0+0+0+0*0-0+0+9', '1*0+0+0+0+0*0-0-0+9', '1*0+0+0+0+0*0-0*0+9', '1*0+0+0+0+0*0*0+0+9', '1*0+0+0+0+0*0*0-0+9', '1*0+0+0+0+0*0*0*0+9', '1*0+0+0+0-0+0+0+0+9', '1*0+0+0+0-0+0+0-0+9', '1*0+0+0+0-0+0+0*0+9', '1*0+0+0+0-0+0-0+0+9', '1*0+0+0+0-0+0-0-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0*0*0-0*0*0+9', '1*0*0*0*0*0*0+0+0+9', '1*0*0*0*0*0*0+0-0+9', '1*0*0*0*0*0*0+0*0+9', '1*0*0*0*0*0*0-0+0+9', '1*0*0*0*0*0*0-0-0+9', '1*0*0*0*0*0*0-0*0+9', '1*0*0*0*0*0*0*0+0+9', '1*0*0*0*0*0*0*0-0+9', '1*0*0*0*0*0*0*0*0+9', '10*0+0+0+0+0+0+0+9', '10*0+0+0+0+0+0-0+9', '10*0+0+0+0+0+0*0+9', '10*0+0+0+0+0-0+0+9', '10*0+0+0+0+0-0-0+9', '10*0+0+0+0+0-0*0+9', '10*0+0+0+0+0*0+0+9', '10*0+0+0+0+0*0-0+9', '10*0+0+0+0+0*0*0+9', '10*0+0+0+0-0+0+0+9', '10*0+0+0+0-0+0-0+9', '10*0+0+0+0-0+0*0+9', '10*0+0+0+0-0-0+0+9', '10*0+0+0+0-0-0-0+9', '10*0+0+0+0-0-0*0+9', '10*0+0+0+0-0*0+0+9', '10*0+0+0+0-0*0-0+9', '10*0+0+0+0-0*0*0+9', '10*0+0+0+0*0+0+0+9', '10*0+0+0+0*0+0-0+9', '10*0+0+0+0*0+0*0+9', '10*0+0+0+0*0-0+0+9', '10*0+0+0+0*0-0-0+9', '10*0+0+0+0*0-0*0+9', '10*0+0+0+0*0*0+0+9', '10*0+0+0+0*0*0-0+9', '10*0+0+0+0*0*0*0+9', '10*0+0+0-0+0+0+0+9', '10*0+0+0-0+0+0-0+9', '10*0+0+0-0+0+0*0+9', '10*0+0+0-0+0-0+0+9', '10*0+0+0-0+0-0-0+9', '10*0+0+0-0+0-0*0+9', '10*0+0+0-0+0*0+0+9', '10*0+0+0-0+0*0-0+9', '10*0+0+0-0+0*0*0+9', '10*0+0+0-0-0+0+0+9', '10*0+0+0-0-0+0-0+9', '10*0+0+0-0-0+0*0+9', '10*0+0+0-0-0-0+0+9', '10*0+0+0-0-0-0-0+9', '10*0+0+0-0-0-0*0+9', '10*0+0+0-0-0*0+0+9', '10*0+0+0-0-0*0-0+9', '10*0+0+0-0-0*0*0+9', '10*0+0+0-0*0+0+0+9', '10*0+0+0-0*0+0-0+9', '10*0+0+0-0*0+0*0+9', '10*0+0+0-0*0-0+0+9', '10*0+0+0-0*0-0-0+9', '10*0+0+0-0*0-0*0+9', '10*0+0+0-0*0*0+0+9', '10*0+0+0-0*0*0-0+9', '10*0+0+0-0*0*0*0+9', '10*0+0+0*0+0+0+0+9', '10*0+0+0*0+0+0-0+9', '10*0+0+0*0+0+0*0+9', '10*0+0+0*0+0-0+0+9', '10*0+0+0*0+0-0-0+9', '10*0+0+0*0+0-0*0+9', '10*0+0+0*0+0*0+0+9', '10*0+0+0*0+0*0-0+9', '10*0+0+0*0+0*0*0+9', '10*0+0+0*0-0+0+0+9', '10*0+0+0*0-0+0-0+9', '10*0+0+0*0-0+0*0+9', '10*0+0+0*0-0-0+0+9', '10*0+0+0*0-0-0-0+9', '10*0+0+0*0-0-0*0+9', '10*0+0+0*0-0*0+0+9', '10*0+0+0*0-0*0-0+9', '10*0+0+0*0-0*0*0+9', '10*0+0+0*0*0+0+0+9', '10*0+0+0*0*0+0-0+9', '10*0+0+0*0*0+0*0+9', '10*0+0+0*0*0-0+0+9', '10*0+0+0*0*0-0-0+9', '10*0+0+0*0*0-0*0+9', '10*0+0+0*0*0*0+0+9', '10*0+0+0*0*0*0-0+9', '10*0+0+0*0*0*0*0+9', '10*0+0-0+0+0+0+0+9', '10*0+0-0+0+0+0-0+9', '10*0+0-0+0+0+0*0+9', '10*0+0-0+0+0-0+0+9', '10*0+0-0+0+0-0-0+9', '10*0+0-0+0+0-0*0+9', '10*0+0-0+0+0*0+0+9', '10*0+0-0+0+0*0-0+9', '10*0+0-0+0+0*0*0+9', '10*0+0-0+0-0+0+0+9', '10*0+0-0+0-0+0-0+9', '10*0+0-0+0-0+0*0+9', '10*0+0-0+0-0-0+0+9', '10*0+0-0+0-0-0-0+9', '10*0+0-0+0-0-0*0+9', '10*0+0-0+0-0*0+0+9', '10*0+0-0+0-0*0-0+9', '10*0+0-0+0-0*0*0+9', '10*0+0-0+0*0+0+0+9', '10*0+0-0+0*0+0-0+9', '10*0+0-0+0*0+0*0+9', '10*0+0-0+0*0-0+0+9', '10*0+0-0+0*0-0-0+9', '10*0+0-0+0*0-0*0+9', '10*0+0-0+0*0*0+0+9', '10*0+0-0+0*0*0-0+9', '10*0+0-0+0*0*0*0+9', '10*0+0-0-0+0+0+0+9', '10*0+0-0-0+0+0-0+9', '10*0+0-0-0+0+0*0+9', '10*0+0-0-0+0-0+0+9', '10*0+0-0-0+0-0-0+9', '10*0+0-0-0+0-0*0+9', '10*0+0-0-0+0*0+0+9', '10*0+0-0-0+0*0-0+9', '10*0+0-0-0+0*0*0+9', '10*0+0-0-0-0+0+0+9', '10*0+0-0-0-0+0-0+9', '10*0+0-0-0-0+0*0+9', '10*0+0-0-0-0-0+0+9', '10*0+0-0-0-0-0-0+9', '10*0+0-0-0-0-0*0+9', '10*0+0-0-0-0*0+0+9', '10*0+0-0-0-0*0-0+9', '10*0+0-0-0-0*0*0+9', '10*0+0-0-0*0+0+0+9', '10*0+0-0-0*0+0-0+9', '10*0+0-0-0*0+0*0+9', '10*0+0-0-0*0-0+0+9', '10*0+0-0-0*0-0-0+9', '10*0+0-0-0*0-0*0+9', '10*0+0-0-0*0*0+0+9', '10*0+0-0-0*0*0-0+9', '10*0+0-0-0*0*0*0+9', '10*0+0-0*0+0+0+0+9', '10*0+0-0*0+0+0-0+9', '10*0+0-0*0+0+0*0+9', '10*0+0-0*0+0-0+0+9', '10*0+0-0*0+0-0-0+9', '10*0+0-0*0+0-0*0+9', '10*0+0-0*0+0*0+0+9', '10*0+0-0*0+0*0-0+9', '10*0+0-0*0+0*0*0+9', '10*0+0-0*0-0+0+0+9', '10*0+0-0*0-0+0-0+9', '10*0+0-0*0-0+0*0+9', '10*0+0-0*0-0-0+0+9', '10*0+0-0*0-0-0-0+9', '10*0+0-0*0-0-0*0+9', '10*0+0-0*0-0*0+0+9', '10*0+0-0*0-0*0-0+9', '10*0+0-0*0-0*0*0+9', '10*0+0-0*0*0+0+0+9', '10*0+0-0*0*0+0-0+9', '10*0+0-0*0*0+0*0+9', '10*0+0-0*0*0-0+0+9', '10*0+0-0*0*0-0-0+9', '10*0+0-0*0*0-0*0+9', '10*0+0-0*0*0*0+0+9', '10*0+0-0*0*0*0-0+9', '10*0+0-0*0*0*0*0+9', '10*0+0*0+0+0+0+0+9', '10*0+0*0+0+0+0-0+9', '10*0+0*0+0+0+0*0+9', '10*0+0*0+0+0-0+0+9', '10*0+0*0+0+0-0-0+9', '10*0+0*0+0+0-0*0+9', '10*0+0*0+0+0*0+0+9', '10*0+0*0+0+0*0-0+9', '10*0+0*0+0+0*0*0+9', '10*0+0*0+0-0+0+0+9', '10*0+0*0+0-0+0-0+9', '10*0+0*0+0-0+0*0+9', '10*0+0*0+0-0-0+0+9', '10*0+0*0+0-0-0-0+9', '10*0+0*0+0-0-0*0+9', '10*0+0*0+0-0*0+0+9', '10*0+0*0+0-0*0-0+9', '10*0+0*0+0-0*0*0+9', '10*0+0*0+0*0+0+0+9', '10*0+0*0+0*0+0-0+9', '10*0+0*0+0*0+0*0+9', '10*0+0*0+0*0-0+0+9', '10*0+0*0+0*0-0-0+9', '10*0+0*0+0*0-0*0+9', '10*0+0*0+0*0*0+0+9', '10*0+0*0+0*0*0-0+9', '10*0+0*0+0*0*0*0+9', '10*0+0*0-0+0+0+0+9', '10*0+0*0-0+0+0-0+9', '10*0+0*0-0+0+0*0+9', '10*0+0*0-0+0-0+0+9', '10*0+0*0-0+0-0-0+9', '10*0+0*0-0+0-0*0+9', '10*0+0*0-0+0*0+0+9', '10*0+0*0-0+0*0-0+9', '10*0+0*0-0+0*0*0+9', '10*0+0*0-0-0+0+0+9', '10*0+0*0-0-0+0-0+9', '10*0+0*0-0-0+0*0+9', '10*0+0*0-0-0-0+0+9', '10*0+0*0-0-0-0-0+9', '10*0+0*0-0-0-0*0+9', '10*0+0*0-0-0*0+0+9', '10*0+0*0-0-0*0-0+9', '10*0+0*0-0-0*0*0+9', '10*0+0*0-0*0+0+0+9', '10*0+0*0-0*0+0-0+9', '10*0+0*0-0*0+0*0+9', '10*0+0*0-0*0-0+0+9', '10*0+0*0-0*0-0-0+9', '10*0+0*0-0*0-0*0+9', '10*0+0*0-0*0*0+0+9', '10*0+0*0-0*0*0-0+9', '10*0+0*0-0*0*0*0+9', '10*0+0*0*0+0+0+0+9', '10*0+0*0*0+0+0-0+9', '10*0+0*0*0+0+0*0+9', '10*0+0*0*0+0-0+0+9', '10*0+0*0*0+0-0-0+9', '10*0+0*0*0+0-0*0+9', '10*0+0*0*0+0*0+0+9', '10*0+0*0*0+0*0-0+9', '10*0+0*0*0+0*0*0+9', '10*0+0*0*0-0+0+0+9', '10*0+0*0*0-0+0-0+9', '10*0+0*0*0-0+0*0+9', '10*0+0*0*0-0-0+0+9', '10*0+0*0*0-0-0-0+9', '10*0+0*0*0-0-0*0+9', '10*0+0*0*0-0*0+0+9', '10*0+0*0*0-0*0-0+9', '10*0+0*0*0-0*0*0+9', '10*0+0*0*0*0+0+0+9', '10*0+0*0*0*0+0-0+9', '10*0+0*0*0*0+0*0+9', '10*0+0*0*0*0-0+0+9', '10*0+0*0*0*0-0-0+9', '10*0+0*0*0*0-0*0+9', '10*0+0*0*0*0*0+0+9', '10*0+0*0*0*0*0-0+9', '10*0+0*0*0*0*0*0+9', '10*0-0+0+0+0+0+0+9', '10*0-0+0+0+0+0-0+9', '10*0-0+0+0+0+0*0+9', '10*0-0+0+0+0-0+0+9', '10*0-0+0+0+0-0-0+9', '10*0-0+0+0+0-0*0+9', '10*0-0+0+0+0*0+0+9', '10*0-0+0+0+0*0-0+9', '10*0-0+0+0+0*0*0+9', '10*0-0+0+0-0+0+0+9', '10*0-0+0+0-0+0-0+9', '10*0-0+0+0-0+0*0+9', '10*0-0+0+0-0-0+0+9', '10*0-0+0+0-0-0-0+9', '10*0-0+0+0-0-0*0+9', '10*0-0+0+0-0*0+0+9', '10*0-0+0+0-0*0-0+9', '10*0-0+0+0-0*0*0+9', '10*0-0+0+0*0+0+0+9', '10*0-0+0+0*0+0-0+9', '10*0-0+0+0*0+0*0+9', '10*0-0+0+0*0-0+0+9', '10*0-0+0+0*0-0-0+9', '10*0-0+0+0*0-0*0+9', '10*0-0+0+0*0*0+0+9', '10*0-0+0+0*0*0-0+9', '10*0-0+0+0*0*0*0+9', '10*0-0+0-0+0+0+0+9', '10*0-0+0-0+0+0-0+9', '10*0-0+0-0+0+0*0+9', '10*0-0+0-0+0-0+0+9', '10*0-0+0-0+0-0-0+9', '10*0-0+0-0+0-0*0+9', '10*0-0+0-0+0*0+0+9', '10*0-0+0-0+0*0-0+9', '10*0-0+0-0+0*0*0+9', '10*0-0+0-0-0+0+0+9', '10*0-0+0-0-0+0-0+9', '10*0-0+0-0-0+0*0+9', '10*0-0+0-0-0-0+0+9', '10*0-0+0-0-0-0-0+9', '10*0-0+0-0-0-0*0+9', '10*0-0+0-0-0*0+0+9', '10*0-0+0-0-0*0-0+9', '10*0-0+0-0-0*0*0+9', '10*0-0+0-0*0+0+0+9', '10*0-0+0-0*0+0-0+9', '10*0-0+0-0*0+0*0+9', '10*0-0+0-0*0-0+0+9', '10*0-0+0-0*0-0-0+9', '10*0-0+0-0*0-0*0+9', '10*0-0+0-0*0*0+0+9', '10*0-0+0-0*0*0-0+9', '10*0-0+0-0*0*0*0+9', '10*0-0+0*0+0+0+0+9', '10*0-0+0*0+0+0-0+9', '10*0-0+0*0+0+0*0+9', '10*0-0+0*0+0-0+0+9', '10*0-0+0*0+0-0-0+9', '10*0-0+0*0+0-0*0+9', '10*0-0+0*0+0*0+0+9', '10*0-0+0*0+0*0-0+9', '10*0-0+0*0+0*0*0+9', '10*0-0+0*0-0+0+0+9', '10*0-0+0*0-0+0-0+9', '10*0-0+0*0-0+0*0+9', '10*0-0+0*0-0-0+0+9', '10*0-0+0*0-0-0-0+9', '10*0-0+0*0-0-0*0+9', '10*0-0+0*0-0*0+0+9', '10*0-0+0*0-0*0-0+9', '10*0-0+0*0-0*0*0+9', '10*0-0+0*0*0+0+0+9', '10*0-0+0*0*0+0-0+9', '10*0-0+0*0*0+0*0+9', '10*0-0+0*0*0-0+0+9', '10*0-0+0*0*0-0-0+9', '10*0-0+0*0*0-0*0+9', '10*0-0+0*0*0*0+0+9', '10*0-0+0*0*0*0-0+9', '10*0-0+0*0*0*0*0+9', '10*0-0-0+0+0+0+0+9', '10*0-0-0+0+0+0-0+9', '10*0-0-0+0+0+0*0+9', '10*0-0-0+0+0-0+0+9', '10*0-0-0+0+0-0-0+9', '10*0-0-0+0+0-0*0+9', '10*0-0-0+0+0*0+0+9', '10*0-0-0+0+0*0-0+9', '10*0-0-0+0+0*0*0+9', '10*0-0-0+0-0+0+0+9', '10*0-0-0+0-0+0-0+9', '10*0-0-0+0-0+0*0+9', '10*0-0-0+0-0-0+0+9', '10*0-0-0+0-0-0-0+9', '10*0-0-0+0-0-0*0+9', '10*0-0-0+0-0*0+0+9', '10*0-0-0+0-0*0-0+9', '10*0-0-0+0-0*0*0+9', '10*0-0-0+0*0+0+0+9', '10*0-0-0+0*0+0-0+9', '10*0-0-0+0*0+0*0+9', '10*0-0-0+0*0-0+0+9', '10*0-0-0+0*0-0-0+9', '10*0-0-0+0*0-0*0+9', '10*0-0-0+0*0*0+0+9', '10*0-0-0+0*0*0-0+9', '10*0-0-0+0*0*0*0+9', '10*0-0-0-0+0+0+0+9', '10*0-0-0-0+0+0-0+9', '10*0-0-0-0+0+0*0+9', '10*0-0-0-0+0-0+0+9', '10*0-0-0-0+0-0-0+9', '10*0-0-0-0+0-0*0+9', '10*0-0-0-0+0*0+0+9', '10*0-0-0-0+0*0-0+9', '10*0-0-0-0+0*0*0+9', '10*0-0-0-0-0+0+0+9', '10*0-0-0-0-0+0-0+9', '10*0-0-0-0-0+0*0+9', '10*0-0-0-0-0-0+0+9', '10*0-0-0-0-0-0-0+9', '10*0-0-0-0-0-0*0+9', '10*0-0-0-0-0*0+0+9', '10*0-0-0-0-0*0-0+9', '10*0-0-0-0-0*0*0+9', '10*0-0-0-0*0+0+0+9', '10*0-0-0-0*0+0-0+9', '10*0-0-0-0*0+0*0+9', '10*0-0-0-0*0-0+0+9', '10*0-0-0-0*0-0-0+9', '10*0-0-0-0*0-0*0+9', '10*0-0-0-0*0*0+0+9', '10*0-0-0-0*0*0-0+9', '10*0-0-0-0*0*0*0+9', '10*0-0-0*0+0+0+0+9', '10*0-0-0*0+0+0-0+9', '10*0-0-0*0+0+0*0+9', '10*0-0-0*0+0-0+0+9', '10*0-0-0*0+0-0-0+9', '10*0-0-0*0+0-0*0+9', '10*0-0-0*0+0*0+0+9', '10*0-0-0*0+0*0-0+9', '10*0-0-0*0+0*0*0+9', '10*0-0-0*0-0+0+0+9', '10*0-0-0*0-0+0-0+9', '10*0-0-0*0-0+0*0+9', '10*0-0-0*0-0-0+0+9', '10*0-0-0*0-0-0-0+9', '10*0-0-0*0-0-0*0+9', '10*0-0-0*0-0*0+0+9', '10*0-0-0*0-0*0-0+9', '10*0-0-0*0-0*0*0+9', '10*0-0-0*0*0+0+0+9', '10*0-0-0*0*0+0-0+9', '10*0-0-0*0*0+0*0+9', '10*0-0-0*0*0-0+0+9', '10*0-0-0*0*0-0-0+9', '10*0-0-0*0*0-0*0+9', '10*0-0-0*0*0*0+0+9', '10*0-0-0*0*0*0-0+9', '10*0-0-0*0*0*0*0+9', '10*0-0*0+0+0+0+0+9', '10*0-0*0+0+0+0-0+9', '10*0-0*0+0+0+0*0+9', '10*0-0*0+0+0-0+0+9', '10*0-0*0+0+0-0-0+9', '10*0-0*0+0+0-0*0+9', '10*0-0*0+0+0*0+0+9', '10*0-0*0+0+0*0-0+9', '10*0-0*0+0+0*0*0+9', '10*0-0*0+0-0+0+0+9', '10*0-0*0+0-0+0-0+9', '10*0-0*0+0-0+0*0+9', '10*0-0*0+0-0-0+0+9', '10*0-0*0+0-0-0-0+9', '10*0-0*0+0-0-0*0+9', '10*0-0*0+0-0*0+0+9', '10*0-0*0+0-0*0-0+9', '10*0-0*0+0-0*0*0+9', '10*0-0*0+0*0+0+0+9', '10*0-0*0+0*0+0-0+9', '10*0-0*0+0*0+0*0+9', '10*0-0*0+0*0-0+0+9', '10*0-0*0+0*0-0-0+9', '10*0-0*0+0*0-0*0+9', '10*0-0*0+0*0*0+0+9', '10*0-0*0+0*0*0-0+9', '10*0-0*0+0*0*0*0+9', '10*0-0*0-0+0+0+0+9', '10*0-0*0-0+0+0-0+9', '10*0-0*0-0+0+0*0+9', '10*0-0*0-0+0-0+0+9', '10*0-0*0-0+0-0-0+9', '10*0-0*0-0+0-0*0+9', '10*0-0*0-0+0*0+0+9', '10*0-0*0-0+0*0-0+9', '10*0-0*0-0+0*0*0+9', '10*0-0*0-0-0+0+0+9', '10*0-0*0-0-0+0-0+9', '10*0-0*0-0-0+0*0+9', '10*0-0*0-0-0-0+0+9', '10*0-0*0-0-0-0-0+9', '10*0-0*0-0-0-0*0+9', '10*0-0*0-0-0*0+0+9', '10*0-0*0-0-0*0-0+9', '10*0-0*0-0-0*0*0+9', '10*0-0*0-0*0+0+0+9', '10*0-0*0-0*0+0-0+9', '10*0-0*0-0*0+0*0+9', '10*0-0*0-0*0-0+0+9', '10*0-0*0-0*0-0-0+9', '10*0-0*0-0*0-0*0+9', '10*0-0*0-0*0*0+0+9', '10*0-0*0-0*0*0-0+9', '10*0-0*0-0*0*0*0+9', '10*0-0*0*0+0+0+0+9', '10*0-0*0*0+0+0-0+9', '10*0-0*0*0+0+0*0+9', '10*0-0*0*0+0-0+0+9', '10*0-0*0*0+0-0-0+9', '10*0-0*0*0+0-0*0+9', '10*0-0*0*0+0*0+0+9', '10*0-0*0*0+0*0-0+9', '10*0-0*0*0+0*0*0+9', '10*0-0*0*0-0+0+0+9', '10*0-0*0*0-0+0-0+9', '10*0-0*0*0-0+0*0+9', '10*0-0*0*0-0-0+0+9', '10*0-0*0*0-0-0-0+9', '10*0-0*0*0-0-0*0+9', '10*0-0*0*0-0*0+0+9', '10*0-0*0*0-0*0-0+9', '10*0-0*0*0-0*0*0+9', '10*0-0*0*0*0+0+0+9', '10*0-0*0*0*0+0-0+9', '10*0-0*0*0*0+0*0+9', '10*0-0*0*0*0-0+0+9', '10*0-0*0*0*0-0-0+9', '10*0-0*0*0*0-0*0+9', '10*0-0*0*0*0*0+0+9', '10*0-0*0*0*0*0-0+9', '10*0-0*0*0*0*0*0+9', '10*0*0+0+0+0+0+0+9', '10*0*0+0+0+0+0-0+9', '10*0*0+0+0+0+0*0+9', '10*0*0+0+0+0-0+0+9', '10*0*0+0+0+0-0-0+9', '10*0*0+0+0+0-0*0+9', '10*0*0+0+0+0*0+0+9', '10*0*0+0+0+0*0-0+9', '10*0*0+0+0+0*0*0+9', '10*0*0+0+0-0+0+0+9', '10*0*0+0+0-0+0-0+9', '10*0*0+0+0-0+0*0+9', '10*0*0+0+0-0-0+0+9', '10*0*0+0+0-0-0-0+9', '10*0*0+0+0-0-0*0+9', '10*0*0+0+0-0*0+0+9', '10*0*0+0+0-0*0-0+9', '10*0*0+0+0-0*0*0+9', '10*0*0+0+0*0+0+0+9', '10*0*0+0+0*0+0-0+9', '10*0*0+0+0*0+0*0+9', '10*0*0+0+0*0-0+0+9', '10*0*0+0+0*0-0-0+9', '10*0*0+0+0*0-0*0+9', '10*0*0+0+0*0*0+0+9', '10*0*0+0+0*0*0-0+9', '10*0*0+0+0*0*0*0+9', '10*0*0+0-0+0+0+0+9', '10*0*0+0-0+0+0-0+9', '10*0*0+0-0+0+0*0+9', '10*0*0+0-0+0-0+0+9', '10*0*0+0-0+0-0-0+9', '10*0*0+0-0+0-0*0+9', '10*0*0+0-0+0*0+0+9', '10*0*0+0-0+0*0-0+9', '10*0*0+0-0+0*0*0+9', '10*0*0+0-0-0+0+0+9', '10*0*0+0-0-0+0-0+9', '10*0*0+0-0-0+0*0+9', '10*0*0+0-0-0-0+0+9', '10*0*0+0-0-0-0-0+9', '10*0*0+0-0-0-0*0+9', '10*0*0+0-0-0*0+0+9', '10*0*0+0-0-0*0-0+9', '10*0*0+0-0-0*0*0+9', '10*0*0+0-0*0+0+0+9', '10*0*0+0-0*0+0-0+9', '10*0*0+0-0*0+0*0+9', '10*0*0+0-0*0-0+0+9', '10*0*0+0-0*0-0-0+9', '10*0*0+0-0*0-0*0+9', '10*0*0+0-0*0*0+0+9', '10*0*0+0-0*0*0-0+9', '10*0*0+0-0*0*0*0+9', '10*0*0+0*0+0+0+0+9', '10*0*0+0*0+0+0-0+9', '10*0*0+0*0+0+0*0+9', '10*0*0+0*0+0-0+0+9', '10*0*0+0*0+0-0-0+9', '10*0*0+0*0+0-0*0+9', '10*0*0+0*0+0*0+0+9', '10*0*0+0*0+0*0-0+9', '10*0*0+0*0+0*0*0+9', '10*0*0+0*0-0+0+0+9', '10*0*0+0*0-0+0-0+9', '10*0*0+0*0-0+0*0+9', '10*0*0+0*0-0-0+0+9', '10*0*0+0*0-0-0-0+9', '10*0*0+0*0-0-0*0+9', '10*0*0+0*0-0*0+0+9', '10*0*0+0*0-0*0-0+9', '10*0*0+0*0-0*0*0+9', '10*0*0+0*0*0+0+0+9', '10*0*0+0*0*0+0-0+9', '10*0*0+0*0*0+0*0+9', '10*0*0+0*0*0-0+0+9', '10*0*0+0*0*0-0-0+9', '10*0*0+0*0*0-0*0+9', '10*0*0+0*0*0*0+0+9', '10*0*0+0*0*0*0-0+9', '10*0*0+0*0*0*0*0+9', '10*0*0-0+0+0+0+0+9', '10*0*0-0+0+0+0-0+9', '10*0*0-0+0+0+0*0+9', '10*0*0-0+0+0-0+0+9', '10*0*0-0+0+0-0-0+9', '10*0*0-0+0+0-0*0+9', '10*0*0-0+0+0*0+0+9', '10*0*0-0+0+0*0-0+9', '10*0*0-0+0+0*0*0+9', '10*0*0-0+0-0+0+0+9', '10*0*0-0+0-0+0-0+9', '10*0*0-0+0-0+0*0+9', '10*0*0-0+0-0-0+0+9', '10*0*0-0+0-0-0-0+9', '10*0*0-0+0-0-0*0+9', '10*0*0-0+0-0*0+0+9', '10*0*0-0+0-0*0-0+9', '10*0*0-0+0-0*0*0+9', '10*0*0-0+0*0+0+0+9', '10*0*0-0+0*0+0-0+9', '10*0*0-0+0*0+0*0+9', '10*0*0-0+0*0-0+0+9', '10*0*0-0+0*0-0-0+9', '10*0*0-0+0*0-0*0+9', '10*0*0-0+0*0*0+0+9', '10*0*0-0+0*0*0-0+9', '10*0*0-0+0*0*0*0+9', '10*0*0-0-0+0+0+0+9', '10*0*0-0-0+0+0-0+9', '10*0*0-0-0+0+0*0+9', '10*0*0-0-0+0-0+0+9', '10*0*0-0-0+0-0-0+9', '10*0*0-0-0+0-0*0+9', '10*0*0-0-0+0*0+0+9', '10*0*0-0-0+0*0-0+9', '10*0*0-0-0+0*0*0+9', '10*0*0-0-0-0+0+0+9', '10*0*0-0-0-0+0-0+9', '10*0*0-0-0-0+0*0+9', '10*0*0-0-0-0-0+0+9', '10*0*0-0-0-0-0-0+9', '10*0*0-0-0-0-0*0+9', '10*0*0-0-0-0*0+0+9', '10*0*0-0-0-0*0-0+9', '10*0*0-0-0-0*0*0+9', '10*0*0-0-0*0+0+0+9', '10*0*0-0-0*0+0-0+9', '10*0*0-0-0*0+0*0+9', '10*0*0-0-0*0-0+0+9', '10*0*0-0-0*0-0-0+9', '10*0*0-0-0*0-0*0+9', '10*0*0-0-0*0*0+0+9', '10*0*0-0-0*0*0-0+9', '10*0*0-0-0*0*0*0+9', '10*0*0-0*0+0+0+0+9', '10*0*0-0*0+0+0-0+9', '10*0*0-0*0+0+0*0+9', '10*0*0-0*0+0-0+0+9', '10*0*0-0*0+0-0-0+9', '10*0*0-0*0+0-0*0+9', '10*0*0-0*0+0*0+0+9', '10*0*0-0*0+0*0-0+9', '10*0*0-0*0+0*0*0+9', '10*0*0-0*0-0+0+0+9', '10*0*0-0*0-0+0-0+9', '10*0*0-0*0-0+0*0+9', '10*0*0-0*0-0-0+0+9', '10*0*0-0*0-0-0-0+9', '10*0*0-0*0-0-0*0+9', '10*0*0-0*0-0*0+0+9', '10*0*0-0*0-0*0-0+9', '10*0*0-0*0-0*0*0+9', '10*0*0-0*0*0+0+0+9', '10*0*0-0*0*0+0-0+9', '10*0*0-0*0*0+0*0+9', '10*0*0-0*0*0-0+0+9', '10*0*0-0*0*0-0-0+9', '10*0*0-0*0*0-0*0+9', '10*0*0-0*0*0*0+0+9', '10*0*0-0*0*0*0-0+9', '10*0*0-0*0*0*0*0+9', '10*0*0*0+0+0+0+0+9', '10*0*0*0+0+0+0-0+9', '10*0*0*0+0+0+0*0+9', '10*0*0*0+0+0-0+0+9', '10*0*0*0+0+0-0-0+9', '10*0*0*0+0+0-0*0+9', '10*0*0*0+0+0*0+0+9', '10*0*0*0+0+0*0-0+9', '10*0*0*0+0+0*0*0+9', '10*0*0*0+0-0+0+0+9', '10*0*0*0+0-0+0-0+9', '10*0*0*0+0-0+0*0+9', '10*0*0*0+0-0-0+0+9', '10*0*0*0+0-0-0-0+9', '10*0*0*0+0-0-0*0+9', '10*0*0*0+0-0*0+0+9', '10*0*0*0+0-0*0-0+9', '10*0*0*0+0-0*0*0+9', '10*0*0*0+0*0+0+0+9', '10*0*0*0+0*0+0-0+9', '10*0*0*0+0*0+0*0+9', '10*0*0*0+0*0-0+0+9', '10*0*0*0+0*0-0-0+9', '10*0*0*0+0*0-0*0+9', '10*0*0*0+0*0*0+0+9', '10*0*0*0+0*0*0-0+9', '10*0*0*0+0*0*0*0+9', '10*0*0*0-0+0+0+0+9', '10*0*0*0-0+0+0-0+9', '10*0*0*0-0+0+0*0+9', '10*0*0*0-0+0-0+0+9', '10*0*0*0-0+0-0-0+9', '10*0*0*0-0+0-0*0+9', '10*0*0*0-0+0*0+0+9', '10*0*0*0-0+0*0-0+9', '10*0*0*0-0+0*0*0+9', '10*0*0*0-0-0+0+0+9', '10*0*0*0-0-0+0-0+9', '10*0*0*0-0-0+0*0+9', '10*0*0*0-0-0-0+0+9', '10*0*0*0-0-0-0-0+9', '10*0*0*0-0-0-0*0+9', '10*0*0*0-0-0*0+0+9', '10*0*0*0-0-0*0-0+9', '10*0*0*0-0-0*0*0+9', '10*0*0*0-0*0+0+0+9', '10*0*0*0-0*0+0-0+9', '10*0*0*0-0*0+0*0+9', '10*0*0*0-0*0-0+0+9', '10*0*0*0-0*0-0-0+9', '10*0*0*0-0*0-0*0+9', '10*0*0*0-0*0*0+0+9', '10*0*0*0-0*0*0-0+9', '10*0*0*0-0*0*0*0+9', '10*0*0*0*0+0+0+0+9', '10*0*0*0*0+0+0-0+9', '10*0*0*0*0+0+0*0+9', '10*0*0*0*0+0-0+0+9', '10*0*0*0*0+0-0-0+9', '10*0*0*0*0+0-0*0+9', '10*0*0*0*0+0*0+0+9', '10*0*0*0*0+0*0-0+9', '10*0*0*0*0+0*0*0+9', '10*0*0*0*0-0+0+0+9', '10*0*0*0*0-0+0-0+9', '10*0*0*0*0-0+0*0+9', '10*0*0*0*0-0-0+0+9', '10*0*0*0*0-0-0-0+9', '10*0*0*0*0-0-0*0+9', '10*0*0*0*0-0*0+0+9', '10*0*0*0*0-0*0-0+9', '10*0*0*0*0-0*0*0+9', '10*0*0*0*0*0+0+0+9', '10*0*0*0*0*0+0-0+9', '10*0*0*0*0*0+0*0+9', '10*0*0*0*0*0-0+0+9', '10*0*0*0*0*0-0-0+9', '10*0*0*0*0*0-0*0+9', '10*0*0*0*0*0*0+0+9', '10*0*0*0*0*0*0-0+9', '10*0*0*0*0*0*0*0+9', '100*0+0+0+0+0+0+9', '100*0+0+0+0+0-0+9', '100*0+0+0+0+0*0+9', '100*0+0+0+0-0+0+9', '100*0+0+0+0-0-0+9', '100*0+0+0+0-0*0+9', '100*0+0+0+0*0+0+9', '100*0+0+0+0*0-0+9', '100*0+0+0+0*0*0+9', '100*0+0+0-0+0+0+9', '100*0+0+0-0+0-0+9', '100*0+0+0-0+0*0+9', '100*0+0+0-0-0+0+9', '100*0+0+0-0-0-0+9', '100*0+0+0-0-0*0+9', '100*0+0+0-0*0+0+9', '100*0+0+0-0*0-0+9', '100*0+0+0-0*0*0+9', '100*0+0+0*0+0+0+9', '100*0+0+0*0+0-0+9', '100*0+0+0*0+0*0+9', '100*0+0+0*0-0+0+9', '100*0+0+0*0-0-0+9', '100*0+0+0*0-0*0+9', '100*0+0+0*0*0+0+9', '100*0+0+0*0*0-0+9', '100*0+0+0*0*0*0+9', '100*0+0-0+0+0+0+9', '100*0+0-0+0+0-0+9', '100*0+0-0+0+0*0+9', '100*0+0-0+0-0+0+9', '100*0+0-0+0-0-0+9', '100*0+0-0+0-0*0+9', '100*0+0-0+0*0+0+9', '100*0+0-0+0*0-0+9', '100*0+0-0+0*0*0+9', '100*0+0-0-0+0+0+9', '100*0+0-0-0+0-0+9', '100*0+0-0-0+0*0+9', '100*0+0-0-0-0+0+9', '100*0+0-0-0-0-0+9', '100*0+0-0-0-0*0+9', '100*0+0-0-0*0+0+9', '100*0+0-0-0*0-0+9', '100*0+0-0-0*0*0+9', '100*0+0-0*0+0+0+9', '100*0+0-0*0+0-0+9', '100*0+0-0*0+0*0+9', '100*0+0-0*0-0+0+9', '100*0+0-0*0-0-0+9', '100*0+0-0*0-0*0+9', '100*0+0-0*0*0+0+9', '100*0+0-0*0*0-0+9', '100*0+0-0*0*0*0+9', '100*0+0*0+0+0+0+9', '100*0+0*0+0+0-0+9', '100*0+0*0+0+0*0+9', '100*0+0*0+0-0+0+9', '100*0+0*0+0-0-0+9', '100*0+0*0+0-0*0+9', '100*0+0*0+0*0+0+9', '100*0+0*0+0*0-0+9', '100*0+0*0+0*0*0+9', '100*0+0*0-0+0+0+9', '100*0+0*0-0+0-0+9', '100*0+0*0-0+0*0+9', '100*0+0*0-0-0+0+9', '100*0+0*0-0-0-0+9', '100*0+0*0-0-0*0+9', '100*0+0*0-0*0+0+9', '100*0+0*0-0*0-0+9', '100*0+0*0-0*0*0+9', '100*0+0*0*0+0+0+9', '100*0+0*0*0+0-0+9', '100*0+0*0*0+0*0+9', '100*0+0*0*0-0+0+9', '100*0+0*0*0-0-0+9', '100*0+0*0*0-0*0+9', '100*0+0*0*0*0+0+9', '100*0+0*0*0*0-0+9', '100*0+0*0*0*0*0+9', '100*0-0+0+0+0+0+9', '100*0-0+0+0+0-0+9', '100*0-0+0+0+0*0+9', '100*0-0+0+0-0+0+9', '100*0-0+0+0-0-0+9', '100*0-0+0+0-0*0+9', '100*0-0+0+0*0+0+9', '100*0-0+0+0*0-0+9', '100*0-0+0+0*0*0+9', '100*0-0+0-0+0+0+9', '100*0-0+0-0+0-0+9', '100*0-0+0-0+0*0+9', '100*0-0+0-0-0+0+9', '100*0-0+0-0-0-0+9', '100*0-0+0-0-0*0+9', '100*0-0+0-0*0+0+9', '100*0-0+0-0*0-0+9', '100*0-0+0-0*0*0+9', '100*0-0+0*0+0+0+9', '100*0-0+0*0+0-0+9', '100*0-0+0*0+0*0+9', '100*0-0+0*0-0+0+9', '100*0-0+0*0-0-0+9', '100*0-0+0*0-0*0+9', '100*0-0+0*0*0+0+9', '100*0-0+0*0*0-0+9', '100*0-0+0*0*0*0+9', '100*0-0-0+0+0+0+9', '100*0-0-0+0+0-0+9', '100*0-0-0+0+0*0+9', '100*0-0-0+0-0+0+9', '100*0-0-0+0-0-0+9', '100*0-0-0+0-0*0+9', '100*0-0-0+0*0+0+9', '100*0-0-0+0*0-0+9', '100*0-0-0+0*0*0+9', '100*0-0-0-0+0+0+9', '100*0-0-0-0+0-0+9', '100*0-0-0-0+0*0+9', '100*0-0-0-0-0+0+9', '100*0-0-0-0-0-0+9', '100*0-0-0-0-0*0+9', '100*0-0-0-0*0+0+9', '100*0-0-0-0*0-0+9', '100*0-0-0-0*0*0+9', '100*0-0-0*0+0+0+9', '100*0-0-0*0+0-0+9', '100*0-0-0*0+0*0+9', '100*0-0-0*0-0+0+9', '100*0-0-0*0-0-0+9', '100*0-0-0*0-0*0+9', '100*0-0-0*0*0+0+9', '100*0-0-0*0*0-0+9', '100*0-0-0*0*0*0+9', '100*0-0*0+0+0+0+9', '100*0-0*0+0+0-0+9', '100*0-0*0+0+0*0+9', '100*0-0*0+0-0+0+9', '100*0-0*0+0-0-0+9', '100*0-0*0+0-0*0+9', '100*0-0*0+0*0+0+9', '100*0-0*0+0*0-0+9', '100*0-0*0+0*0*0+9', '100*0-0*0-0+0+0+9', '100*0-0*0-0+0-0+9', '100*0-0*0-0+0*0+9', '100*0-0*0-0-0+0+9', '100*0-0*0-0-0-0+9', '100*0-0*0-0-0*0+9', '100*0-0*0-0*0+0+9', '100*0-0*0-0*0-0+9', '100*0-0*0-0*0*0+9', '100*0-0*0*0+0+0+9', '100*0-0*0*0+0-0+9', '100*0-0*0*0+0*0+9', '100*0-0*0*0-0+0+9', '100*0-0*0*0-0-0+9', '100*0-0*0*0-0*0+9', '100*0-0*0*0*0+0+9', '100*0-0*0*0*0-0+9', '100*0-0*0*0*0*0+9', '100*0*0+0+0+0+0+9', '100*0*0+0+0+0-0+9', '100*0*0+0+0+0*0+9', '100*0*0+0+0-0+0+9', '100*0*0+0+0-0-0+9', '100*0*0+0+0-0*0+9', '100*0*0+0+0*0+0+9', '100*0*0+0+0*0-0+9', '100*0*0+0+0*0*0+9', '100*0*0+0-0+0+0+9', '100*0*0+0-0+0-0+9', '100*0*0+0-0+0*0+9', '100*0*0+0-0-0+0+9', '100*0*0+0-0-0-0+9', '100*0*0+0-0-0*0+9', '100*0*0+0-0*0+0+9', '100*0*0+0-0*0-0+9', '100*0*0+0-0*0*0+9', '100*0*0+0*0+0+0+9', '100*0*0+0*0+0-0+9', '100*0*0+0*0+0*0+9', '100*0*0+0*0-0+0+9', '100*0*0+0*0-0-0+9', '100*0*0+0*0-0*0+9', '100*0*0+0*0*0+0+9', '100*0*0+0*0*0-0+9', '100*0*0+0*0*0*0+9', '100*0*0-0+0+0+0+9', '100*0*0-0+0+0-0+9', '100*0*0-0+0+0*0+9', '100*0*0-0+0-0+0+9', '100*0*0-0+0-0-0+9', '100*0*0-0+0-0*0+9', '100*0*0-0+0*0+0+9', '100*0*0-0+0*0-0+9', '100*0*0-0+0*0*0+9', '100*0*0-0-0+0+0+9', '100*0*0-0-0+0-0+9', '100*0*0-0-0+0*0+9', '100*0*0-0-0-0+0+9', '100*0*0-0-0-0-0+9', '100*0*0-0-0-0*0+9', '100*0*0-0-0*0+0+9', '100*0*0-0-0*0-0+9', '100*0*0-0-0*0*0+9', '100*0*0-0*0+0+0+9', '100*0*0-0*0+0-0+9', '100*0*0-0*0+0*0+9', '100*0*0-0*0-0+0+9', '100*0*0-0*0-0-0+9', '100*0*0-0*0-0*0+9', '100*0*0-0*0*0+0+9', '100*0*0-0*0*0-0+9', '100*0*0-0*0*0*0+9', '100*0*0*0+0+0+0+9', '100*0*0*0+0+0-0+9', '100*0*0*0+0+0*0+9', '100*0*0*0+0-0+0+9', '100*0*0*0+0-0-0+9', '100*0*0*0+0-0*0+9', '100*0*0*0+0*0+0+9', '100*0*0*0+0*0-0+9', '100*0*0*0+0*0*0+9', '100*0*0*0-0+0+0+9', '100*0*0*0-0+0-0+9', '100*0*0*0-0+0*0+9', '100*0*0*0-0-0+0+9', '100*0*0*0-0-0-0+9', '100*0*0*0-0-0*0+9', '100*0*0*0-0*0+0+9', '100*0*0*0-0*0-0+9', '100*0*0*0-0*0*0+9', '100*0*0*0*0+0+0+9', '100*0*0*0*0+0-0+9', '100*0*0*0*0+0*0+9', '100*0*0*0*0-0+0+9', '100*0*0*0*0-0-0+9', '100*0*0*0*0-0*0+9', '100*0*0*0*0*0+0+9', '100*0*0*0*0*0-0+9', '100*0*0*0*0*0*0+9', '1000*0+0+0+0+0+9', '1000*0+0+0+0-0+9', '1000*0+0+0+0*0+9', '1000*0+0+0-0+0+9', '1000*0+0+0-0-0+9', '1000*0+0+0-0*0+9', '1000*0+0+0*0+0+9', '1000*0+0+0*0-0+9', '1000*0+0+0*0*0+9', '1000*0+0-0+0+0+9', '1000*0+0-0+0-0+9', '1000*0+0-0+0*0+9', '1000*0+0-0-0+0+9', '1000*0+0-0-0-0+9', '1000*0+0-0-0*0+9', '1000*0+0-0*0+0+9', '1000*0+0-0*0-0+9', '1000*0+0-0*0*0+9', '1000*0+0*0+0+0+9', '1000*0+0*0+0-0+9', '1000*0+0*0+0*0+9', '1000*0+0*0-0+0+9', '1000*0+0*0-0-0+9', '1000*0+0*0-0*0+9', '1000*0+0*0*0+0+9', '1000*0+0*0*0-0+9', '1000*0+0*0*0*0+9', '1000*0-0+0+0+0+9', '1000*0-0+0+0-0+9', '1000*0-0+0+0*0+9', '1000*0-0+0-0+0+9', '1000*0-0+0-0-0+9', '1000*0-0+0-0*0+9', '1000*0-0+0*0+0+9', '1000*0-0+0*0-0+9', '1000*0-0+0*0*0+9', '1000*0-0-0+0+0+9', '1000*0-0-0+0-0+9', '1000*0-0-0+0*0+9', '1000*0-0-0-0+0+9', '1000*0-0-0-0-0+9', '1000*0-0-0-0*0+9', '1000*0-0-0*0+0+9', '1000*0-0-0*0-0+9', '1000*0-0-0*0*0+9', '1000*0-0*0+0+0+9', '1000*0-0*0+0-0+9', '1000*0-0*0+0*0+9', '1000*0-0*0-0+0+9', '1000*0-0*0-0-0+9', '1000*0-0*0-0*0+9', '1000*0-0*0*0+0+9', '1000*0-0*0*0-0+9', '1000*0-0*0*0*0+9', '1000*0*0+0+0+0+9', '1000*0*0+0+0-0+9', '1000*0*0+0+0*0+9', '1000*0*0+0-0+0+9', '1000*0*0+0-0-0+9', '1000*0*0+0-0*0+9', '1000*0*0+0*0+0+9', '1000*0*0+0*0-0+9', '1000*0*0+0*0*0+9', '1000*0*0-0+0+0+9', '1000*0*0-0+0-0+9', '1000*0*0-0+0*0+9', '1000*0*0-0-0+0+9', '1000*0*0-0-0-0+9', '1000*0*0-0-0*0+9', '1000*0*0-0*0+0+9', '1000*0*0-0*0-0+9', '1000*0*0-0*0*0+9', '1000*0*0*0+0+0+9', '1000*0*0*0+0-0+9', '1000*0*0*0+0*0+9', '1000*0*0*0-0+0+9', '1000*0*0*0-0-0+9', '1000*0*0*0-0*0+9', '1000*0*0*0*0+0+9', '1000*0*0*0*0-0+9', '1000*0*0*0*0*0+9', '10000*0+0+0+0+9', '10000*0+0+0-0+9', '10000*0+0+0*0+9', '10000*0+0-0+0+9', '10000*0+0-0-0+9', '10000*0+0-0*0+9', '10000*0+0*0+0+9', '10000*0+0*0-0+9', '10000*0+0*0*0+9', '10000*0-0+0+0+9', '10000*0-0+0-0+9', '10000*0-0+0*0+9', '10000*0-0-0+0+9', '10000*0-0-0-0+9', '10000*0-0-0*0+9', '10000*0-0*0+0+9', '10000*0-0*0-0+9', '10000*0-0*0*0+9', '10000*0*0+0+0+9', '10000*0*0+0-0+9', '10000*0*0+0*0+9', '10000*0*0-0+0+9', '10000*0*0-0-0+9', '10000*0*0-0*0+9', '10000*0*0*0+0+9', '10000*0*0*0-0+9', '10000*0*0*0*0+9', '100000*0+0+0+9', '100000*0+0-0+9', '100000*0+0*0+9', '100000*0-0+0+9', '100000*0-0-0+9', '100000*0-0*0+9', '100000*0*0+0+9', '100000*0*0-0+9', '100000*0*0*0+9', '1000000*0+0+9', '1000000*0-0+9', '1000000*0*0+9', '10000000*0+9']", - "[]", - "['999999999']", - "['0+1']", - "['1+2*3+4', '1-2+3*4', '12+3-4']" - ], - "boilerplate": "class Solution:\n def addOperators(self, num: str, target: int) -> List[str]:\n ", - "compare_func": "return sorted(result) == sorted(eval(expected))" + "'1+2+3', '1*2*3'", + "'2+3*2', '2*3+2'", + "'1*0+5', '10-5'", + "'0+0', '0-0', '0*0'", + "", + "'1*0+0+0+0+0+0+0+0+9', '1*0+0+0+0+0+0+0-0+9', '1*0+0+0+0+0+0+0*0+9', '1*0+0+0+0+0+0-0+0+9', '1*0+0+0+0+0+0-0-0+9', '1*0+0+0+0+0+0-0*0+9', '1*0+0+0+0+0+0*0+0+9', '1*0+0+0+0+0+0*0-0+9', '1*0+0+0+0+0+0*0*0+9', '1*0+0+0+0+0-0+0+0+9', '1*0+0+0+0+0-0+0-0+9', '1*0+0+0+0+0-0+0*0+9', '1*0+0+0+0+0-0-0+0+9', '1*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*0-0+9', '1*0*0*0*0-0*0*0*0+9', '1*0*0*0*0*0+0+0+0+9', '1*0*0*0*0*0+0+0-0+9', '1*0*0*0*0*0+0+0*0+9', '1*0*0*0*0*0+0-0+0+9', '1*0*0*0*0*0+0-0-0+9', '1*0*0*0*0*0+0-0*0+9', '1*0*0*0*0*0+0*0+0+9', '1*0*0*0*0*0+0*0-0+9', '1*0*0*0*0*0+0*0*0+9', '1*0*0*0*0*0-0+0+0+9', '1*0*0*0*0*0-0+0-0+9', '1*0*0*0*0*0-0+0*0+9', '1*0*0*0*0*0-0-0+0+9', '1*0*0*0*0*0-0-0-0+9', '1*0*0*0*0*0-0-0*0+9', '1*0*0*0*0*0-0*0+0+9', '1*0*0*0*0*0-0*0-0+9', '1*0*0*0*0*0-0*0*0+9', '1*0*0*0*0*0*0+0+0+9', '1*0*0*0*0*0*0+0-0+9', '1*0*0*0*0*0*0+0*0+9', '1*0*0*0*0*0*0-0+0+9', '1*0*0*0*0*0*0-0-0+9', '1*0*0*0*0*0*0-0*0+9', '1*0*0*0*0*0*0*0+0+9', '1*0*0*0*0*0*0*0-0+9', '1*0*0*0*0*0*0*0*0+9', '10*0+0+0+0+0+0+0+9', '10*0+0+0+0+0+0-0+9', '10*0+0+0+0+0+0*0+9', '10*0+0+0+0+0-0+0+9', '10*0+0+0+0+0-0-0+9', '10*0+0+0+0+0-0*0+9', '10*0+0+0+0+0*0+0+9', '10*0+0+0+0+0*0-0+9', '10*0+0+0+0+0*0*0+9', '10*0+0+0+0-0+0+0+9', '10*0+0+0+0-0+0-0+9', '10*0+0+0+0-0+0*0+9', '10*0+0+0+0-0-0+0+9', '10*0+0+0+0-0-0-0+9', '10*0+0+0+0-0-0*0+9', '10*0+0+0+0-0*0+0+9', '10*0+0+0+0-0*0-0+9', '10*0+0+0+0-0*0*0+9', '10*0+0+0+0*0+0+0+9', '10*0+0+0+0*0+0-0+9', '10*0+0+0+0*0+0*0+9', '10*0+0+0+0*0-0+0+9', '10*0+0+0+0*0-0-0+9', '10*0+0+0+0*0-0*0+9', '10*0+0+0+0*0*0+0+9', '10*0+0+0+0*0*0-0+9', '10*0+0+0+0*0*0*0+9', '10*0+0+0-0+0+0+0+9', '10*0+0+0-0+0+0-0+9', '10*0+0+0-0+0+0*0+9', '10*0+0+0-0+0-0+0+9', '10*0+0+0-0+0-0-0+9', '10*0+0+0-0+0-0*0+9', '10*0+0+0-0+0*0+0+9', '10*0+0+0-0+0*0-0+9', '10*0+0+0-0+0*0*0+9', '10*0+0+0-0-0+0+0+9', '10*0+0+0-0-0+0-0+9', '10*0+0+0-0-0+0*0+9', '10*0+0+0-0-0-0+0+9', '10*0+0+0-0-0-0-0+9', '10*0+0+0-0-0-0*0+9', '10*0+0+0-0-0*0+0+9', '10*0+0+0-0-0*0-0+9', '10*0+0+0-0-0*0*0+9', '10*0+0+0-0*0+0+0+9', '10*0+0+0-0*0+0-0+9', '10*0+0+0-0*0+0*0+9', '10*0+0+0-0*0-0+0+9', '10*0+0+0-0*0-0-0+9', '10*0+0+0-0*0-0*0+9', '10*0+0+0-0*0*0+0+9', '10*0+0+0-0*0*0-0+9', '10*0+0+0-0*0*0*0+9', '10*0+0+0*0+0+0+0+9', '10*0+0+0*0+0+0-0+9', '10*0+0+0*0+0+0*0+9', '10*0+0+0*0+0-0+0+9', '10*0+0+0*0+0-0-0+9', '10*0+0+0*0+0-0*0+9', '10*0+0+0*0+0*0+0+9', '10*0+0+0*0+0*0-0+9', '10*0+0+0*0+0*0*0+9', '10*0+0+0*0-0+0+0+9', '10*0+0+0*0-0+0-0+9', '10*0+0+0*0-0+0*0+9', '10*0+0+0*0-0-0+0+9', '10*0+0+0*0-0-0-0+9', '10*0+0+0*0-0-0*0+9', '10*0+0+0*0-0*0+0+9', '10*0+0+0*0-0*0-0+9', '10*0+0+0*0-0*0*0+9', '10*0+0+0*0*0+0+0+9', '10*0+0+0*0*0+0-0+9', '10*0+0+0*0*0+0*0+9', '10*0+0+0*0*0-0+0+9', '10*0+0+0*0*0-0-0+9', '10*0+0+0*0*0-0*0+9', '10*0+0+0*0*0*0+0+9', '10*0+0+0*0*0*0-0+9', '10*0+0+0*0*0*0*0+9', '10*0+0-0+0+0+0+0+9', '10*0+0-0+0+0+0-0+9', '10*0+0-0+0+0+0*0+9', '10*0+0-0+0+0-0+0+9', '10*0+0-0+0+0-0-0+9', '10*0+0-0+0+0-0*0+9', '10*0+0-0+0+0*0+0+9', '10*0+0-0+0+0*0-0+9', '10*0+0-0+0+0*0*0+9', '10*0+0-0+0-0+0+0+9', '10*0+0-0+0-0+0-0+9', '10*0+0-0+0-0+0*0+9', '10*0+0-0+0-0-0+0+9', '10*0+0-0+0-0-0-0+9', '10*0+0-0+0-0-0*0+9', '10*0+0-0+0-0*0+0+9', '10*0+0-0+0-0*0-0+9', '10*0+0-0+0-0*0*0+9', '10*0+0-0+0*0+0+0+9', '10*0+0-0+0*0+0-0+9', '10*0+0-0+0*0+0*0+9', '10*0+0-0+0*0-0+0+9', '10*0+0-0+0*0-0-0+9', '10*0+0-0+0*0-0*0+9', '10*0+0-0+0*0*0+0+9', '10*0+0-0+0*0*0-0+9', '10*0+0-0+0*0*0*0+9', '10*0+0-0-0+0+0+0+9', '10*0+0-0-0+0+0-0+9', '10*0+0-0-0+0+0*0+9', '10*0+0-0-0+0-0+0+9', '10*0+0-0-0+0-0-0+9', '10*0+0-0-0+0-0*0+9', '10*0+0-0-0+0*0+0+9', '10*0+0-0-0+0*0-0+9', '10*0+0-0-0+0*0*0+9', '10*0+0-0-0-0+0+0+9', '10*0+0-0-0-0+0-0+9', '10*0+0-0-0-0+0*0+9', '10*0+0-0-0-0-0+0+9', '10*0+0-0-0-0-0-0+9', '10*0+0-0-0-0-0*0+9', '10*0+0-0-0-0*0+0+9', '10*0+0-0-0-0*0-0+9', '10*0+0-0-0-0*0*0+9', '10*0+0-0-0*0+0+0+9', '10*0+0-0-0*0+0-0+9', '10*0+0-0-0*0+0*0+9', '10*0+0-0-0*0-0+0+9', '10*0+0-0-0*0-0-0+9', '10*0+0-0-0*0-0*0+9', '10*0+0-0-0*0*0+0+9', '10*0+0-0-0*0*0-0+9', '10*0+0-0-0*0*0*0+9', '10*0+0-0*0+0+0+0+9', '10*0+0-0*0+0+0-0+9', '10*0+0-0*0+0+0*0+9', '10*0+0-0*0+0-0+0+9', '10*0+0-0*0+0-0-0+9', '10*0+0-0*0+0-0*0+9', '10*0+0-0*0+0*0+0+9', '10*0+0-0*0+0*0-0+9', '10*0+0-0*0+0*0*0+9', '10*0+0-0*0-0+0+0+9', '10*0+0-0*0-0+0-0+9', '10*0+0-0*0-0+0*0+9', '10*0+0-0*0-0-0+0+9', '10*0+0-0*0-0-0-0+9', '10*0+0-0*0-0-0*0+9', '10*0+0-0*0-0*0+0+9', '10*0+0-0*0-0*0-0+9', '10*0+0-0*0-0*0*0+9', '10*0+0-0*0*0+0+0+9', '10*0+0-0*0*0+0-0+9', '10*0+0-0*0*0+0*0+9', '10*0+0-0*0*0-0+0+9', '10*0+0-0*0*0-0-0+9', '10*0+0-0*0*0-0*0+9', '10*0+0-0*0*0*0+0+9', '10*0+0-0*0*0*0-0+9', '10*0+0-0*0*0*0*0+9', '10*0+0*0+0+0+0+0+9', '10*0+0*0+0+0+0-0+9', '10*0+0*0+0+0+0*0+9', '10*0+0*0+0+0-0+0+9', '10*0+0*0+0+0-0-0+9', '10*0+0*0+0+0-0*0+9', '10*0+0*0+0+0*0+0+9', '10*0+0*0+0+0*0-0+9', '10*0+0*0+0+0*0*0+9', '10*0+0*0+0-0+0+0+9', '10*0+0*0+0-0+0-0+9', '10*0+0*0+0-0+0*0+9', '10*0+0*0+0-0-0+0+9', '10*0+0*0+0-0-0-0+9', '10*0+0*0+0-0-0*0+9', '10*0+0*0+0-0*0+0+9', '10*0+0*0+0-0*0-0+9', '10*0+0*0+0-0*0*0+9', '10*0+0*0+0*0+0+0+9', '10*0+0*0+0*0+0-0+9', '10*0+0*0+0*0+0*0+9', '10*0+0*0+0*0-0+0+9', '10*0+0*0+0*0-0-0+9', '10*0+0*0+0*0-0*0+9', '10*0+0*0+0*0*0+0+9', '10*0+0*0+0*0*0-0+9', '10*0+0*0+0*0*0*0+9', '10*0+0*0-0+0+0+0+9', '10*0+0*0-0+0+0-0+9', '10*0+0*0-0+0+0*0+9', '10*0+0*0-0+0-0+0+9', '10*0+0*0-0+0-0-0+9', '10*0+0*0-0+0-0*0+9', '10*0+0*0-0+0*0+0+9', '10*0+0*0-0+0*0-0+9', '10*0+0*0-0+0*0*0+9', '10*0+0*0-0-0+0+0+9', '10*0+0*0-0-0+0-0+9', '10*0+0*0-0-0+0*0+9', '10*0+0*0-0-0-0+0+9', '10*0+0*0-0-0-0-0+9', '10*0+0*0-0-0-0*0+9', '10*0+0*0-0-0*0+0+9', '10*0+0*0-0-0*0-0+9', '10*0+0*0-0-0*0*0+9', '10*0+0*0-0*0+0+0+9', '10*0+0*0-0*0+0-0+9', '10*0+0*0-0*0+0*0+9', '10*0+0*0-0*0-0+0+9', '10*0+0*0-0*0-0-0+9', '10*0+0*0-0*0-0*0+9', '10*0+0*0-0*0*0+0+9', '10*0+0*0-0*0*0-0+9', '10*0+0*0-0*0*0*0+9', '10*0+0*0*0+0+0+0+9', '10*0+0*0*0+0+0-0+9', '10*0+0*0*0+0+0*0+9', '10*0+0*0*0+0-0+0+9', '10*0+0*0*0+0-0-0+9', '10*0+0*0*0+0-0*0+9', '10*0+0*0*0+0*0+0+9', '10*0+0*0*0+0*0-0+9', '10*0+0*0*0+0*0*0+9', '10*0+0*0*0-0+0+0+9', '10*0+0*0*0-0+0-0+9', '10*0+0*0*0-0+0*0+9', '10*0+0*0*0-0-0+0+9', '10*0+0*0*0-0-0-0+9', '10*0+0*0*0-0-0*0+9', '10*0+0*0*0-0*0+0+9', '10*0+0*0*0-0*0-0+9', '10*0+0*0*0-0*0*0+9', '10*0+0*0*0*0+0+0+9', '10*0+0*0*0*0+0-0+9', '10*0+0*0*0*0+0*0+9', '10*0+0*0*0*0-0+0+9', '10*0+0*0*0*0-0-0+9', '10*0+0*0*0*0-0*0+9', '10*0+0*0*0*0*0+0+9', '10*0+0*0*0*0*0-0+9', '10*0+0*0*0*0*0*0+9', '10*0-0+0+0+0+0+0+9', '10*0-0+0+0+0+0-0+9', '10*0-0+0+0+0+0*0+9', '10*0-0+0+0+0-0+0+9', '10*0-0+0+0+0-0-0+9', '10*0-0+0+0+0-0*0+9', '10*0-0+0+0+0*0+0+9', '10*0-0+0+0+0*0-0+9', '10*0-0+0+0+0*0*0+9', '10*0-0+0+0-0+0+0+9', '10*0-0+0+0-0+0-0+9', '10*0-0+0+0-0+0*0+9', '10*0-0+0+0-0-0+0+9', '10*0-0+0+0-0-0-0+9', '10*0-0+0+0-0-0*0+9', '10*0-0+0+0-0*0+0+9', '10*0-0+0+0-0*0-0+9', '10*0-0+0+0-0*0*0+9', '10*0-0+0+0*0+0+0+9', '10*0-0+0+0*0+0-0+9', '10*0-0+0+0*0+0*0+9', '10*0-0+0+0*0-0+0+9', '10*0-0+0+0*0-0-0+9', '10*0-0+0+0*0-0*0+9', '10*0-0+0+0*0*0+0+9', '10*0-0+0+0*0*0-0+9', '10*0-0+0+0*0*0*0+9', '10*0-0+0-0+0+0+0+9', '10*0-0+0-0+0+0-0+9', '10*0-0+0-0+0+0*0+9', '10*0-0+0-0+0-0+0+9', '10*0-0+0-0+0-0-0+9', '10*0-0+0-0+0-0*0+9', '10*0-0+0-0+0*0+0+9', '10*0-0+0-0+0*0-0+9', '10*0-0+0-0+0*0*0+9', '10*0-0+0-0-0+0+0+9', '10*0-0+0-0-0+0-0+9', '10*0-0+0-0-0+0*0+9', '10*0-0+0-0-0-0+0+9', '10*0-0+0-0-0-0-0+9', '10*0-0+0-0-0-0*0+9', '10*0-0+0-0-0*0+0+9', '10*0-0+0-0-0*0-0+9', '10*0-0+0-0-0*0*0+9', '10*0-0+0-0*0+0+0+9', '10*0-0+0-0*0+0-0+9', '10*0-0+0-0*0+0*0+9', '10*0-0+0-0*0-0+0+9', '10*0-0+0-0*0-0-0+9', '10*0-0+0-0*0-0*0+9', '10*0-0+0-0*0*0+0+9', '10*0-0+0-0*0*0-0+9', '10*0-0+0-0*0*0*0+9', '10*0-0+0*0+0+0+0+9', '10*0-0+0*0+0+0-0+9', '10*0-0+0*0+0+0*0+9', '10*0-0+0*0+0-0+0+9', '10*0-0+0*0+0-0-0+9', '10*0-0+0*0+0-0*0+9', '10*0-0+0*0+0*0+0+9', '10*0-0+0*0+0*0-0+9', '10*0-0+0*0+0*0*0+9', '10*0-0+0*0-0+0+0+9', '10*0-0+0*0-0+0-0+9', '10*0-0+0*0-0+0*0+9', '10*0-0+0*0-0-0+0+9', '10*0-0+0*0-0-0-0+9', '10*0-0+0*0-0-0*0+9', '10*0-0+0*0-0*0+0+9', '10*0-0+0*0-0*0-0+9', '10*0-0+0*0-0*0*0+9', '10*0-0+0*0*0+0+0+9', '10*0-0+0*0*0+0-0+9', '10*0-0+0*0*0+0*0+9', '10*0-0+0*0*0-0+0+9', '10*0-0+0*0*0-0-0+9', '10*0-0+0*0*0-0*0+9', '10*0-0+0*0*0*0+0+9', '10*0-0+0*0*0*0-0+9', '10*0-0+0*0*0*0*0+9', '10*0-0-0+0+0+0+0+9', '10*0-0-0+0+0+0-0+9', '10*0-0-0+0+0+0*0+9', '10*0-0-0+0+0-0+0+9', '10*0-0-0+0+0-0-0+9', '10*0-0-0+0+0-0*0+9', '10*0-0-0+0+0*0+0+9', '10*0-0-0+0+0*0-0+9', '10*0-0-0+0+0*0*0+9', '10*0-0-0+0-0+0+0+9', '10*0-0-0+0-0+0-0+9', '10*0-0-0+0-0+0*0+9', '10*0-0-0+0-0-0+0+9', '10*0-0-0+0-0-0-0+9', '10*0-0-0+0-0-0*0+9', '10*0-0-0+0-0*0+0+9', '10*0-0-0+0-0*0-0+9', '10*0-0-0+0-0*0*0+9', '10*0-0-0+0*0+0+0+9', '10*0-0-0+0*0+0-0+9', '10*0-0-0+0*0+0*0+9', '10*0-0-0+0*0-0+0+9', '10*0-0-0+0*0-0-0+9', '10*0-0-0+0*0-0*0+9', '10*0-0-0+0*0*0+0+9', '10*0-0-0+0*0*0-0+9', '10*0-0-0+0*0*0*0+9', '10*0-0-0-0+0+0+0+9', '10*0-0-0-0+0+0-0+9', '10*0-0-0-0+0+0*0+9', '10*0-0-0-0+0-0+0+9', '10*0-0-0-0+0-0-0+9', '10*0-0-0-0+0-0*0+9', '10*0-0-0-0+0*0+0+9', '10*0-0-0-0+0*0-0+9', '10*0-0-0-0+0*0*0+9', '10*0-0-0-0-0+0+0+9', '10*0-0-0-0-0+0-0+9', '10*0-0-0-0-0+0*0+9', '10*0-0-0-0-0-0+0+9', '10*0-0-0-0-0-0-0+9', '10*0-0-0-0-0-0*0+9', '10*0-0-0-0-0*0+0+9', '10*0-0-0-0-0*0-0+9', '10*0-0-0-0-0*0*0+9', '10*0-0-0-0*0+0+0+9', '10*0-0-0-0*0+0-0+9', '10*0-0-0-0*0+0*0+9', '10*0-0-0-0*0-0+0+9', '10*0-0-0-0*0-0-0+9', '10*0-0-0-0*0-0*0+9', '10*0-0-0-0*0*0+0+9', '10*0-0-0-0*0*0-0+9', '10*0-0-0-0*0*0*0+9', '10*0-0-0*0+0+0+0+9', '10*0-0-0*0+0+0-0+9', '10*0-0-0*0+0+0*0+9', '10*0-0-0*0+0-0+0+9', '10*0-0-0*0+0-0-0+9', '10*0-0-0*0+0-0*0+9', '10*0-0-0*0+0*0+0+9', '10*0-0-0*0+0*0-0+9', '10*0-0-0*0+0*0*0+9', '10*0-0-0*0-0+0+0+9', '10*0-0-0*0-0+0-0+9', '10*0-0-0*0-0+0*0+9', '10*0-0-0*0-0-0+0+9', '10*0-0-0*0-0-0-0+9', '10*0-0-0*0-0-0*0+9', '10*0-0-0*0-0*0+0+9', '10*0-0-0*0-0*0-0+9', '10*0-0-0*0-0*0*0+9', '10*0-0-0*0*0+0+0+9', '10*0-0-0*0*0+0-0+9', '10*0-0-0*0*0+0*0+9', '10*0-0-0*0*0-0+0+9', '10*0-0-0*0*0-0-0+9', '10*0-0-0*0*0-0*0+9', '10*0-0-0*0*0*0+0+9', '10*0-0-0*0*0*0-0+9', '10*0-0-0*0*0*0*0+9', '10*0-0*0+0+0+0+0+9', '10*0-0*0+0+0+0-0+9', '10*0-0*0+0+0+0*0+9', '10*0-0*0+0+0-0+0+9', '10*0-0*0+0+0-0-0+9', '10*0-0*0+0+0-0*0+9', '10*0-0*0+0+0*0+0+9', '10*0-0*0+0+0*0-0+9', '10*0-0*0+0+0*0*0+9', '10*0-0*0+0-0+0+0+9', '10*0-0*0+0-0+0-0+9', '10*0-0*0+0-0+0*0+9', '10*0-0*0+0-0-0+0+9', '10*0-0*0+0-0-0-0+9', '10*0-0*0+0-0-0*0+9', '10*0-0*0+0-0*0+0+9', '10*0-0*0+0-0*0-0+9', '10*0-0*0+0-0*0*0+9', '10*0-0*0+0*0+0+0+9', '10*0-0*0+0*0+0-0+9', '10*0-0*0+0*0+0*0+9', '10*0-0*0+0*0-0+0+9', '10*0-0*0+0*0-0-0+9', '10*0-0*0+0*0-0*0+9', '10*0-0*0+0*0*0+0+9', '10*0-0*0+0*0*0-0+9', '10*0-0*0+0*0*0*0+9', '10*0-0*0-0+0+0+0+9', '10*0-0*0-0+0+0-0+9', '10*0-0*0-0+0+0*0+9', '10*0-0*0-0+0-0+0+9', '10*0-0*0-0+0-0-0+9', '10*0-0*0-0+0-0*0+9', '10*0-0*0-0+0*0+0+9', '10*0-0*0-0+0*0-0+9', '10*0-0*0-0+0*0*0+9', '10*0-0*0-0-0+0+0+9', '10*0-0*0-0-0+0-0+9', '10*0-0*0-0-0+0*0+9', '10*0-0*0-0-0-0+0+9', '10*0-0*0-0-0-0-0+9', '10*0-0*0-0-0-0*0+9', '10*0-0*0-0-0*0+0+9', '10*0-0*0-0-0*0-0+9', '10*0-0*0-0-0*0*0+9', '10*0-0*0-0*0+0+0+9', '10*0-0*0-0*0+0-0+9', '10*0-0*0-0*0+0*0+9', '10*0-0*0-0*0-0+0+9', '10*0-0*0-0*0-0-0+9', '10*0-0*0-0*0-0*0+9', '10*0-0*0-0*0*0+0+9', '10*0-0*0-0*0*0-0+9', '10*0-0*0-0*0*0*0+9', '10*0-0*0*0+0+0+0+9', '10*0-0*0*0+0+0-0+9', '10*0-0*0*0+0+0*0+9', '10*0-0*0*0+0-0+0+9', '10*0-0*0*0+0-0-0+9', '10*0-0*0*0+0-0*0+9', '10*0-0*0*0+0*0+0+9', '10*0-0*0*0+0*0-0+9', '10*0-0*0*0+0*0*0+9', '10*0-0*0*0-0+0+0+9', '10*0-0*0*0-0+0-0+9', '10*0-0*0*0-0+0*0+9', '10*0-0*0*0-0-0+0+9', '10*0-0*0*0-0-0-0+9', '10*0-0*0*0-0-0*0+9', '10*0-0*0*0-0*0+0+9', '10*0-0*0*0-0*0-0+9', '10*0-0*0*0-0*0*0+9', '10*0-0*0*0*0+0+0+9', '10*0-0*0*0*0+0-0+9', '10*0-0*0*0*0+0*0+9', '10*0-0*0*0*0-0+0+9', '10*0-0*0*0*0-0-0+9', '10*0-0*0*0*0-0*0+9', '10*0-0*0*0*0*0+0+9', '10*0-0*0*0*0*0-0+9', '10*0-0*0*0*0*0*0+9', '10*0*0+0+0+0+0+0+9', '10*0*0+0+0+0+0-0+9', '10*0*0+0+0+0+0*0+9', '10*0*0+0+0+0-0+0+9', '10*0*0+0+0+0-0-0+9', '10*0*0+0+0+0-0*0+9', '10*0*0+0+0+0*0+0+9', '10*0*0+0+0+0*0-0+9', '10*0*0+0+0+0*0*0+9', '10*0*0+0+0-0+0+0+9', '10*0*0+0+0-0+0-0+9', '10*0*0+0+0-0+0*0+9', '10*0*0+0+0-0-0+0+9', '10*0*0+0+0-0-0-0+9', '10*0*0+0+0-0-0*0+9', '10*0*0+0+0-0*0+0+9', '10*0*0+0+0-0*0-0+9', '10*0*0+0+0-0*0*0+9', '10*0*0+0+0*0+0+0+9', '10*0*0+0+0*0+0-0+9', '10*0*0+0+0*0+0*0+9', '10*0*0+0+0*0-0+0+9', '10*0*0+0+0*0-0-0+9', '10*0*0+0+0*0-0*0+9', '10*0*0+0+0*0*0+0+9', '10*0*0+0+0*0*0-0+9', '10*0*0+0+0*0*0*0+9', '10*0*0+0-0+0+0+0+9', '10*0*0+0-0+0+0-0+9', '10*0*0+0-0+0+0*0+9', '10*0*0+0-0+0-0+0+9', '10*0*0+0-0+0-0-0+9', '10*0*0+0-0+0-0*0+9', '10*0*0+0-0+0*0+0+9', '10*0*0+0-0+0*0-0+9', '10*0*0+0-0+0*0*0+9', '10*0*0+0-0-0+0+0+9', '10*0*0+0-0-0+0-0+9', '10*0*0+0-0-0+0*0+9', '10*0*0+0-0-0-0+0+9', '10*0*0+0-0-0-0-0+9', '10*0*0+0-0-0-0*0+9', '10*0*0+0-0-0*0+0+9', '10*0*0+0-0-0*0-0+9', '10*0*0+0-0-0*0*0+9', '10*0*0+0-0*0+0+0+9', '10*0*0+0-0*0+0-0+9', '10*0*0+0-0*0+0*0+9', '10*0*0+0-0*0-0+0+9', '10*0*0+0-0*0-0-0+9', '10*0*0+0-0*0-0*0+9', '10*0*0+0-0*0*0+0+9', '10*0*0+0-0*0*0-0+9', '10*0*0+0-0*0*0*0+9', '10*0*0+0*0+0+0+0+9', '10*0*0+0*0+0+0-0+9', '10*0*0+0*0+0+0*0+9', '10*0*0+0*0+0-0+0+9', '10*0*0+0*0+0-0-0+9', '10*0*0+0*0+0-0*0+9', '10*0*0+0*0+0*0+0+9', '10*0*0+0*0+0*0-0+9', '10*0*0+0*0+0*0*0+9', '10*0*0+0*0-0+0+0+9', '10*0*0+0*0-0+0-0+9', '10*0*0+0*0-0+0*0+9', '10*0*0+0*0-0-0+0+9', '10*0*0+0*0-0-0-0+9', '10*0*0+0*0-0-0*0+9', '10*0*0+0*0-0*0+0+9', '10*0*0+0*0-0*0-0+9', '10*0*0+0*0-0*0*0+9', '10*0*0+0*0*0+0+0+9', '10*0*0+0*0*0+0-0+9', '10*0*0+0*0*0+0*0+9', '10*0*0+0*0*0-0+0+9', '10*0*0+0*0*0-0-0+9', '10*0*0+0*0*0-0*0+9', '10*0*0+0*0*0*0+0+9', '10*0*0+0*0*0*0-0+9', '10*0*0+0*0*0*0*0+9', '10*0*0-0+0+0+0+0+9', '10*0*0-0+0+0+0-0+9', '10*0*0-0+0+0+0*0+9', '10*0*0-0+0+0-0+0+9', '10*0*0-0+0+0-0-0+9', '10*0*0-0+0+0-0*0+9', '10*0*0-0+0+0*0+0+9', '10*0*0-0+0+0*0-0+9', '10*0*0-0+0+0*0*0+9', '10*0*0-0+0-0+0+0+9', '10*0*0-0+0-0+0-0+9', '10*0*0-0+0-0+0*0+9', '10*0*0-0+0-0-0+0+9', '10*0*0-0+0-0-0-0+9', '10*0*0-0+0-0-0*0+9', '10*0*0-0+0-0*0+0+9', '10*0*0-0+0-0*0-0+9', '10*0*0-0+0-0*0*0+9', '10*0*0-0+0*0+0+0+9', '10*0*0-0+0*0+0-0+9', '10*0*0-0+0*0+0*0+9', '10*0*0-0+0*0-0+0+9', '10*0*0-0+0*0-0-0+9', '10*0*0-0+0*0-0*0+9', '10*0*0-0+0*0*0+0+9', '10*0*0-0+0*0*0-0+9', '10*0*0-0+0*0*0*0+9', '10*0*0-0-0+0+0+0+9', '10*0*0-0-0+0+0-0+9', '10*0*0-0-0+0+0*0+9', '10*0*0-0-0+0-0+0+9', '10*0*0-0-0+0-0-0+9', '10*0*0-0-0+0-0*0+9', '10*0*0-0-0+0*0+0+9', '10*0*0-0-0+0*0-0+9', '10*0*0-0-0+0*0*0+9', '10*0*0-0-0-0+0+0+9', '10*0*0-0-0-0+0-0+9', '10*0*0-0-0-0+0*0+9', '10*0*0-0-0-0-0+0+9', '10*0*0-0-0-0-0-0+9', '10*0*0-0-0-0-0*0+9', '10*0*0-0-0-0*0+0+9', '10*0*0-0-0-0*0-0+9', '10*0*0-0-0-0*0*0+9', '10*0*0-0-0*0+0+0+9', '10*0*0-0-0*0+0-0+9', '10*0*0-0-0*0+0*0+9', '10*0*0-0-0*0-0+0+9', '10*0*0-0-0*0-0-0+9', '10*0*0-0-0*0-0*0+9', '10*0*0-0-0*0*0+0+9', '10*0*0-0-0*0*0-0+9', '10*0*0-0-0*0*0*0+9', '10*0*0-0*0+0+0+0+9', '10*0*0-0*0+0+0-0+9', '10*0*0-0*0+0+0*0+9', '10*0*0-0*0+0-0+0+9', '10*0*0-0*0+0-0-0+9', '10*0*0-0*0+0-0*0+9', '10*0*0-0*0+0*0+0+9', '10*0*0-0*0+0*0-0+9', '10*0*0-0*0+0*0*0+9', '10*0*0-0*0-0+0+0+9', '10*0*0-0*0-0+0-0+9', '10*0*0-0*0-0+0*0+9', '10*0*0-0*0-0-0+0+9', '10*0*0-0*0-0-0-0+9', '10*0*0-0*0-0-0*0+9', '10*0*0-0*0-0*0+0+9', '10*0*0-0*0-0*0-0+9', '10*0*0-0*0-0*0*0+9', '10*0*0-0*0*0+0+0+9', '10*0*0-0*0*0+0-0+9', '10*0*0-0*0*0+0*0+9', '10*0*0-0*0*0-0+0+9', '10*0*0-0*0*0-0-0+9', '10*0*0-0*0*0-0*0+9', '10*0*0-0*0*0*0+0+9', '10*0*0-0*0*0*0-0+9', '10*0*0-0*0*0*0*0+9', '10*0*0*0+0+0+0+0+9', '10*0*0*0+0+0+0-0+9', '10*0*0*0+0+0+0*0+9', '10*0*0*0+0+0-0+0+9', '10*0*0*0+0+0-0-0+9', '10*0*0*0+0+0-0*0+9', '10*0*0*0+0+0*0+0+9', '10*0*0*0+0+0*0-0+9', '10*0*0*0+0+0*0*0+9', '10*0*0*0+0-0+0+0+9', '10*0*0*0+0-0+0-0+9', '10*0*0*0+0-0+0*0+9', '10*0*0*0+0-0-0+0+9', '10*0*0*0+0-0-0-0+9', '10*0*0*0+0-0-0*0+9', '10*0*0*0+0-0*0+0+9', '10*0*0*0+0-0*0-0+9', '10*0*0*0+0-0*0*0+9', '10*0*0*0+0*0+0+0+9', '10*0*0*0+0*0+0-0+9', '10*0*0*0+0*0+0*0+9', '10*0*0*0+0*0-0+0+9', '10*0*0*0+0*0-0-0+9', '10*0*0*0+0*0-0*0+9', '10*0*0*0+0*0*0+0+9', '10*0*0*0+0*0*0-0+9', '10*0*0*0+0*0*0*0+9', '10*0*0*0-0+0+0+0+9', '10*0*0*0-0+0+0-0+9', '10*0*0*0-0+0+0*0+9', '10*0*0*0-0+0-0+0+9', '10*0*0*0-0+0-0-0+9', '10*0*0*0-0+0-0*0+9', '10*0*0*0-0+0*0+0+9', '10*0*0*0-0+0*0-0+9', '10*0*0*0-0+0*0*0+9', '10*0*0*0-0-0+0+0+9', '10*0*0*0-0-0+0-0+9', '10*0*0*0-0-0+0*0+9', '10*0*0*0-0-0-0+0+9', '10*0*0*0-0-0-0-0+9', '10*0*0*0-0-0-0*0+9', '10*0*0*0-0-0*0+0+9', '10*0*0*0-0-0*0-0+9', '10*0*0*0-0-0*0*0+9', '10*0*0*0-0*0+0+0+9', '10*0*0*0-0*0+0-0+9', '10*0*0*0-0*0+0*0+9', '10*0*0*0-0*0-0+0+9', '10*0*0*0-0*0-0-0+9', '10*0*0*0-0*0-0*0+9', '10*0*0*0-0*0*0+0+9', '10*0*0*0-0*0*0-0+9', '10*0*0*0-0*0*0*0+9', '10*0*0*0*0+0+0+0+9', '10*0*0*0*0+0+0-0+9', '10*0*0*0*0+0+0*0+9', '10*0*0*0*0+0-0+0+9', '10*0*0*0*0+0-0-0+9', '10*0*0*0*0+0-0*0+9', '10*0*0*0*0+0*0+0+9', '10*0*0*0*0+0*0-0+9', '10*0*0*0*0+0*0*0+9', '10*0*0*0*0-0+0+0+9', '10*0*0*0*0-0+0-0+9', '10*0*0*0*0-0+0*0+9', '10*0*0*0*0-0-0+0+9', '10*0*0*0*0-0-0-0+9', '10*0*0*0*0-0-0*0+9', '10*0*0*0*0-0*0+0+9', '10*0*0*0*0-0*0-0+9', '10*0*0*0*0-0*0*0+9', '10*0*0*0*0*0+0+0+9', '10*0*0*0*0*0+0-0+9', '10*0*0*0*0*0+0*0+9', '10*0*0*0*0*0-0+0+9', '10*0*0*0*0*0-0-0+9', '10*0*0*0*0*0-0*0+9', '10*0*0*0*0*0*0+0+9', '10*0*0*0*0*0*0-0+9', '10*0*0*0*0*0*0*0+9', '100*0+0+0+0+0+0+9', '100*0+0+0+0+0-0+9', '100*0+0+0+0+0*0+9', '100*0+0+0+0-0+0+9', '100*0+0+0+0-0-0+9', '100*0+0+0+0-0*0+9', '100*0+0+0+0*0+0+9', '100*0+0+0+0*0-0+9', '100*0+0+0+0*0*0+9', '100*0+0+0-0+0+0+9', '100*0+0+0-0+0-0+9', '100*0+0+0-0+0*0+9', '100*0+0+0-0-0+0+9', '100*0+0+0-0-0-0+9', '100*0+0+0-0-0*0+9', '100*0+0+0-0*0+0+9', '100*0+0+0-0*0-0+9', '100*0+0+0-0*0*0+9', '100*0+0+0*0+0+0+9', '100*0+0+0*0+0-0+9', '100*0+0+0*0+0*0+9', '100*0+0+0*0-0+0+9', '100*0+0+0*0-0-0+9', '100*0+0+0*0-0*0+9', '100*0+0+0*0*0+0+9', '100*0+0+0*0*0-0+9', '100*0+0+0*0*0*0+9', '100*0+0-0+0+0+0+9', '100*0+0-0+0+0-0+9', '100*0+0-0+0+0*0+9', '100*0+0-0+0-0+0+9', '100*0+0-0+0-0-0+9', '100*0+0-0+0-0*0+9', '100*0+0-0+0*0+0+9', '100*0+0-0+0*0-0+9', '100*0+0-0+0*0*0+9', '100*0+0-0-0+0+0+9', '100*0+0-0-0+0-0+9', '100*0+0-0-0+0*0+9', '100*0+0-0-0-0+0+9', '100*0+0-0-0-0-0+9', '100*0+0-0-0-0*0+9', '100*0+0-0-0*0+0+9', '100*0+0-0-0*0-0+9', '100*0+0-0-0*0*0+9', '100*0+0-0*0+0+0+9', '100*0+0-0*0+0-0+9', '100*0+0-0*0+0*0+9', '100*0+0-0*0-0+0+9', '100*0+0-0*0-0-0+9', '100*0+0-0*0-0*0+9', '100*0+0-0*0*0+0+9', '100*0+0-0*0*0-0+9', '100*0+0-0*0*0*0+9', '100*0+0*0+0+0+0+9', '100*0+0*0+0+0-0+9', '100*0+0*0+0+0*0+9', '100*0+0*0+0-0+0+9', '100*0+0*0+0-0-0+9', '100*0+0*0+0-0*0+9', '100*0+0*0+0*0+0+9', '100*0+0*0+0*0-0+9', '100*0+0*0+0*0*0+9', '100*0+0*0-0+0+0+9', '100*0+0*0-0+0-0+9', '100*0+0*0-0+0*0+9', '100*0+0*0-0-0+0+9', '100*0+0*0-0-0-0+9', '100*0+0*0-0-0*0+9', '100*0+0*0-0*0+0+9', '100*0+0*0-0*0-0+9', '100*0+0*0-0*0*0+9', '100*0+0*0*0+0+0+9', '100*0+0*0*0+0-0+9', '100*0+0*0*0+0*0+9', '100*0+0*0*0-0+0+9', '100*0+0*0*0-0-0+9', '100*0+0*0*0-0*0+9', '100*0+0*0*0*0+0+9', '100*0+0*0*0*0-0+9', '100*0+0*0*0*0*0+9', '100*0-0+0+0+0+0+9', '100*0-0+0+0+0-0+9', '100*0-0+0+0+0*0+9', '100*0-0+0+0-0+0+9', '100*0-0+0+0-0-0+9', '100*0-0+0+0-0*0+9', '100*0-0+0+0*0+0+9', '100*0-0+0+0*0-0+9', '100*0-0+0+0*0*0+9', '100*0-0+0-0+0+0+9', '100*0-0+0-0+0-0+9', '100*0-0+0-0+0*0+9', '100*0-0+0-0-0+0+9', '100*0-0+0-0-0-0+9', '100*0-0+0-0-0*0+9', '100*0-0+0-0*0+0+9', '100*0-0+0-0*0-0+9', '100*0-0+0-0*0*0+9', '100*0-0+0*0+0+0+9', '100*0-0+0*0+0-0+9', '100*0-0+0*0+0*0+9', '100*0-0+0*0-0+0+9', '100*0-0+0*0-0-0+9', '100*0-0+0*0-0*0+9', '100*0-0+0*0*0+0+9', '100*0-0+0*0*0-0+9', '100*0-0+0*0*0*0+9', '100*0-0-0+0+0+0+9', '100*0-0-0+0+0-0+9', '100*0-0-0+0+0*0+9', '100*0-0-0+0-0+0+9', '100*0-0-0+0-0-0+9', '100*0-0-0+0-0*0+9', '100*0-0-0+0*0+0+9', '100*0-0-0+0*0-0+9', '100*0-0-0+0*0*0+9', '100*0-0-0-0+0+0+9', '100*0-0-0-0+0-0+9', '100*0-0-0-0+0*0+9', '100*0-0-0-0-0+0+9', '100*0-0-0-0-0-0+9', '100*0-0-0-0-0*0+9', '100*0-0-0-0*0+0+9', '100*0-0-0-0*0-0+9', '100*0-0-0-0*0*0+9', '100*0-0-0*0+0+0+9', '100*0-0-0*0+0-0+9', '100*0-0-0*0+0*0+9', '100*0-0-0*0-0+0+9', '100*0-0-0*0-0-0+9', '100*0-0-0*0-0*0+9', '100*0-0-0*0*0+0+9', '100*0-0-0*0*0-0+9', '100*0-0-0*0*0*0+9', '100*0-0*0+0+0+0+9', '100*0-0*0+0+0-0+9', '100*0-0*0+0+0*0+9', '100*0-0*0+0-0+0+9', '100*0-0*0+0-0-0+9', '100*0-0*0+0-0*0+9', '100*0-0*0+0*0+0+9', '100*0-0*0+0*0-0+9', '100*0-0*0+0*0*0+9', '100*0-0*0-0+0+0+9', '100*0-0*0-0+0-0+9', '100*0-0*0-0+0*0+9', '100*0-0*0-0-0+0+9', '100*0-0*0-0-0-0+9', '100*0-0*0-0-0*0+9', '100*0-0*0-0*0+0+9', '100*0-0*0-0*0-0+9', '100*0-0*0-0*0*0+9', '100*0-0*0*0+0+0+9', '100*0-0*0*0+0-0+9', '100*0-0*0*0+0*0+9', '100*0-0*0*0-0+0+9', '100*0-0*0*0-0-0+9', '100*0-0*0*0-0*0+9', '100*0-0*0*0*0+0+9', '100*0-0*0*0*0-0+9', '100*0-0*0*0*0*0+9', '100*0*0+0+0+0+0+9', '100*0*0+0+0+0-0+9', '100*0*0+0+0+0*0+9', '100*0*0+0+0-0+0+9', '100*0*0+0+0-0-0+9', '100*0*0+0+0-0*0+9', '100*0*0+0+0*0+0+9', '100*0*0+0+0*0-0+9', '100*0*0+0+0*0*0+9', '100*0*0+0-0+0+0+9', '100*0*0+0-0+0-0+9', '100*0*0+0-0+0*0+9', '100*0*0+0-0-0+0+9', '100*0*0+0-0-0-0+9', '100*0*0+0-0-0*0+9', '100*0*0+0-0*0+0+9', '100*0*0+0-0*0-0+9', '100*0*0+0-0*0*0+9', '100*0*0+0*0+0+0+9', '100*0*0+0*0+0-0+9', '100*0*0+0*0+0*0+9', '100*0*0+0*0-0+0+9', '100*0*0+0*0-0-0+9', '100*0*0+0*0-0*0+9', '100*0*0+0*0*0+0+9', '100*0*0+0*0*0-0+9', '100*0*0+0*0*0*0+9', '100*0*0-0+0+0+0+9', '100*0*0-0+0+0-0+9', '100*0*0-0+0+0*0+9', '100*0*0-0+0-0+0+9', '100*0*0-0+0-0-0+9', '100*0*0-0+0-0*0+9', '100*0*0-0+0*0+0+9', '100*0*0-0+0*0-0+9', '100*0*0-0+0*0*0+9', '100*0*0-0-0+0+0+9', '100*0*0-0-0+0-0+9', '100*0*0-0-0+0*0+9', '100*0*0-0-0-0+0+9', '100*0*0-0-0-0-0+9', '100*0*0-0-0-0*0+9', '100*0*0-0-0*0+0+9', '100*0*0-0-0*0-0+9', '100*0*0-0-0*0*0+9', '100*0*0-0*0+0+0+9', '100*0*0-0*0+0-0+9', '100*0*0-0*0+0*0+9', '100*0*0-0*0-0+0+9', '100*0*0-0*0-0-0+9', '100*0*0-0*0-0*0+9', '100*0*0-0*0*0+0+9', '100*0*0-0*0*0-0+9', '100*0*0-0*0*0*0+9', '100*0*0*0+0+0+0+9', '100*0*0*0+0+0-0+9', '100*0*0*0+0+0*0+9', '100*0*0*0+0-0+0+9', '100*0*0*0+0-0-0+9', '100*0*0*0+0-0*0+9', '100*0*0*0+0*0+0+9', '100*0*0*0+0*0-0+9', '100*0*0*0+0*0*0+9', '100*0*0*0-0+0+0+9', '100*0*0*0-0+0-0+9', '100*0*0*0-0+0*0+9', '100*0*0*0-0-0+0+9', '100*0*0*0-0-0-0+9', '100*0*0*0-0-0*0+9', '100*0*0*0-0*0+0+9', '100*0*0*0-0*0-0+9', '100*0*0*0-0*0*0+9', '100*0*0*0*0+0+0+9', '100*0*0*0*0+0-0+9', '100*0*0*0*0+0*0+9', '100*0*0*0*0-0+0+9', '100*0*0*0*0-0-0+9', '100*0*0*0*0-0*0+9', '100*0*0*0*0*0+0+9', '100*0*0*0*0*0-0+9', '100*0*0*0*0*0*0+9', '1000*0+0+0+0+0+9', '1000*0+0+0+0-0+9', '1000*0+0+0+0*0+9', '1000*0+0+0-0+0+9', '1000*0+0+0-0-0+9', '1000*0+0+0-0*0+9', '1000*0+0+0*0+0+9', '1000*0+0+0*0-0+9', '1000*0+0+0*0*0+9', '1000*0+0-0+0+0+9', '1000*0+0-0+0-0+9', '1000*0+0-0+0*0+9', '1000*0+0-0-0+0+9', '1000*0+0-0-0-0+9', '1000*0+0-0-0*0+9', '1000*0+0-0*0+0+9', '1000*0+0-0*0-0+9', '1000*0+0-0*0*0+9', '1000*0+0*0+0+0+9', '1000*0+0*0+0-0+9', '1000*0+0*0+0*0+9', '1000*0+0*0-0+0+9', '1000*0+0*0-0-0+9', '1000*0+0*0-0*0+9', '1000*0+0*0*0+0+9', '1000*0+0*0*0-0+9', '1000*0+0*0*0*0+9', '1000*0-0+0+0+0+9', '1000*0-0+0+0-0+9', '1000*0-0+0+0*0+9', '1000*0-0+0-0+0+9', '1000*0-0+0-0-0+9', '1000*0-0+0-0*0+9', '1000*0-0+0*0+0+9', '1000*0-0+0*0-0+9', '1000*0-0+0*0*0+9', '1000*0-0-0+0+0+9', '1000*0-0-0+0-0+9', '1000*0-0-0+0*0+9', '1000*0-0-0-0+0+9', '1000*0-0-0-0-0+9', '1000*0-0-0-0*0+9', '1000*0-0-0*0+0+9', '1000*0-0-0*0-0+9', '1000*0-0-0*0*0+9', '1000*0-0*0+0+0+9', '1000*0-0*0+0-0+9', '1000*0-0*0+0*0+9', '1000*0-0*0-0+0+9', '1000*0-0*0-0-0+9', '1000*0-0*0-0*0+9', '1000*0-0*0*0+0+9', '1000*0-0*0*0-0+9', '1000*0-0*0*0*0+9', '1000*0*0+0+0+0+9', '1000*0*0+0+0-0+9', '1000*0*0+0+0*0+9', '1000*0*0+0-0+0+9', '1000*0*0+0-0-0+9', '1000*0*0+0-0*0+9', '1000*0*0+0*0+0+9', '1000*0*0+0*0-0+9', '1000*0*0+0*0*0+9', '1000*0*0-0+0+0+9', '1000*0*0-0+0-0+9', '1000*0*0-0+0*0+9', '1000*0*0-0-0+0+9', '1000*0*0-0-0-0+9', '1000*0*0-0-0*0+9', '1000*0*0-0*0+0+9', '1000*0*0-0*0-0+9', '1000*0*0-0*0*0+9', '1000*0*0*0+0+0+9', '1000*0*0*0+0-0+9', '1000*0*0*0+0*0+9', '1000*0*0*0-0+0+9', '1000*0*0*0-0-0+9', '1000*0*0*0-0*0+9', '1000*0*0*0*0+0+9', '1000*0*0*0*0-0+9', '1000*0*0*0*0*0+9', '10000*0+0+0+0+9', '10000*0+0+0-0+9', '10000*0+0+0*0+9', '10000*0+0-0+0+9', '10000*0+0-0-0+9', '10000*0+0-0*0+9', '10000*0+0*0+0+9', '10000*0+0*0-0+9', '10000*0+0*0*0+9', '10000*0-0+0+0+9', '10000*0-0+0-0+9', '10000*0-0+0*0+9', '10000*0-0-0+0+9', '10000*0-0-0-0+9', '10000*0-0-0*0+9', '10000*0-0*0+0+9', '10000*0-0*0-0+9', '10000*0-0*0*0+9', '10000*0*0+0+0+9', '10000*0*0+0-0+9', '10000*0*0+0*0+9', '10000*0*0-0+0+9', '10000*0*0-0-0+9', '10000*0*0-0*0+9', '10000*0*0*0+0+9', '10000*0*0*0-0+9', '10000*0*0*0*0+9', '100000*0+0+0+9', '100000*0+0-0+9', '100000*0+0*0+9', '100000*0-0+0+9', '100000*0-0-0+9', '100000*0-0*0+9', '100000*0*0+0+9', '100000*0*0-0+9', '100000*0*0*0+9', '1000000*0+0+9', '1000000*0-0+9', '1000000*0*0+9', '10000000*0+9'", + "", + "'999999999'", + "'0+1'", + "'1+2*3+4', '1-2+3*4', '12+3-4'" + ], + "boilerplate": { + "python": "class Solution:\n def addOperators(self, num: str, target: int) -> List[str]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List addOperators(String num, int target) {\n List results = new ArrayList();\n // Implement your solution logic here\n return results;\n }\n}", + "cpp": "class Solution {\npublic:\n vector addOperators(string num, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "import java.util.Arrays;\n\nArrays.sort(result);\nArrays.sort(expected);\nreturn Arrays.equals(result, expected);", + "cpp": "std::sort(result.begin(), result.end());\nstd::sort(expected.begin(), expected.end());\nreturn result == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=tunRDBsP7OQ&pp=ygUhTmVldENvZGUgRXhwcmVzc2lvbiBBZGQgT3BlcmF0b3Jz" }, { "title": "Remove Invalid Parentheses", @@ -3699,40 +4500,49 @@ "description": "

Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.

\n\n

Return a list of unique strings that are valid with the minimum number of removals. You may return the answer in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "()())()"\nOutput: ["(())()","()()()"]\n
\n\n

Example 2:

\n\n
\nInput: s = "(a)())()"\nOutput: ["(a())()","(a)()()"]\n
\n\n

Example 3:

\n\n
\nInput: s = ")("\nOutput: [""]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 25
  • \n\t
  • s consists of lowercase English letters and parentheses '(' and ')'.
  • \n\t
  • There will be at most 20 parentheses in s.
  • \n
\n", "difficulty": "hard", "sample_test_cases": [ - "removeInvalidParentheses(\"()())()\")", - "removeInvalidParentheses(\"(a)())()\")", - "removeInvalidParentheses(\")(\")" - ], - "sample_test_results": [ - "['(())()', '()()()']", - "['(a())()', '(a)()()']", - "['']" - ], - "hidden_test_cases": [ - "removeInvalidParentheses(\"()())()\")", - "removeInvalidParentheses(\"(a)())()\")", - "removeInvalidParentheses(\")(\")", - "removeInvalidParentheses(\"((()\")", - "removeInvalidParentheses(\")()\")", - "removeInvalidParentheses(\"(())())\")", - "removeInvalidParentheses(\"())()(((\")", - "removeInvalidParentheses(\"(a)(b)(c))(\")", - "removeInvalidParentheses(\")()(\")", - "removeInvalidParentheses(\"((())\")" - ], - "hidden_test_results": [ - "['(())()', '()()()']", - "['(a())()', '(a)()()']", - "['']", - "['()']", - "['()']", - "['(()())', '(())()']", - "['()()']", - "['(a(b)(c))', '(a)(b(c))', '(a)(b)(c)']", - "['()']", - "['(())']" - ], - "boilerplate": "class Solution:\n def removeInvalidParentheses(self, s: str) -> List[str]:\n ", - "compare_func": "return sorted(result) == sorted(eval(expected))" + "--arg1=\"()())()\"", + "--arg1=\"(a)())()\"", + "--arg1=\")(\"" + ], + "sample_test_results": [ + "'(())()', '()()()'", + "'(a())()', '(a)()()'", + "''" + ], + "hidden_test_cases": [ + "--arg1=\"()())()\"", + "--arg1=\"(a)())()\"", + "--arg1=\")(\"", + "--arg1=\"((()\"", + "--arg1=\")()\"", + "--arg1=\"(())())\"", + "--arg1=\"())()(((\"", + "--arg1=\"(a)(b)(c))(\"", + "--arg1=\")()(\"", + "--arg1=\"((())\"" + ], + "hidden_test_results": [ + "'(())()', '()()()'", + "'(a())()', '(a)()()'", + "''", + "'()'", + "'()'", + "'(()())', '(())()'", + "'()()'", + "'(a(b)(c))', '(a)(b(c))', '(a)(b)(c)'", + "'()'", + "'(())'" + ], + "boilerplate": { + "python": "class Solution:\n def removeInvalidParentheses(self, s: str) -> List[str]:\n ", + "java": "class Solution {\n public List removeInvalidParentheses(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector removeInvalidParentheses(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "List resultSorted = new ArrayList<>(result);\nCollections.sort(resultSorted);\nList expectedSorted = new ArrayList<>(Arrays.asList(eval(expected)));\nCollections.sort(expectedSorted);\nreturn resultSorted.equals(expectedSorted);", + "cpp": "bool compareFunction(const vector& result, const string& expected) {\n vector expectedVec;\n // Assumes a parsing function from string to vector exists\n parseStringToIntVector(expected, expectedVec);\n \n vector sortedResult = result;\n sort(sortedResult.begin(), sortedResult.end());\n \n sort(expectedVec.begin(), expectedVec.end());\n \n return sortedResult == expectedVec;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=mgQ4O9iUEbg&pp=ygUjTmVldENvZGUgUmVtb3ZlIEludmFsaWQgUGFyZW50aGVzZXM%3D" } ] \ No newline at end of file From dec873713d7d9b887074cb1cff5dfc22be372408 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Wed, 5 Feb 2025 20:29:44 +0700 Subject: [PATCH 02/24] java + cpp test generators --- app/api/endpoints/game.py | 7 +- app/db/combined.json | 8824 +++++++++++----------- app/db/init.py | 21 +- app/db/models/problem.py | 51 +- app/services/execution/service.py | 18 +- app/services/execution/templates.py | 85 + app/services/execution/test_generator.py | 181 +- app/services/problem/service.py | 69 +- 8 files changed, 4760 insertions(+), 4496 deletions(-) create mode 100644 app/services/execution/templates.py diff --git a/app/api/endpoints/game.py b/app/api/endpoints/game.py index 32d6362..bd23156 100644 --- a/app/api/endpoints/game.py +++ b/app/api/endpoints/game.py @@ -243,6 +243,8 @@ async def game_websocket( "data": game_view.model_dump() }) + print(game_state.problems[0]) + # Send the current problem if the game is in progress if game_state.status == GameStatus.IN_PROGRESS and player.current_problem_index < len(game_state.problems): current_problem = ProblemManager.prepare_problem_for_client( @@ -331,18 +333,21 @@ async def game_websocket( # Execute the player's code on the hidden test cases code = data["data"]["code"] + lang = data["data"]["lang"] # java, cpp, python problem_index = player.current_problem_index problem = game_state.problems[problem_index] validation_data = ProblemManager.get_problem_for_validation(problem) result = await code_execution.execute_code( code, + validation_data["method_name"], validation_data["hidden_test_cases"], validation_data["hidden_test_results"], validation_data["sample_test_cases"], validation_data["sample_test_results"], problem.difficulty, - validation_data["compare_func"] + validation_data["compare_func"], + lang, ) result = result.to_dict() diff --git a/app/db/combined.json b/app/db/combined.json index c34b8b7..f2f5918 100644 --- a/app/db/combined.json +++ b/app/db/combined.json @@ -1,4548 +1,4638 @@ [ { - "title": "Two Sum", - "source": "https://leetcode.com/problems/two-sum/", - "description": "

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

\n\n

You may assume that each input would have exactly one solution, and you may not use the same element twice.

\n\n

You can return the answer in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [2,7,11,15], target = 9\nOutput: [0,1]\nExplanation: Because nums[0] + nums[1] == 9, we return [0, 1].\n
\n\n

Example 2:

\n\n
\nInput: nums = [3,2,4], target = 6\nOutput: [1,2]\n
\n\n

Example 3:

\n\n
\nInput: nums = [3,3], target = 6\nOutput: [0,1]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 2 <= nums.length <= 104
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • -109 <= target <= 109
  • \n\t
  • Only one valid answer exists.
  • \n
\n\n

 

\nFollow-up: Can you come up with an algorithm that is less than O(n2) time complexity?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=2,7,11,15 --arg2=9", - "--arg1=3,2,4 --arg2=6", - "--arg1=3,3 --arg2=6" - ], - "sample_test_results": [ - "0, 1", - "1, 2", - "0, 1" - ], - "hidden_test_cases": [ - "--arg1=49,61,74,96,29,88,53,-34,-48 --arg2=184", - "--arg1=62,15,-95,26,-65,12,-86,-5,-40,-64,-91,-14,20,-36,83 --arg2=-60", - "--arg1=-12,-75,90,56,-15,-55,-51,-27,61,24,-9,-58 --arg2=-85", - "--arg1=-87,21,-26,13,-29,-53,-87,11 --arg2=-140", - "--arg1=-65,6,58,-29 --arg2=-7", - "--arg1=-87,54 --arg2=-33", - "--arg1=-97,-10,89 --arg2=-8", - "--arg1=30,57,-82,-8,92,99,82,-76 --arg2=74", - "--arg1=75,-74,40 --arg2=1", - "--arg1=-67,-35,76,71,-85,91,-55,-42,66,-28,1,89 --arg2=56" - ], - "hidden_test_results": [ - "3, 5", - "3, 6", - "7, 11", - "0, 5", - "0, 2", - "0, 1", - "0, 2", - "3, 6", - "0, 1", - "1, 5" - ], - "boilerplate": { - "python": "class Solution:\n def twoSum(self, nums: List[int], target: int) -> List[int]:\n ", - "java": "class Solution {\n public int[] twoSum(int[] nums, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::vector twoSum(std::vector& nums, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "return Arrays.equals(Arrays.sort(result), Arrays.sort(eval(expected)));", - "cpp": "vector sortedResult(result.begin(), result.end());\nsort(sortedResult.begin(), sortedResult.end());\nvector sortedExpected(eval(expected).begin(), eval(expected).end());\nsort(sortedExpected.begin(), sortedExpected.end());\nreturn sortedResult == sortedExpected;" - }, - "explanation": "https://www.youtube.com/watch?v=KLlXCFG5TnA&pp=ygUQTmVldENvZGUgVHdvIFN1bQ%3D%3D" + "title": "Two Sum", + "source": "https://leetcode.com/problems/two-sum/", + "description": "

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

\n\n

You may assume that each input would have exactly one solution, and you may not use the same element twice.

\n\n

You can return the answer in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [2,7,11,15], target = 9\nOutput: [0,1]\nExplanation: Because nums[0] + nums[1] == 9, we return [0, 1].\n
\n\n

Example 2:

\n\n
\nInput: nums = [3,2,4], target = 6\nOutput: [1,2]\n
\n\n

Example 3:

\n\n
\nInput: nums = [3,3], target = 6\nOutput: [0,1]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 2 <= nums.length <= 104
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • -109 <= target <= 109
  • \n\t
  • Only one valid answer exists.
  • \n
\n\n

 

\nFollow-up: Can you come up with an algorithm that is less than O(n2) time complexity?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[2,7,11,15] --arg2=9", + "--arg1=[3,2,4] --arg2=6", + "--arg1=[3,3] --arg2=6" + ], + "sample_test_results": [ + "[0,1]", + "[1,2]", + "[0,1]" + ], + "hidden_test_cases": [ + "--arg1=[49,61,74,96,29,88,53,-34,-48] --arg2=184", + "--arg1=[62,15,-95,26,-65,12,-86,-5,-40,-64,-91,-14,20,-36,83] --arg2=-60", + "--arg1=[-12,-75,90,56,-15,-55,-51,-27,61,24,-9,-58] --arg2=-85", + "--arg1=[-87,21,-26,13,-29,-53,-87,11] --arg2=-140", + "--arg1=[-65,6,58,-29] --arg2=-7", + "--arg1=[-87,54] --arg2=-33", + "--arg1=[-97,-10,89] --arg2=-8", + "--arg1=[30,57,-82,-8,92,99,82,-76] --arg2=74", + "--arg1=[75,-74,40] --arg2=1", + "--arg1=[-67,-35,76,71,-85,91,-55,-42,66,-28,1,89] --arg2=56" + ], + "hidden_test_results": [ + "[3,5]", + "[3,6]", + "[7,11]", + "[0,5]", + "[0,2]", + "[0,1]", + "[0,2]", + "[3,6]", + "[0,1]", + "[1,5]" + ], + "boilerplate": { + "python": "class Solution:\n def twoSum(self, nums: List[int], target: int) -> List[int]:\n ", + "java": "class Solution {\n public int[] twoSum(int[] nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::vector twoSum(std::vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "return Arrays.equals(Arrays.sort(result), Arrays.sort(eval(expected)));", + "cpp": "vector sortedResult(result.begin(), result.end());\nsort(sortedResult.begin(), sortedResult.end());\nvector sortedExpected(eval(expected).begin(), eval(expected).end());\nsort(sortedExpected.begin(), sortedExpected.end());\nreturn sortedResult == sortedExpected;" + }, + "explanation": "https://www.youtube.com/watch?v=KLlXCFG5TnA&pp=ygUQTmVldENvZGUgVHdvIFN1bQ%3D%3D", + "method_name": "twoSum" }, { - "title": "Palindrome Number", - "source": "https://leetcode.com/problems/palindrome-number/", - "description": "

Given an integer x, return true if x is a palindrome, and false otherwise.

\n\n

 

\n

Example 1:

\n\n
\nInput: x = 121\nOutput: true\nExplanation: 121 reads as 121 from left to right and from right to left.\n
\n\n

Example 2:

\n\n
\nInput: x = -121\nOutput: false\nExplanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.\n
\n\n

Example 3:

\n\n
\nInput: x = 10\nOutput: false\nExplanation: Reads 01 from right to left. Therefore it is not a palindrome.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= x <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without converting the integer to a string?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=121", - "--arg1=-121", - "--arg1=10" - ], - "sample_test_results": [ - "True", - "False", - "False" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=1234321", - "--arg1=-1", - "--arg1=1000", - "--arg1=12321", - "--arg1=100001", - "--arg1=2147483647", - "--arg1=-2147483648", - "--arg1=11", - "--arg1=1000021" - ], - "hidden_test_results": [ - "True", - "True", - "False", - "False", - "True", - "True", - "False", - "False", - "True", - "False" - ], - "boilerplate": { - "python": "class Solution:\n def isPalindrome(self, x: int) -> bool:\n ", - "java": "class Solution {\n public boolean isPalindrome(int x) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isPalindrome(int x) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "{\n return result == std::stod(expected);\n}" - }, - "explanation": "https://www.youtube.com/watch?v=yubRKwixN-U&pp=ygUaTmVldENvZGUgUGFsaW5kcm9tZSBOdW1iZXI%3D" + "title": "Palindrome Number", + "source": "https://leetcode.com/problems/palindrome-number/", + "description": "

Given an integer x, return true if x is a palindrome, and false otherwise.

\n\n

 

\n

Example 1:

\n\n
\nInput: x = 121\nOutput: true\nExplanation: 121 reads as 121 from left to right and from right to left.\n
\n\n

Example 2:

\n\n
\nInput: x = -121\nOutput: false\nExplanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.\n
\n\n

Example 3:

\n\n
\nInput: x = 10\nOutput: false\nExplanation: Reads 01 from right to left. Therefore it is not a palindrome.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= x <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without converting the integer to a string?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=121", + "--arg1=-121", + "--arg1=10" + ], + "sample_test_results": [ + "true", + "false", + "false" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=1234321", + "--arg1=-1", + "--arg1=1000", + "--arg1=12321", + "--arg1=100001", + "--arg1=2147483647", + "--arg1=-2147483648", + "--arg1=11", + "--arg1=1000021" + ], + "hidden_test_results": [ + "true", + "true", + "false", + "false", + "true", + "true", + "false", + "false", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isPalindrome(self, x: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPalindrome(int x) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPalindrome(int x) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "{\n return result == std::stod(expected);\n}" + }, + "explanation": "https://www.youtube.com/watch?v=yubRKwixN-U&pp=ygUaTmVldENvZGUgUGFsaW5kcm9tZSBOdW1iZXI%3D", + "method_name": "isPalindrome" }, { - "title": "Longest Common Prefix", - "source": "https://leetcode.com/problems/longest-common-prefix/", - "description": "

Write a function to find the longest common prefix string amongst an array of strings.

\n\n

If there is no common prefix, return an empty string "".

\n\n

 

\n

Example 1:

\n\n
\nInput: strs = ["flower","flow","flight"]\nOutput: "fl"\n
\n\n

Example 2:

\n\n
\nInput: strs = ["dog","racecar","car"]\nOutput: ""\nExplanation: There is no common prefix among the input strings.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= strs.length <= 200
  • \n\t
  • 0 <= strs[i].length <= 200
  • \n\t
  • strs[i] consists of only lowercase English letters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='flower','flow','flight'", - "--arg1='dog','racecar','car'" - ], - "sample_test_results": [ - "'fl'", - "''" - ], - "hidden_test_cases": [ - "--arg1='interspecies','interstellar','interstate'", - "--arg1='throne','throne'", - "--arg1=''", - "--arg1='a'", - "--arg1='','b'", - "--arg1='prefix','prefix','prefix'", - "--arg1='abc','def','ghi'", - "--arg1='flower','flower','flower','flower'", - "--arg1='x','xy','xyz'", - "--arg1='ab','a'" - ], - "hidden_test_results": [ - "'inters'", - "'throne'", - "''", - "'a'", - "''", - "'prefix'", - "''", - "'flower'", - "'x'", - "'a'" - ], - "boilerplate": { - "python": "class Solution:\n def longestCommonPrefix(self, strs: List[str]) -> str:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public String longestCommonPrefix(List strs) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string longestCommonPrefix(vector& strs) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "try { \n return result == expected;\n} catch (Exception e) {\n return false;\n}", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=0sWShKIJoo4&pp=ygUeTmVldENvZGUgTG9uZ2VzdCBDb21tb24gUHJlZml4" + "title": "Longest Common Prefix", + "source": "https://leetcode.com/problems/longest-common-prefix/", + "description": "

Write a function to find the longest common prefix string amongst an array of strings.

\n\n

If there is no common prefix, return an empty string "".

\n\n

 

\n

Example 1:

\n\n
\nInput: strs = ["flower","flow","flight"]\nOutput: "fl"\n
\n\n

Example 2:

\n\n
\nInput: strs = ["dog","racecar","car"]\nOutput: ""\nExplanation: There is no common prefix among the input strings.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= strs.length <= 200
  • \n\t
  • 0 <= strs[i].length <= 200
  • \n\t
  • strs[i] consists of only lowercase English letters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=['flower','flow','flight']", + "--arg1=['dog','racecar','car']" + ], + "sample_test_results": [ + "'fl'", + "''" + ], + "hidden_test_cases": [ + "--arg1=['interspecies','interstellar','interstate']", + "--arg1=['throne','throne']", + "--arg1=['']", + "--arg1=['a']", + "--arg1=['','b']", + "--arg1=['prefix','prefix','prefix']", + "--arg1=['abc','def','ghi']", + "--arg1=['flower','flower','flower','flower']", + "--arg1=['x','xy','xyz']", + "--arg1=['ab','a']" + ], + "hidden_test_results": [ + "'inters'", + "'throne'", + "''", + "'a'", + "''", + "'prefix'", + "''", + "'flower'", + "'x'", + "'a'" + ], + "boilerplate": { + "python": "class Solution:\n def longestCommonPrefix(self, strs: List[str]) -> str:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public String longestCommonPrefix(List strs) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string longestCommonPrefix(vector& strs) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try { \n return result == expected;\n} catch (Exception e) {\n return false;\n}", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=0sWShKIJoo4&pp=ygUeTmVldENvZGUgTG9uZ2VzdCBDb21tb24gUHJlZml4", + "method_name": "longestCommonPrefix" }, { - "title": "Valid Parentheses", - "source": "https://leetcode.com/problems/valid-parentheses/", - "description": "

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

\n\n

An input string is valid if:

\n\n
    \n\t
  1. Open brackets must be closed by the same type of brackets.
  2. \n\t
  3. Open brackets must be closed in the correct order.
  4. \n\t
  5. Every close bracket has a corresponding open bracket of the same type.
  6. \n
\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "()"

\n\n

Output: true

\n
\n\n

Example 2:

\n\n
\n

Input: s = "()[]{}"

\n\n

Output: true

\n
\n\n

Example 3:

\n\n
\n

Input: s = "(]"

\n\n

Output: false

\n
\n\n

Example 4:

\n\n
\n

Input: s = "([])"

\n\n

Output: true

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of parentheses only '()[]{}'.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='()'", - "--arg1='()[]{}'", - "--arg1='(]'", - "--arg1='([])'" - ], - "sample_test_results": [ - "True", - "True", - "False", - "True" - ], - "hidden_test_cases": [ - "--arg1='{[]}'", - "--arg1='((()))'", - "--arg1='(()[]{})'", - "--arg1='}{}'", - "--arg1=''", - "--arg1='((())'", - "--arg1='())'", - "--arg1='([)]'", - "--arg1='{{{}}}'", - "--arg1='[({})]'" - ], - "hidden_test_results": [ - "True", - "True", - "True", - "False", - "True", - "False", - "False", - "False", - "True", - "True" - ], - "boilerplate": { - "python": "class Solution:\n def isValid(self, s: str) -> bool:\n ", - "java": "class Solution {\n public boolean isValid(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isValid(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(evaluate(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=WTzjTskDFMg&pp=ygUaTmVldENvZGUgVmFsaWQgUGFyZW50aGVzZXM%3D" + "title": "Valid Parentheses", + "source": "https://leetcode.com/problems/valid-parentheses/", + "description": "

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

\n\n

An input string is valid if:

\n\n
    \n\t
  1. Open brackets must be closed by the same type of brackets.
  2. \n\t
  3. Open brackets must be closed in the correct order.
  4. \n\t
  5. Every close bracket has a corresponding open bracket of the same type.
  6. \n
\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "()"

\n\n

Output: true

\n
\n\n

Example 2:

\n\n
\n

Input: s = "()[]{}"

\n\n

Output: true

\n
\n\n

Example 3:

\n\n
\n

Input: s = "(]"

\n\n

Output: false

\n
\n\n

Example 4:

\n\n
\n

Input: s = "([])"

\n\n

Output: true

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of parentheses only '()[]{}'.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='()'", + "--arg1='()[]{}'", + "--arg1='(]'", + "--arg1='([])'" + ], + "sample_test_results": [ + "true", + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1='{[]}'", + "--arg1='((()))'", + "--arg1='(()[]{})'", + "--arg1='}{}'", + "--arg1=''", + "--arg1='((())'", + "--arg1='())'", + "--arg1='([)]'", + "--arg1='{{{}}}'", + "--arg1='[({})]'" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "false", + "true", + "false", + "false", + "false", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def isValid(self, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean isValid(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isValid(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(evaluate(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=WTzjTskDFMg&pp=ygUaTmVldENvZGUgVmFsaWQgUGFyZW50aGVzZXM%3D", + "method_name": "isValid" }, { - "title": "Find the Index of the First Occurrence in a String", - "source": "https://leetcode.com/problems/implement-strstr/", - "description": "

Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

\n\n

 

\n

Example 1:

\n\n
\nInput: haystack = "sadbutsad", needle = "sad"\nOutput: 0\nExplanation: "sad" occurs at index 0 and 6.\nThe first occurrence is at index 0, so we return 0.\n
\n\n

Example 2:

\n\n
\nInput: haystack = "leetcode", needle = "leeto"\nOutput: -1\nExplanation: "leeto" did not occur in "leetcode", so we return -1.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= haystack.length, needle.length <= 104
  • \n\t
  • haystack and needle consist of only lowercase English characters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='sadbutsad' --arg2='sad'", - "--arg1='leetcode' --arg2='leeto'" - ], - "sample_test_results": [ - "0", - "-1" - ], - "hidden_test_cases": [ - "--arg1='hello' --arg2='ll'", - "--arg1='aaaaa' --arg2='bba'", - "--arg1='' --arg2=''", - "--arg1='a' --arg2='a'", - "--arg1='mississippi' --arg2='issi'", - "--arg1='aaaaaa' --arg2='aa'", - "--arg1='abc' --arg2='c'", - "--arg1='hello world' --arg2='world'", - "--arg1='abcabcd' --arg2='abcd'", - "--arg1='testing' --arg2=''" - ], - "hidden_test_results": [ - "2", - "-1", - "0", - "0", - "1", - "0", - "2", - "6", - "3", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def strStr(self, haystack: str, needle: str) -> int:\n ", - "java": "class Solution {\n public int strStr(String haystack, String needle) {\n // Your logic here\n }\n}", - "cpp": "class Solution {\npublic:\n int strStr(string haystack, string needle) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=Gjkhm1gYIMw&pp=ygU7TmVldENvZGUgRmluZCB0aGUgSW5kZXggb2YgdGhlIEZpcnN0IE9jY3VycmVuY2UgaW4gYSBTdHJpbmc%3D" + "title": "Find the Index of the First Occurrence in a String", + "source": "https://leetcode.com/problems/implement-strstr/", + "description": "

Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

\n\n

 

\n

Example 1:

\n\n
\nInput: haystack = "sadbutsad", needle = "sad"\nOutput: 0\nExplanation: "sad" occurs at index 0 and 6.\nThe first occurrence is at index 0, so we return 0.\n
\n\n

Example 2:

\n\n
\nInput: haystack = "leetcode", needle = "leeto"\nOutput: -1\nExplanation: "leeto" did not occur in "leetcode", so we return -1.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= haystack.length, needle.length <= 104
  • \n\t
  • haystack and needle consist of only lowercase English characters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='sadbutsad' --arg2='sad'", + "--arg1='leetcode' --arg2='leeto'" + ], + "sample_test_results": [ + "0", + "-1" + ], + "hidden_test_cases": [ + "--arg1='hello' --arg2='ll'", + "--arg1='aaaaa' --arg2='bba'", + "--arg1='' --arg2=''", + "--arg1='a' --arg2='a'", + "--arg1='mississippi' --arg2='issi'", + "--arg1='aaaaaa' --arg2='aa'", + "--arg1='abc' --arg2='c'", + "--arg1='hello world' --arg2='world'", + "--arg1='abcabcd' --arg2='abcd'", + "--arg1='testing' --arg2=''" + ], + "hidden_test_results": [ + "2", + "-1", + "0", + "0", + "1", + "0", + "2", + "6", + "3", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def strStr(self, haystack: str, needle: str) -> int:\n ", + "java": "class Solution {\n public int strStr(String haystack, String needle) {\n // Your logic here\n }\n}", + "cpp": "class Solution {\npublic:\n int strStr(string haystack, string needle) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Gjkhm1gYIMw&pp=ygU7TmVldENvZGUgRmluZCB0aGUgSW5kZXggb2YgdGhlIEZpcnN0IE9jY3VycmVuY2UgaW4gYSBTdHJpbmc%3D", + "method_name": "strStr" }, { - "title": "Search Insert Position", - "source": "https://leetcode.com/problems/search-insert-position/", - "description": "

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.

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,3,5,6], target = 5\nOutput: 2\n
\n\n

Example 2:

\n\n
\nInput: nums = [1,3,5,6], target = 2\nOutput: 1\n
\n\n

Example 3:

\n\n
\nInput: nums = [1,3,5,6], target = 7\nOutput: 4\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 104
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • nums contains distinct values sorted in ascending order.
  • \n\t
  • -104 <= target <= 104
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1,3,5,6 --arg2=5", - "--arg1=1,3,5,6 --arg2=2", - "--arg1=1,3,5,6 --arg2=7" - ], - "sample_test_results": [ - "2", - "1", - "4" - ], - "hidden_test_cases": [ - "--arg1=1 --arg2=0", - "--arg1=1 --arg2=2", - "--arg1=1,3,5,6,8,10 --arg2=9", - "--arg1=1,4,6,7,8,9 --arg2=6", - "--arg1=-5,-3,0,1,3 --arg2=-4", - "--arg1=-3,-1,0,2 --arg2=1", - "--arg1=1,2,3,4,5 --arg2=5", - "--arg1=2,4,6,8 --arg2=1", - "--arg1=1,3,5,7 --arg2=4", - "--arg1=1,3,5,7,9 --arg2=8" - ], - "hidden_test_results": [ - "0", - "1", - "5", - "2", - "1", - "3", - "4", - "0", - "2", - "4" - ], - "boilerplate": { - "python": "class Solution:\n def searchInsert(self, nums: List[int], target: int) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int searchInsert(List nums, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int searchInsert(vector& nums, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return Integer.compare(result, Integer.parseInt(expected)) == 0;", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=K-RYzDZkzCI&pp=ygUfTmVldENvZGUgU2VhcmNoIEluc2VydCBQb3NpdGlvbg%3D%3D" + "title": "Search Insert Position", + "source": "https://leetcode.com/problems/search-insert-position/", + "description": "

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.

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,3,5,6], target = 5\nOutput: 2\n
\n\n

Example 2:

\n\n
\nInput: nums = [1,3,5,6], target = 2\nOutput: 1\n
\n\n

Example 3:

\n\n
\nInput: nums = [1,3,5,6], target = 7\nOutput: 4\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 104
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • nums contains distinct values sorted in ascending order.
  • \n\t
  • -104 <= target <= 104
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,3,5,6] --arg2=5", + "--arg1=[1,3,5,6] --arg2=2", + "--arg1=[1,3,5,6] --arg2=7" + ], + "sample_test_results": [ + "2", + "1", + "4" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=0", + "--arg1=[1] --arg2=2", + "--arg1=[1,3,5,6,8,10] --arg2=9", + "--arg1=[1,4,6,7,8,9] --arg2=6", + "--arg1=[-5,-3,0,1,3] --arg2=-4", + "--arg1=[-3,-1,0,2] --arg2=1", + "--arg1=[1,2,3,4,5] --arg2=5", + "--arg1=[2,4,6,8] --arg2=1", + "--arg1=[1,3,5,7] --arg2=4", + "--arg1=[1,3,5,7,9] --arg2=8" + ], + "hidden_test_results": [ + "0", + "1", + "5", + "2", + "1", + "3", + "4", + "0", + "2", + "4" + ], + "boilerplate": { + "python": "class Solution:\n def searchInsert(self, nums: List[int], target: int) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int searchInsert(List nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int searchInsert(vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return Integer.compare(result, Integer.parseInt(expected)) == 0;", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=K-RYzDZkzCI&pp=ygUfTmVldENvZGUgU2VhcmNoIEluc2VydCBQb3NpdGlvbg%3D%3D", + "method_name": "searchInsert" }, { - "title": "Length of Last Word", - "source": "https://leetcode.com/problems/length-of-last-word/", - "description": "

Given a string s consisting of words and spaces, return the length of the last word in the string.

\n\n

A word is a maximal substring consisting of non-space characters only.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "Hello World"\nOutput: 5\nExplanation: The last word is "World" with length 5.\n
\n\n

Example 2:

\n\n
\nInput: s = "   fly me   to   the moon  "\nOutput: 4\nExplanation: The last word is "moon" with length 4.\n
\n\n

Example 3:

\n\n
\nInput: s = "luffy is still joyboy"\nOutput: 6\nExplanation: The last word is "joyboy" with length 6.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of only English letters and spaces ' '.
  • \n\t
  • There will be at least one word in s.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=\"Hello World\"", - "--arg1=\" fly me to the moon \"", - "--arg1=\"luffy is still joyboy\"" - ], - "sample_test_results": [ - "5", - "4", - "6" - ], - "hidden_test_cases": [ - "--arg1=\"a\"", - "--arg1=\"hello \"", - "--arg1=\" space\"", - "--arg1=\"multiple words here\"", - "--arg1=\"oneword\"", - "--arg1=\" spaces between words \"", - "--arg1=\"trailing space \"", - "--arg1=\" leading space\"", - "--arg1=\"multiple spaces between\"", - "--arg1=\"z\"" - ], - "hidden_test_results": [ - "1", - "5", - "5", - "4", - "7", - "5", - "5", - "5", - "7", - "1" - ], - "boilerplate": { - "python": "class Solution:\n def lengthOfLastWord(self, s: str) -> int:\n ", - "java": "class Solution {\n public int lengthOfLastWord(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int lengthOfLastWord(const std::string& s) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=KT9rltZTybQ&pp=ygUcTmVldENvZGUgTGVuZ3RoIG9mIExhc3QgV29yZA%3D%3D" + "title": "Length of Last Word", + "source": "https://leetcode.com/problems/length-of-last-word/", + "description": "

Given a string s consisting of words and spaces, return the length of the last word in the string.

\n\n

A word is a maximal substring consisting of non-space characters only.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "Hello World"\nOutput: 5\nExplanation: The last word is "World" with length 5.\n
\n\n

Example 2:

\n\n
\nInput: s = "   fly me   to   the moon  "\nOutput: 4\nExplanation: The last word is "moon" with length 4.\n
\n\n

Example 3:

\n\n
\nInput: s = "luffy is still joyboy"\nOutput: 6\nExplanation: The last word is "joyboy" with length 6.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of only English letters and spaces ' '.
  • \n\t
  • There will be at least one word in s.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=\"Hello World\"", + "--arg1=\" fly me to the moon \"", + "--arg1=\"luffy is still joyboy\"" + ], + "sample_test_results": [ + "5", + "4", + "6" + ], + "hidden_test_cases": [ + "--arg1=\"a\"", + "--arg1=\"hello \"", + "--arg1=\" space\"", + "--arg1=\"multiple words here\"", + "--arg1=\"oneword\"", + "--arg1=\" spaces between words \"", + "--arg1=\"trailing space \"", + "--arg1=\" leading space\"", + "--arg1=\"multiple spaces between\"", + "--arg1=\"z\"" + ], + "hidden_test_results": [ + "1", + "5", + "5", + "4", + "7", + "5", + "5", + "5", + "7", + "1" + ], + "boilerplate": { + "python": "class Solution:\n def lengthOfLastWord(self, s: str) -> int:\n ", + "java": "class Solution {\n public int lengthOfLastWord(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int lengthOfLastWord(const std::string& s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=KT9rltZTybQ&pp=ygUcTmVldENvZGUgTGVuZ3RoIG9mIExhc3QgV29yZA%3D%3D", + "method_name": "lengthOfLastWord" }, { - "title": "Plus One", - "source": "https://leetcode.com/problems/plus-one/", - "description": "

You are given a large integer represented as an integer array digits, where each digits[i] is the ith 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 any leading 0's.

\n\n

Increment the large integer by one and return the resulting array of digits.

\n\n

 

\n

Example 1:

\n\n
\nInput: digits = [1,2,3]\nOutput: [1,2,4]\nExplanation: The array represents the integer 123.\nIncrementing by one gives 123 + 1 = 124.\nThus, the result should be [1,2,4].\n
\n\n

Example 2:

\n\n
\nInput: digits = [4,3,2,1]\nOutput: [4,3,2,2]\nExplanation: The array represents the integer 4321.\nIncrementing by one gives 4321 + 1 = 4322.\nThus, the result should be [4,3,2,2].\n
\n\n

Example 3:

\n\n
\nInput: digits = [9]\nOutput: [1,0]\nExplanation: The array represents the integer 9.\nIncrementing by one gives 9 + 1 = 10.\nThus, the result should be [1,0].\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= digits.length <= 100
  • \n\t
  • 0 <= digits[i] <= 9
  • \n\t
  • digits does not contain any leading 0's.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1,2,3", - "--arg1=4,3,2,1", - "--arg1=9" - ], - "sample_test_results": [ - "1, 2, 4", - "4, 3, 2, 2", - "1, 0" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=9,9", - "--arg1=1,0,0", - "--arg1=1,9,9", - "--arg1=9,8,9", - "--arg1=1,2,3,4", - "--arg1=9,9,9,9", - "--arg1=5,0,9", - "--arg1=1", - "--arg1=4,9,9,9" - ], - "hidden_test_results": [ - "1", - "1, 0, 0", - "1, 0, 1", - "2, 0, 0", - "9, 9, 0", - "1, 2, 3, 5", - "1, 0, 0, 0, 0", - "5, 1, 0", - "2", - "5, 0, 0, 0" - ], - "boilerplate": { - "python": "class Solution:\n def plusOne(self, digits: List[int]) -> List[int]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List plusOne(List digits) {\n // \n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector plusOne(vector& digits) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=jIaA8boiG1s&pp=ygURTmVldENvZGUgUGx1cyBPbmU%3D" + "title": "Plus One", + "source": "https://leetcode.com/problems/plus-one/", + "description": "

You are given a large integer represented as an integer array digits, where each digits[i] is the ith 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 any leading 0's.

\n\n

Increment the large integer by one and return the resulting array of digits.

\n\n

 

\n

Example 1:

\n\n
\nInput: digits = [1,2,3]\nOutput: [1,2,4]\nExplanation: The array represents the integer 123.\nIncrementing by one gives 123 + 1 = 124.\nThus, the result should be [1,2,4].\n
\n\n

Example 2:

\n\n
\nInput: digits = [4,3,2,1]\nOutput: [4,3,2,2]\nExplanation: The array represents the integer 4321.\nIncrementing by one gives 4321 + 1 = 4322.\nThus, the result should be [4,3,2,2].\n
\n\n

Example 3:

\n\n
\nInput: digits = [9]\nOutput: [1,0]\nExplanation: The array represents the integer 9.\nIncrementing by one gives 9 + 1 = 10.\nThus, the result should be [1,0].\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= digits.length <= 100
  • \n\t
  • 0 <= digits[i] <= 9
  • \n\t
  • digits does not contain any leading 0's.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,2,3]", + "--arg1=[4,3,2,1]", + "--arg1=[9]" + ], + "sample_test_results": [ + "[1,2,4]", + "[4,3,2,2]", + "[1,0]" + ], + "hidden_test_cases": [ + "--arg1=[0]", + "--arg1=[9,9]", + "--arg1=[1,0,0]", + "--arg1=[1,9,9]", + "--arg1=[9,8,9]", + "--arg1=[1,2,3,4]", + "--arg1=[9,9,9,9]", + "--arg1=[5,0,9]", + "--arg1=[1]", + "--arg1=[4,9,9,9]" + ], + "hidden_test_results": [ + "[1]", + "[1,0,0]", + "[1,0,1]", + "[2,0,0]", + "[9,9,0]", + "[1,2,3,5]", + "[1,0,0,0,0]", + "[5,1,0]", + "[2]", + "[5,0,0,0]" + ], + "boilerplate": { + "python": "class Solution:\n def plusOne(self, digits: List[int]) -> List[int]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List plusOne(List digits) {\n // \n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector plusOne(vector& digits) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=jIaA8boiG1s&pp=ygURTmVldENvZGUgUGx1cyBPbmU%3D", + "method_name": "plusOne" }, { - "title": "Add Binary", - "source": "https://leetcode.com/problems/add-binary/", - "description": "

Given two binary strings a and b, return their sum as a binary string.

\n\n

 

\n

Example 1:

\n
Input: a = \"11\", b = \"1\"\nOutput: \"100\"\n

Example 2:

\n
Input: a = \"1010\", b = \"1011\"\nOutput: \"10101\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= a.length, b.length <= 104
  • \n\t
  • a and b consist only of '0' or '1' characters.
  • \n\t
  • Each string does not contain leading zeros except for the zero itself.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=\"11\" --arg2=\"1\"", - "--arg1=\"1010\" --arg2=\"1011\"" - ], - "sample_test_results": [ - "'100'", - "'10101'" - ], - "hidden_test_cases": [ - "--arg1=\"0\" --arg2=\"0\"", - "--arg1=\"1\" --arg2=\"1\"", - "--arg1=\"111\" --arg2=\"111\"", - "--arg1=\"1111\" --arg2=\"1111\"", - "--arg1=\"1010\" --arg2=\"0101\"", - "--arg1=\"100\" --arg2=\"110\"", - "--arg1=\"11\" --arg2=\"11\"", - "--arg1=\"1\" --arg2=\"111\"", - "--arg1=\"1000\" --arg2=\"1100\"", - "--arg1=\"1111\" --arg2=\"1\"" - ], - "hidden_test_results": [ - "'0'", - "'10'", - "'1110'", - "'11110'", - "'1111'", - "'1010'", - "'110'", - "'1000'", - "'10100'", - "'10000'" - ], - "boilerplate": { - "python": "class Solution:\n def addBinary(self, a: str, b: str) -> str:\n ", - "java": "class Solution {\n public String addBinary(String a, String b) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string addBinary(string a, string b) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=keuWJ47xG8g&pp=ygUTTmVldENvZGUgQWRkIEJpbmFyeQ%3D%3D" + "title": "Add Binary", + "source": "https://leetcode.com/problems/add-binary/", + "description": "

Given two binary strings a and b, return their sum as a binary string.

\n\n

 

\n

Example 1:

\n
Input: a = \"11\", b = \"1\"\nOutput: \"100\"\n

Example 2:

\n
Input: a = \"1010\", b = \"1011\"\nOutput: \"10101\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= a.length, b.length <= 104
  • \n\t
  • a and b consist only of '0' or '1' characters.
  • \n\t
  • Each string does not contain leading zeros except for the zero itself.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=\"11\" --arg2=\"1\"", + "--arg1=\"1010\" --arg2=\"1011\"" + ], + "sample_test_results": [ + "'100'", + "'10101'" + ], + "hidden_test_cases": [ + "--arg1=\"0\" --arg2=\"0\"", + "--arg1=\"1\" --arg2=\"1\"", + "--arg1=\"111\" --arg2=\"111\"", + "--arg1=\"1111\" --arg2=\"1111\"", + "--arg1=\"1010\" --arg2=\"0101\"", + "--arg1=\"100\" --arg2=\"110\"", + "--arg1=\"11\" --arg2=\"11\"", + "--arg1=\"1\" --arg2=\"111\"", + "--arg1=\"1000\" --arg2=\"1100\"", + "--arg1=\"1111\" --arg2=\"1\"" + ], + "hidden_test_results": [ + "'0'", + "'10'", + "'1110'", + "'11110'", + "'1111'", + "'1010'", + "'110'", + "'1000'", + "'10100'", + "'10000'" + ], + "boilerplate": { + "python": "class Solution:\n def addBinary(self, a: str, b: str) -> str:\n ", + "java": "class Solution {\n public String addBinary(String a, String b) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string addBinary(string a, string b) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=keuWJ47xG8g&pp=ygUTTmVldENvZGUgQWRkIEJpbmFyeQ%3D%3D", + "method_name": "addBinary" }, { - "title": "Climbing Stairs", - "source": "https://leetcode.com/problems/climbing-stairs/", - "description": "

You are climbing a staircase. It takes n steps to reach the top.

\n\n

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 2\nOutput: 2\nExplanation: There are two ways to climb to the top.\n1. 1 step + 1 step\n2. 2 steps\n
\n\n

Example 2:

\n\n
\nInput: n = 3\nOutput: 3\nExplanation: There are three ways to climb to the top.\n1. 1 step + 1 step + 1 step\n2. 1 step + 2 steps\n3. 2 steps + 1 step\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 45
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=2", - "--arg1=3" - ], - "sample_test_results": [ - "2", - "3" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=4", - "--arg1=5", - "--arg1=6", - "--arg1=7", - "--arg1=8", - "--arg1=9", - "--arg1=10", - "--arg1=20", - "--arg1=30" - ], - "hidden_test_results": [ - "1", - "5", - "8", - "13", - "21", - "34", - "55", - "89", - "10946", - "1346269" - ], - "boilerplate": { - "python": "class Solution:\n def climbStairs(self, n: int) -> int:\n ", - "java": "class Solution {\n public int climbStairs(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int climbStairs(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=Y0lT9Fck7qI&pp=ygUYTmVldENvZGUgQ2xpbWJpbmcgU3RhaXJz" + "title": "Climbing Stairs", + "source": "https://leetcode.com/problems/climbing-stairs/", + "description": "

You are climbing a staircase. It takes n steps to reach the top.

\n\n

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 2\nOutput: 2\nExplanation: There are two ways to climb to the top.\n1. 1 step + 1 step\n2. 2 steps\n
\n\n

Example 2:

\n\n
\nInput: n = 3\nOutput: 3\nExplanation: There are three ways to climb to the top.\n1. 1 step + 1 step + 1 step\n2. 1 step + 2 steps\n3. 2 steps + 1 step\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 45
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=2", + "--arg1=3" + ], + "sample_test_results": [ + "2", + "3" + ], + "hidden_test_cases": [ + "--arg1=1", + "--arg1=4", + "--arg1=5", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9", + "--arg1=10", + "--arg1=20", + "--arg1=30" + ], + "hidden_test_results": [ + "1", + "5", + "8", + "13", + "21", + "34", + "55", + "89", + "10946", + "1346269" + ], + "boilerplate": { + "python": "class Solution:\n def climbStairs(self, n: int) -> int:\n ", + "java": "class Solution {\n public int climbStairs(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int climbStairs(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Y0lT9Fck7qI&pp=ygUYTmVldENvZGUgQ2xpbWJpbmcgU3RhaXJz", + "method_name": "climbStairs" }, { - "title": "Best Time to Buy and Sell Stock", - "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock/", - "description": "

You are given an array prices where prices[i] is the price of a given stock on the ith day.

\n\n

You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.

\n\n

Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.

\n\n

 

\n

Example 1:

\n\n
\nInput: prices = [7,1,5,3,6,4]\nOutput: 5\nExplanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.\nNote that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.\n
\n\n

Example 2:

\n\n
\nInput: prices = [7,6,4,3,1]\nOutput: 0\nExplanation: In this case, no transactions are done and the max profit = 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= prices.length <= 105
  • \n\t
  • 0 <= prices[i] <= 104
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=7,1,5,3,6,4", - "--arg1=7,6,4,3,1", - "--arg1=2,4,1,7" - ], - "sample_test_results": [ - "5", - "0", - "6" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=1,2", - "--arg1=2,1", - "--arg1=3,3,3", - "--arg1=1,2,4,2,5,7,2,4,9,0", - "--arg1=2,1,2,1,0,1,2", - "--arg1=9,8,7,6,5,4,3,2,1", - "--arg1=1,4,1,4,3,1", - "--arg1=10000,9999,9998,9997", - "--arg1=0,2,0,2,0,2" - ], - "hidden_test_results": [ - "0", - "1", - "0", - "0", - "8", - "2", - "0", - "3", - "0", - "2" - ], - "boilerplate": { - "python": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", - "java": "class Solution {\n public int maxProfit(int[] prices) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maxProfit(vector& prices) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=1pkOgXD63yU&pp=ygUoTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jaw%3D%3D" + "title": "Best Time to Buy and Sell Stock", + "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock/", + "description": "

You are given an array prices where prices[i] is the price of a given stock on the ith day.

\n\n

You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.

\n\n

Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.

\n\n

 

\n

Example 1:

\n\n
\nInput: prices = [7,1,5,3,6,4]\nOutput: 5\nExplanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.\nNote that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.\n
\n\n

Example 2:

\n\n
\nInput: prices = [7,6,4,3,1]\nOutput: 0\nExplanation: In this case, no transactions are done and the max profit = 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= prices.length <= 105
  • \n\t
  • 0 <= prices[i] <= 104
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[7,1,5,3,6,4]", + "--arg1=[7,6,4,3,1]", + "--arg1=[2,4,1,7]" + ], + "sample_test_results": [ + "5", + "0", + "6" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,2]", + "--arg1=[2,1]", + "--arg1=[3,3,3]", + "--arg1=[1,2,4,2,5,7,2,4,9,0]", + "--arg1=[2,1,2,1,0,1,2]", + "--arg1=[9,8,7,6,5,4,3,2,1]", + "--arg1=[1,4,1,4,3,1]", + "--arg1=[10000,9999,9998,9997]", + "--arg1=[0,2,0,2,0,2]" + ], + "hidden_test_results": [ + "0", + "1", + "0", + "0", + "8", + "2", + "0", + "3", + "0", + "2" + ], + "boilerplate": { + "python": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", + "java": "class Solution {\n public int maxProfit(int[] prices) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxProfit(vector& prices) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=1pkOgXD63yU&pp=ygUoTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jaw%3D%3D", + "method_name": "maxProfit" }, { - "title": "Valid Palindrome", - "source": "https://leetcode.com/problems/valid-palindrome/", - "description": "

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.

\n\n

Given a string s, return true if it is a palindrome, or false otherwise.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "A man, a plan, a canal: Panama"\nOutput: true\nExplanation: "amanaplanacanalpanama" is a palindrome.\n
\n\n

Example 2:

\n\n
\nInput: s = "race a car"\nOutput: false\nExplanation: "raceacar" is not a palindrome.\n
\n\n

Example 3:

\n\n
\nInput: s = " "\nOutput: true\nExplanation: s is an empty string "" after removing non-alphanumeric characters.\nSince an empty string reads the same forward and backward, it is a palindrome.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 2 * 105
  • \n\t
  • s consists only of printable ASCII characters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=\"A man --arg2=a plan --arg3=a canal: Panama\"", - "--arg1=\"race a car\"", - "--arg1=\" \"" - ], - "sample_test_results": [ - "True", - "False", - "True" - ], - "hidden_test_cases": [ - "--arg1=\"\"", - "--arg1=\". --arg2=\"", - "--arg1=\"0P\"", - "--arg1=\"abc123cba\"", - "--arg1=\"Race a Car\"", - "--arg1=\"!@#$%^&*()\"", - "--arg1=\"12321\"", - "--arg1=\"Never odd or even\"", - "--arg1=\"a\"", - "--arg1=\". --arg2=a --arg3=.\"" - ], - "hidden_test_results": [ - "True", - "True", - "False", - "False", - "False", - "True", - "True", - "True", - "True", - "True" - ], - "boilerplate": { - "python": "class Solution:\n def isPalindrome(self, s: str) -> bool:\n ", - "java": "class Solution {\n public boolean isPalindrome(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isPalindrome(std::string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return toLowerCase(result) == toLowerCase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=jJXJ16kPFWg&pp=ygUZTmVldENvZGUgVmFsaWQgUGFsaW5kcm9tZQ%3D%3D" + "title": "Valid Palindrome", + "source": "https://leetcode.com/problems/valid-palindrome/", + "description": "

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.

\n\n

Given a string s, return true if it is a palindrome, or false otherwise.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "A man, a plan, a canal: Panama"\nOutput: true\nExplanation: "amanaplanacanalpanama" is a palindrome.\n
\n\n

Example 2:

\n\n
\nInput: s = "race a car"\nOutput: false\nExplanation: "raceacar" is not a palindrome.\n
\n\n

Example 3:

\n\n
\nInput: s = " "\nOutput: true\nExplanation: s is an empty string "" after removing non-alphanumeric characters.\nSince an empty string reads the same forward and backward, it is a palindrome.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 2 * 105
  • \n\t
  • s consists only of printable ASCII characters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=\"A man --arg2=a plan --arg3=a canal: Panama\"", + "--arg1=\"race a car\"", + "--arg1=\" \"" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=\"\"", + "--arg1=\". --arg2=\"", + "--arg1=\"0P\"", + "--arg1=\"abc123cba\"", + "--arg1=\"Race a Car\"", + "--arg1=\"!@#$%^&*()\"", + "--arg1=\"12321\"", + "--arg1=\"Never odd or even\"", + "--arg1=\"a\"", + "--arg1=\". --arg2=a --arg3=.\"" + ], + "hidden_test_results": [ + "true", + "true", + "false", + "false", + "false", + "true", + "true", + "true", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def isPalindrome(self, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean isPalindrome(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPalindrome(std::string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return toLowerCase(result) == toLowerCase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=jJXJ16kPFWg&pp=ygUZTmVldENvZGUgVmFsaWQgUGFsaW5kcm9tZQ%3D%3D", + "method_name": "isPalindrome" }, { - "title": "Excel Sheet Column Title", - "source": "https://leetcode.com/problems/excel-sheet-column-title/", - "description": "

Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.

\n\n

For example:

\n\n
\nA -> 1\nB -> 2\nC -> 3\n...\nZ -> 26\nAA -> 27\nAB -> 28 \n...\n
\n\n

 

\n

Example 1:

\n\n
\nInput: columnNumber = 1\nOutput: "A"\n
\n\n

Example 2:

\n\n
\nInput: columnNumber = 28\nOutput: "AB"\n
\n\n

Example 3:

\n\n
\nInput: columnNumber = 701\nOutput: "ZY"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= columnNumber <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1", - "--arg1=28", - "--arg1=701" - ], - "sample_test_results": [ - "'A'", - "'AB'", - "'ZY'" - ], - "hidden_test_cases": [ - "--arg1=26", - "--arg1=27", - "--arg1=52", - "--arg1=676", - "--arg1=702", - "--arg1=1000", - "--arg1=2147483647", - "--arg1=18278", - "--arg1=17576", - "--arg1=18277" - ], - "hidden_test_results": [ - "'Z'", - "'AA'", - "'AZ'", - "'YZ'", - "'ZZ'", - "'ALL'", - "'FXSHRXW'", - "'ZZZ'", - "'YYZ'", - "'ZZY'" - ], - "boilerplate": { - "python": "class Solution:\n def convertToTitle(self, columnNumber: int) -> str:\n ", - "java": "class Solution {\n public String convertToTitle(int columnNumber) {\n // Implementation goes here\n }\n}", - "cpp": "class Solution {\npublic:\n std::string convertToTitle(int columnNumber) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=X_vJDpCCuoA&pp=ygUhTmVldENvZGUgRXhjZWwgU2hlZXQgQ29sdW1uIFRpdGxl" + "title": "Excel Sheet Column Title", + "source": "https://leetcode.com/problems/excel-sheet-column-title/", + "description": "

Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.

\n\n

For example:

\n\n
\nA -> 1\nB -> 2\nC -> 3\n...\nZ -> 26\nAA -> 27\nAB -> 28 \n...\n
\n\n

 

\n

Example 1:

\n\n
\nInput: columnNumber = 1\nOutput: "A"\n
\n\n

Example 2:

\n\n
\nInput: columnNumber = 28\nOutput: "AB"\n
\n\n

Example 3:

\n\n
\nInput: columnNumber = 701\nOutput: "ZY"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= columnNumber <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=1", + "--arg1=28", + "--arg1=701" + ], + "sample_test_results": [ + "'A'", + "'AB'", + "'ZY'" + ], + "hidden_test_cases": [ + "--arg1=26", + "--arg1=27", + "--arg1=52", + "--arg1=676", + "--arg1=702", + "--arg1=1000", + "--arg1=2147483647", + "--arg1=18278", + "--arg1=17576", + "--arg1=18277" + ], + "hidden_test_results": [ + "'Z'", + "'AA'", + "'AZ'", + "'YZ'", + "'ZZ'", + "'ALL'", + "'FXSHRXW'", + "'ZZZ'", + "'YYZ'", + "'ZZY'" + ], + "boilerplate": { + "python": "class Solution:\n def convertToTitle(self, columnNumber: int) -> str:\n ", + "java": "class Solution {\n public String convertToTitle(int columnNumber) {\n // Implementation goes here\n }\n}", + "cpp": "class Solution {\npublic:\n std::string convertToTitle(int columnNumber) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=X_vJDpCCuoA&pp=ygUhTmVldENvZGUgRXhjZWwgU2hlZXQgQ29sdW1uIFRpdGxl", + "method_name": "convertToTitle" }, { - "title": "Happy Number", - "source": "https://leetcode.com/problems/happy-number/", - "description": "

Write an algorithm to determine if a number n is happy.

\n\n

A happy number is a number defined by the following process:

\n\n
    \n\t
  • Starting with any positive integer, replace the number by the sum of the squares of its digits.
  • \n\t
  • Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1.
  • \n\t
  • Those numbers for which this process ends in 1 are happy.
  • \n
\n\n

Return true if n is a happy number, and false if not.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 19\nOutput: true\nExplanation:\n12 + 92 = 82\n82 + 22 = 68\n62 + 82 = 100\n12 + 02 + 02 = 1\n
\n\n

Example 2:

\n\n
\nInput: n = 2\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=19", - "--arg1=2", - "--arg1=7" - ], - "sample_test_results": [ - "True", - "False", - "True" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=4", - "--arg1=16", - "--arg1=89", - "--arg1=100", - "--arg1=1111111", - "--arg1=999999", - "--arg1=123", - "--arg1=3", - "--arg1=44" - ], - "hidden_test_results": [ - "True", - "False", - "False", - "False", - "True", - "True", - "False", - "False", - "False", - "True" - ], - "boilerplate": { - "python": "class Solution:\n def isHappy(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean isHappy(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isHappy(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=ljz85bxOYJ0&pp=ygUVTmVldENvZGUgSGFwcHkgTnVtYmVy" + "title": "Happy Number", + "source": "https://leetcode.com/problems/happy-number/", + "description": "

Write an algorithm to determine if a number n is happy.

\n\n

A happy number is a number defined by the following process:

\n\n
    \n\t
  • Starting with any positive integer, replace the number by the sum of the squares of its digits.
  • \n\t
  • Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1.
  • \n\t
  • Those numbers for which this process ends in 1 are happy.
  • \n
\n\n

Return true if n is a happy number, and false if not.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 19\nOutput: true\nExplanation:\n12 + 92 = 82\n82 + 22 = 68\n62 + 82 = 100\n12 + 02 + 02 = 1\n
\n\n

Example 2:

\n\n
\nInput: n = 2\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=19", + "--arg1=2", + "--arg1=7" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=1", + "--arg1=4", + "--arg1=16", + "--arg1=89", + "--arg1=100", + "--arg1=1111111", + "--arg1=999999", + "--arg1=123", + "--arg1=3", + "--arg1=44" + ], + "hidden_test_results": [ + "true", + "false", + "false", + "false", + "true", + "true", + "false", + "false", + "false", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def isHappy(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isHappy(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isHappy(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=ljz85bxOYJ0&pp=ygUVTmVldENvZGUgSGFwcHkgTnVtYmVy", + "method_name": "isHappy" }, { - "title": "Isomorphic Strings", - "source": "https://leetcode.com/problems/isomorphic-strings/", - "description": "

Given two strings s and t, determine if they are isomorphic.

\n\n

Two strings s and t are isomorphic if the characters in s can be replaced to get t.

\n\n

All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself.

\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "egg", t = "add"

\n\n

Output: true

\n\n

Explanation:

\n\n

The strings s and t can be made identical by:

\n\n
    \n\t
  • Mapping 'e' to 'a'.
  • \n\t
  • Mapping 'g' to 'd'.
  • \n
\n
\n\n

Example 2:

\n\n
\n

Input: s = "foo", t = "bar"

\n\n

Output: false

\n\n

Explanation:

\n\n

The strings s and t can not be made identical as 'o' needs to be mapped to both 'a' and 'r'.

\n
\n\n

Example 3:

\n\n
\n

Input: s = "paper", t = "title"

\n\n

Output: true

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 5 * 104
  • \n\t
  • t.length == s.length
  • \n\t
  • s and t consist of any valid ascii character.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=\"egg\" --arg2=\"add\"", - "--arg1=\"foo\" --arg2=\"bar\"", - "--arg1=\"paper\" --arg2=\"title\"" - ], - "sample_test_results": [ - "True", - "False", - "True" - ], - "hidden_test_cases": [ - "--arg1=\"\" --arg2=\"\"", - "--arg1=\"a\" --arg2=\"b\"", - "--arg1=\"ab\" --arg2=\"aa\"", - "--arg1=\"badc\" --arg2=\"bada\"", - "--arg1=\"abcde\" --arg2=\"vwxyz\"", - "--arg1=\"hello\" --arg2=\"world\"", - "--arg1=\"aaaa\" --arg2=\"bbbb\"", - "--arg1=\"ab\" --arg2=\"cd\"", - "--arg1=\"13\" --arg2=\"42\"", - "--arg1=\"ACAB\" --arg2=\"XCXY\"" - ], - "hidden_test_results": [ - "True", - "True", - "False", - "False", - "True", - "False", - "True", - "True", - "True", - "True" - ], - "boilerplate": { - "python": "class Solution:\n def isIsomorphic(self, s: str, t: str) -> bool:\n ", - "java": "class Solution {\n public boolean isIsomorphic(String s, String t) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isIsomorphic(string s, string t) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return toLowerCase(result) == toLowerCase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=7yF-U1hLEqQ&pp=ygUbTmVldENvZGUgSXNvbW9ycGhpYyBTdHJpbmdz" + "title": "Isomorphic Strings", + "source": "https://leetcode.com/problems/isomorphic-strings/", + "description": "

Given two strings s and t, determine if they are isomorphic.

\n\n

Two strings s and t are isomorphic if the characters in s can be replaced to get t.

\n\n

All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself.

\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "egg", t = "add"

\n\n

Output: true

\n\n

Explanation:

\n\n

The strings s and t can be made identical by:

\n\n
    \n\t
  • Mapping 'e' to 'a'.
  • \n\t
  • Mapping 'g' to 'd'.
  • \n
\n
\n\n

Example 2:

\n\n
\n

Input: s = "foo", t = "bar"

\n\n

Output: false

\n\n

Explanation:

\n\n

The strings s and t can not be made identical as 'o' needs to be mapped to both 'a' and 'r'.

\n
\n\n

Example 3:

\n\n
\n

Input: s = "paper", t = "title"

\n\n

Output: true

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 5 * 104
  • \n\t
  • t.length == s.length
  • \n\t
  • s and t consist of any valid ascii character.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=\"egg\" --arg2=\"add\"", + "--arg1=\"foo\" --arg2=\"bar\"", + "--arg1=\"paper\" --arg2=\"title\"" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=\"\" --arg2=\"\"", + "--arg1=\"a\" --arg2=\"b\"", + "--arg1=\"ab\" --arg2=\"aa\"", + "--arg1=\"badc\" --arg2=\"bada\"", + "--arg1=\"abcde\" --arg2=\"vwxyz\"", + "--arg1=\"hello\" --arg2=\"world\"", + "--arg1=\"aaaa\" --arg2=\"bbbb\"", + "--arg1=\"ab\" --arg2=\"cd\"", + "--arg1=\"13\" --arg2=\"42\"", + "--arg1=\"ACAB\" --arg2=\"XCXY\"" + ], + "hidden_test_results": [ + "true", + "true", + "false", + "false", + "true", + "false", + "true", + "true", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def isIsomorphic(self, s: str, t: str) -> bool:\n ", + "java": "class Solution {\n public boolean isIsomorphic(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isIsomorphic(string s, string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return toLowerCase(result) == toLowerCase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=7yF-U1hLEqQ&pp=ygUbTmVldENvZGUgSXNvbW9ycGhpYyBTdHJpbmdz", + "method_name": "isIsomorphic" }, { - "title": "Contains Duplicate II", - "source": "https://leetcode.com/problems/contains-duplicate-ii/", - "description": "

Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) <= k.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,3,1], k = 3\nOutput: true\n
\n\n

Example 2:

\n\n
\nInput: nums = [1,0,1,1], k = 1\nOutput: true\n
\n\n

Example 3:

\n\n
\nInput: nums = [1,2,3,1,2,3], k = 2\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • 0 <= k <= 105
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1,2,3,1 --arg2=3", - "--arg1=1,0,1,1 --arg2=1", - "--arg1=1,2,3,1,2,3 --arg2=2" - ], - "sample_test_results": [ - "True", - "True", - "False" - ], - "hidden_test_cases": [ - "--arg1=1,2,3,4,5 --arg2=2", - "--arg1=1,1 --arg2=1", - "--arg1=1,2,1 --arg2=0", - "--arg1=1,2,3,4,1 --arg2=4", - "--arg1=1,2,3,4,1 --arg2=3", - "--arg1=-1,-1 --arg2=1", - "--arg1=1 --arg2=1", - "--arg1=1,2,3,4,2 --arg2=3", - "--arg1=1,1,1,1 --arg2=2", - "--arg1=1,2,1,2 --arg2=2" - ], - "hidden_test_results": [ - "False", - "True", - "False", - "True", - "False", - "True", - "False", - "True", - "True", - "True" - ], - "boilerplate": { - "python": "class Solution:\n def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool:\n ", - "java": "class Solution {\n public boolean containsNearbyDuplicate(int[] nums, int k) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool containsNearbyDuplicate(std::vector& nums, int k) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=ypn0aZ0nrL4&pp=ygUeTmVldENvZGUgQ29udGFpbnMgRHVwbGljYXRlIElJ" + "title": "Contains Duplicate II", + "source": "https://leetcode.com/problems/contains-duplicate-ii/", + "description": "

Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) <= k.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,3,1], k = 3\nOutput: true\n
\n\n

Example 2:

\n\n
\nInput: nums = [1,0,1,1], k = 1\nOutput: true\n
\n\n

Example 3:

\n\n
\nInput: nums = [1,2,3,1,2,3], k = 2\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • 0 <= k <= 105
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,2,3,1] --arg2=3", + "--arg1=[1,0,1,1] --arg2=1", + "--arg1=[1,2,3,1,2,3] --arg2=2" + ], + "sample_test_results": [ + "true", + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1=[1,2,3,4,5] --arg2=2", + "--arg1=[1,1] --arg2=1", + "--arg1=[1,2,1] --arg2=0", + "--arg1=[1,2,3,4,1] --arg2=4", + "--arg1=[1,2,3,4,1] --arg2=3", + "--arg1=[-1,-1] --arg2=1", + "--arg1=[1] --arg2=1", + "--arg1=[1,2,3,4,2] --arg2=3", + "--arg1=[1,1,1,1] --arg2=2", + "--arg1=[1,2,1,2] --arg2=2" + ], + "hidden_test_results": [ + "false", + "true", + "false", + "true", + "false", + "true", + "false", + "true", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool:\n ", + "java": "class Solution {\n public boolean containsNearbyDuplicate(int[] nums, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool containsNearbyDuplicate(std::vector& nums, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=ypn0aZ0nrL4&pp=ygUeTmVldENvZGUgQ29udGFpbnMgRHVwbGljYXRlIElJ", + "method_name": "containsNearbyDuplicate" }, { - "title": "Summary Ranges", - "source": "https://leetcode.com/problems/summary-ranges/", - "description": "

You are given a sorted unique integer array nums.

\n\n

A range [a,b] is the set of all integers from a to b (inclusive).

\n\n

Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, each element of nums is covered by exactly one of the ranges, and there is no integer x such that x is in one of the ranges but not in nums.

\n\n

Each range [a,b] in the list should be output as:

\n\n
    \n\t
  • "a->b" if a != b
  • \n\t
  • "a" if a == b
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [0,1,2,4,5,7]\nOutput: ["0->2","4->5","7"]\nExplanation: The ranges are:\n[0,2] --> "0->2"\n[4,5] --> "4->5"\n[7,7] --> "7"\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,2,3,4,6,8,9]\nOutput: ["0","2->4","6","8->9"]\nExplanation: The ranges are:\n[0,0] --> "0"\n[2,4] --> "2->4"\n[6,6] --> "6"\n[8,9] --> "8->9"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 20
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n\t
  • All the values of nums are unique.
  • \n\t
  • nums is sorted in ascending order.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=0,1,2,4,5,7", - "--arg1=0,2,3,4,6,8,9", - "--arg1=" - ], - "sample_test_results": [ - "'0->2', '4->5', '7'", - "'0', '2->4', '6', '8->9'", - "" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=1,2", - "--arg1=1,3,5,7", - "--arg1=1,2,3,4,5", - "--arg1=-1,0,1,2", - "--arg1=-5,-4,-3,-1,0,2", - "--arg1=1,3", - "--arg1=1,2,4,6,7,8", - "--arg1=0,1,3,5,6,7,9", - "--arg1=-2147483648,2147483647" - ], - "hidden_test_results": [ - "'1'", - "'1->2'", - "'1', '3', '5', '7'", - "'1->5'", - "'-1->2'", - "'-5->-3', '-1->0', '2'", - "'1', '3'", - "'1->2', '4', '6->8'", - "'0->1', '3', '5->7', '9'", - "'-2147483648', '2147483647'" - ], - "boilerplate": { - "python": "class Solution:\n def summaryRanges(self, nums: List[int]) -> List[str]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List summaryRanges(List nums) {\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector summaryRanges(vector& nums) {\n // Implementation goes here\n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "return Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray());", - "cpp": "std::sort(result.begin(), result.end());\nauto evaluated_expected = evaluateStringToVector(expected);\nstd::sort(evaluated_expected.begin(), evaluated_expected.end());\nreturn result == evaluated_expected;" - }, - "explanation": "https://www.youtube.com/watch?v=ZHJDwbfqoa8&pp=ygUXTmVldENvZGUgU3VtbWFyeSBSYW5nZXM%3D" + "title": "Summary Ranges", + "source": "https://leetcode.com/problems/summary-ranges/", + "description": "

You are given a sorted unique integer array nums.

\n\n

A range [a,b] is the set of all integers from a to b (inclusive).

\n\n

Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, each element of nums is covered by exactly one of the ranges, and there is no integer x such that x is in one of the ranges but not in nums.

\n\n

Each range [a,b] in the list should be output as:

\n\n
    \n\t
  • "a->b" if a != b
  • \n\t
  • "a" if a == b
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [0,1,2,4,5,7]\nOutput: ["0->2","4->5","7"]\nExplanation: The ranges are:\n[0,2] --> "0->2"\n[4,5] --> "4->5"\n[7,7] --> "7"\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,2,3,4,6,8,9]\nOutput: ["0","2->4","6","8->9"]\nExplanation: The ranges are:\n[0,0] --> "0"\n[2,4] --> "2->4"\n[6,6] --> "6"\n[8,9] --> "8->9"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 20
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n\t
  • All the values of nums are unique.
  • \n\t
  • nums is sorted in ascending order.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[0,1,2,4,5,7]", + "--arg1=[0,2,3,4,6,8,9]", + "--arg1=[]" + ], + "sample_test_results": [ + "['0->2','4->5','7']", + "['0','2->4','6','8->9']", + "[]" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,2]", + "--arg1=[1,3,5,7]", + "--arg1=[1,2,3,4,5]", + "--arg1=[-1,0,1,2]", + "--arg1=[-5,-4,-3,-1,0,2]", + "--arg1=[1,3]", + "--arg1=[1,2,4,6,7,8]", + "--arg1=[0,1,3,5,6,7,9]", + "--arg1=[-2147483648,2147483647]" + ], + "hidden_test_results": [ + "['1']", + "['1->2']", + "['1','3','5','7']", + "['1->5']", + "['-1->2']", + "['-5->-3','-1->0','2']", + "['1','3']", + "['1->2','4','6->8']", + "['0->1','3','5->7','9']", + "['-2147483648','2147483647']" + ], + "boilerplate": { + "python": "class Solution:\n def summaryRanges(self, nums: List[int]) -> List[str]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List summaryRanges(List nums) {\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector summaryRanges(vector& nums) {\n // Implementation goes here\n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "return Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray());", + "cpp": "std::sort(result.begin(), result.end());\nauto evaluated_expected = evaluateStringToVector(expected);\nstd::sort(evaluated_expected.begin(), evaluated_expected.end());\nreturn result == evaluated_expected;" + }, + "explanation": "https://www.youtube.com/watch?v=ZHJDwbfqoa8&pp=ygUXTmVldENvZGUgU3VtbWFyeSBSYW5nZXM%3D", + "method_name": "summaryRanges" }, { - "title": "Power of Two", - "source": "https://leetcode.com/problems/power-of-two/", - "description": "

Given an integer n, return true if it is a power of two. Otherwise, return false.

\n\n

An integer n is a power of two, if there exists an integer x such that n == 2x.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 1\nOutput: true\nExplanation: 20 = 1\n
\n\n

Example 2:

\n\n
\nInput: n = 16\nOutput: true\nExplanation: 24 = 16\n
\n\n

Example 3:

\n\n
\nInput: n = 3\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1", - "--arg1=16", - "--arg1=3" - ], - "sample_test_results": [ - "True", - "True", - "False" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=-16", - "--arg1=2", - "--arg1=4", - "--arg1=5", - "--arg1=32", - "--arg1=64", - "--arg1=100", - "--arg1=2147483647", - "--arg1=-2147483648" - ], - "hidden_test_results": [ - "False", - "False", - "True", - "True", - "False", - "True", - "True", - "False", - "False", - "False" - ], - "boilerplate": { - "python": "class Solution:\n def isPowerOfTwo(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean isPowerOfTwo(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isPowerOfTwo(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) == std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" - }, - "explanation": "https://www.youtube.com/watch?v=H2bjttEV4Vc&pp=ygUVTmVldENvZGUgUG93ZXIgb2YgVHdv" + "title": "Power of Two", + "source": "https://leetcode.com/problems/power-of-two/", + "description": "

Given an integer n, return true if it is a power of two. Otherwise, return false.

\n\n

An integer n is a power of two, if there exists an integer x such that n == 2x.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 1\nOutput: true\nExplanation: 20 = 1\n
\n\n

Example 2:

\n\n
\nInput: n = 16\nOutput: true\nExplanation: 24 = 16\n
\n\n

Example 3:

\n\n
\nInput: n = 3\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=1", + "--arg1=16", + "--arg1=3" + ], + "sample_test_results": [ + "true", + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=-16", + "--arg1=2", + "--arg1=4", + "--arg1=5", + "--arg1=32", + "--arg1=64", + "--arg1=100", + "--arg1=2147483647", + "--arg1=-2147483648" + ], + "hidden_test_results": [ + "false", + "false", + "true", + "true", + "false", + "true", + "true", + "false", + "false", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isPowerOfTwo(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPowerOfTwo(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPowerOfTwo(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) == std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" + }, + "explanation": "https://www.youtube.com/watch?v=H2bjttEV4Vc&pp=ygUVTmVldENvZGUgUG93ZXIgb2YgVHdv", + "method_name": "isPowerOfTwo" }, { - "title": "Ugly Number", - "source": "https://leetcode.com/problems/ugly-number/", - "description": "

An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.

\n\n

Given an integer n, return true if n is an ugly number.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 6\nOutput: true\nExplanation: 6 = 2 × 3\n
\n\n

Example 2:

\n\n
\nInput: n = 1\nOutput: true\nExplanation: 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5.\n
\n\n

Example 3:

\n\n
\nInput: n = 14\nOutput: false\nExplanation: 14 is not ugly since it includes the prime factor 7.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=6", - "--arg1=1", - "--arg1=14" - ], - "sample_test_results": [ - "True", - "True", - "False" - ], - "hidden_test_cases": [ - "--arg1=8", - "--arg1=0", - "--arg1=-6", - "--arg1=25", - "--arg1=15", - "--arg1=49", - "--arg1=30", - "--arg1=100", - "--arg1=-2147483648", - "--arg1=2147483647" - ], - "hidden_test_results": [ - "True", - "False", - "False", - "True", - "True", - "False", - "True", - "True", - "False", - "False" - ], - "boilerplate": { - "python": "class Solution:\n def isUgly(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean isUgly(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isUgly(int n) {\n\n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=M0Zay1Qr9ws&pp=ygUUTmVldENvZGUgVWdseSBOdW1iZXI%3D" + "title": "Ugly Number", + "source": "https://leetcode.com/problems/ugly-number/", + "description": "

An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.

\n\n

Given an integer n, return true if n is an ugly number.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 6\nOutput: true\nExplanation: 6 = 2 × 3\n
\n\n

Example 2:

\n\n
\nInput: n = 1\nOutput: true\nExplanation: 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5.\n
\n\n

Example 3:

\n\n
\nInput: n = 14\nOutput: false\nExplanation: 14 is not ugly since it includes the prime factor 7.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=6", + "--arg1=1", + "--arg1=14" + ], + "sample_test_results": [ + "true", + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1=8", + "--arg1=0", + "--arg1=-6", + "--arg1=25", + "--arg1=15", + "--arg1=49", + "--arg1=30", + "--arg1=100", + "--arg1=-2147483648", + "--arg1=2147483647" + ], + "hidden_test_results": [ + "true", + "false", + "false", + "true", + "true", + "false", + "true", + "true", + "false", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isUgly(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isUgly(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isUgly(int n) {\n\n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=M0Zay1Qr9ws&pp=ygUUTmVldENvZGUgVWdseSBOdW1iZXI%3D", + "method_name": "isUgly" }, { - "title": "Word Pattern", - "source": "https://leetcode.com/problems/word-pattern/", - "description": "

Given a pattern and a string s, find if s follows the same pattern.

\n\n

Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. Specifically:

\n\n
    \n\t
  • Each letter in pattern maps to exactly one unique word in s.
  • \n\t
  • Each unique word in s maps to exactly one letter in pattern.
  • \n\t
  • No two letters map to the same word, and no two words map to the same letter.
  • \n
\n\n

 

\n

Example 1:

\n\n
\n

Input: pattern = "abba", s = "dog cat cat dog"

\n\n

Output: true

\n\n

Explanation:

\n\n

The bijection can be established as:

\n\n
    \n\t
  • 'a' maps to "dog".
  • \n\t
  • 'b' maps to "cat".
  • \n
\n
\n\n

Example 2:

\n\n
\n

Input: pattern = "abba", s = "dog cat cat fish"

\n\n

Output: false

\n
\n\n

Example 3:

\n\n
\n

Input: pattern = "aaaa", s = "dog cat cat dog"

\n\n

Output: false

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= pattern.length <= 300
  • \n\t
  • pattern contains only lower-case English letters.
  • \n\t
  • 1 <= s.length <= 3000
  • \n\t
  • s contains only lowercase English letters and spaces ' '.
  • \n\t
  • s does not contain any leading or trailing spaces.
  • \n\t
  • All the words in s are separated by a single space.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=\"abba\" --arg2=\"dog cat cat dog\"", - "--arg1=\"abba\" --arg2=\"dog cat cat fish\"", - "--arg1=\"aaaa\" --arg2=\"dog cat cat dog\"" - ], - "sample_test_results": [ - "True", - "False", - "False" - ], - "hidden_test_cases": [ - "--arg1=\"abc\" --arg2=\"dog cat dog\"", - "--arg1=\"jquery\" --arg2=\"jquery\"", - "--arg1=\"aaa\" --arg2=\"aa aa aa\"", - "--arg1=\"abba\" --arg2=\"dog dog dog dog\"", - "--arg1=\"ab\" --arg2=\"dog cat\"", - "--arg1=\"abc\" --arg2=\"b c a\"", - "--arg1=\"aabb\" --arg2=\"cat cat dog dog\"", - "--arg1=\"abba\" --arg2=\"dog cat cat fish\"", - "--arg1=\"\" --arg2=\"\"", - "--arg1=\"a\" --arg2=\"dog\"" - ], - "hidden_test_results": [ - "False", - "False", - "True", - "False", - "True", - "True", - "True", - "False", - "True", - "True" - ], - "boilerplate": { - "python": "class Solution:\n def wordPattern(self, pattern: str, s: str) -> bool:\n ", - "java": "class Solution {\n public boolean wordPattern(String pattern, String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool wordPattern(const string& pattern, const string& s) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return toLowercase(result) == toLowercase(expected);\n\nstd::string toLowercase(const std::string &input) {\n std::string lowercased = input;\n std::transform(lowercased.begin(), lowercased.end(), lowercased.begin(), ::tolower);\n return lowercased;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=W_akoecmCbM&pp=ygUVTmVldENvZGUgV29yZCBQYXR0ZXJu" + "title": "Word Pattern", + "source": "https://leetcode.com/problems/word-pattern/", + "description": "

Given a pattern and a string s, find if s follows the same pattern.

\n\n

Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. Specifically:

\n\n
    \n\t
  • Each letter in pattern maps to exactly one unique word in s.
  • \n\t
  • Each unique word in s maps to exactly one letter in pattern.
  • \n\t
  • No two letters map to the same word, and no two words map to the same letter.
  • \n
\n\n

 

\n

Example 1:

\n\n
\n

Input: pattern = "abba", s = "dog cat cat dog"

\n\n

Output: true

\n\n

Explanation:

\n\n

The bijection can be established as:

\n\n
    \n\t
  • 'a' maps to "dog".
  • \n\t
  • 'b' maps to "cat".
  • \n
\n
\n\n

Example 2:

\n\n
\n

Input: pattern = "abba", s = "dog cat cat fish"

\n\n

Output: false

\n
\n\n

Example 3:

\n\n
\n

Input: pattern = "aaaa", s = "dog cat cat dog"

\n\n

Output: false

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= pattern.length <= 300
  • \n\t
  • pattern contains only lower-case English letters.
  • \n\t
  • 1 <= s.length <= 3000
  • \n\t
  • s contains only lowercase English letters and spaces ' '.
  • \n\t
  • s does not contain any leading or trailing spaces.
  • \n\t
  • All the words in s are separated by a single space.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=\"abba\" --arg2=\"dog cat cat dog\"", + "--arg1=\"abba\" --arg2=\"dog cat cat fish\"", + "--arg1=\"aaaa\" --arg2=\"dog cat cat dog\"" + ], + "sample_test_results": [ + "true", + "false", + "false" + ], + "hidden_test_cases": [ + "--arg1=\"abc\" --arg2=\"dog cat dog\"", + "--arg1=\"jquery\" --arg2=\"jquery\"", + "--arg1=\"aaa\" --arg2=\"aa aa aa\"", + "--arg1=\"abba\" --arg2=\"dog dog dog dog\"", + "--arg1=\"ab\" --arg2=\"dog cat\"", + "--arg1=\"abc\" --arg2=\"b c a\"", + "--arg1=\"aabb\" --arg2=\"cat cat dog dog\"", + "--arg1=\"abba\" --arg2=\"dog cat cat fish\"", + "--arg1=\"\" --arg2=\"\"", + "--arg1=\"a\" --arg2=\"dog\"" + ], + "hidden_test_results": [ + "false", + "false", + "true", + "false", + "true", + "true", + "true", + "false", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def wordPattern(self, pattern: str, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean wordPattern(String pattern, String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool wordPattern(const string& pattern, const string& s) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return toLowercase(result) == toLowercase(expected);\n\nstd::string toLowercase(const std::string &input) {\n std::string lowercased = input;\n std::transform(lowercased.begin(), lowercased.end(), lowercased.begin(), ::tolower);\n return lowercased;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=W_akoecmCbM&pp=ygUVTmVldENvZGUgV29yZCBQYXR0ZXJu", + "method_name": "wordPattern" }, { - "title": "Nim Game", - "source": "https://leetcode.com/problems/nim-game/", - "description": "

You are playing the following Nim Game with your friend:

\n\n
    \n\t
  • Initially, there is a heap of stones on the table.
  • \n\t
  • You and your friend will alternate taking turns, and you go first.
  • \n\t
  • On each turn, the person whose turn it is will remove 1 to 3 stones from the heap.
  • \n\t
  • The one who removes the last stone is the winner.
  • \n
\n\n

Given n, the number of stones in the heap, return true if you can win the game assuming both you and your friend play optimally, otherwise return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 4\nOutput: false\nExplanation: These are the possible outcomes:\n1. You remove 1 stone. Your friend removes 3 stones, including the last stone. Your friend wins.\n2. You remove 2 stones. Your friend removes 2 stones, including the last stone. Your friend wins.\n3. You remove 3 stones. Your friend removes the last stone. Your friend wins.\nIn all outcomes, your friend wins.\n
\n\n

Example 2:

\n\n
\nInput: n = 1\nOutput: true\n
\n\n

Example 3:

\n\n
\nInput: n = 2\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=4", - "--arg1=1", - "--arg1=2" - ], - "sample_test_results": [ - "False", - "True", - "True" - ], - "hidden_test_cases": [ - "--arg1=3", - "--arg1=5", - "--arg1=6", - "--arg1=7", - "--arg1=8", - "--arg1=9", - "--arg1=10", - "--arg1=100", - "--arg1=1000000", - "--arg1=2147483647" - ], - "hidden_test_results": [ - "True", - "True", - "True", - "True", - "False", - "True", - "True", - "False", - "False", - "True" - ], - "boilerplate": { - "python": "class Solution:\n def canWinNim(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean canWinNim(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool canWinNim(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) ==\n std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" - }, - "explanation": "https://www.youtube.com/watch?v=ndR2buBWVc8&pp=ygURTmVldENvZGUgTmltIEdhbWU%3D" + "title": "Nim Game", + "source": "https://leetcode.com/problems/nim-game/", + "description": "

You are playing the following Nim Game with your friend:

\n\n
    \n\t
  • Initially, there is a heap of stones on the table.
  • \n\t
  • You and your friend will alternate taking turns, and you go first.
  • \n\t
  • On each turn, the person whose turn it is will remove 1 to 3 stones from the heap.
  • \n\t
  • The one who removes the last stone is the winner.
  • \n
\n\n

Given n, the number of stones in the heap, return true if you can win the game assuming both you and your friend play optimally, otherwise return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 4\nOutput: false\nExplanation: These are the possible outcomes:\n1. You remove 1 stone. Your friend removes 3 stones, including the last stone. Your friend wins.\n2. You remove 2 stones. Your friend removes 2 stones, including the last stone. Your friend wins.\n3. You remove 3 stones. Your friend removes the last stone. Your friend wins.\nIn all outcomes, your friend wins.\n
\n\n

Example 2:

\n\n
\nInput: n = 1\nOutput: true\n
\n\n

Example 3:

\n\n
\nInput: n = 2\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=4", + "--arg1=1", + "--arg1=2" + ], + "sample_test_results": [ + "false", + "true", + "true" + ], + "hidden_test_cases": [ + "--arg1=3", + "--arg1=5", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9", + "--arg1=10", + "--arg1=100", + "--arg1=1000000", + "--arg1=2147483647" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "false", + "true", + "true", + "false", + "false", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def canWinNim(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean canWinNim(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool canWinNim(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) ==\n std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" + }, + "explanation": "https://www.youtube.com/watch?v=ndR2buBWVc8&pp=ygURTmVldENvZGUgTmltIEdhbWU%3D", + "method_name": "canWinNim" }, { - "title": "Power of Three", - "source": "https://leetcode.com/problems/power-of-three/", - "description": "

Given an integer n, return true if it is a power of three. Otherwise, return false.

\n\n

An integer n is a power of three, if there exists an integer x such that n == 3x.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 27\nOutput: true\nExplanation: 27 = 33\n
\n\n

Example 2:

\n\n
\nInput: n = 0\nOutput: false\nExplanation: There is no x where 3x = 0.\n
\n\n

Example 3:

\n\n
\nInput: n = -1\nOutput: false\nExplanation: There is no x where 3x = (-1).\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=27", - "--arg1=0", - "--arg1=-1" - ], - "sample_test_results": [ - "True", - "False", - "False" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=9", - "--arg1=45", - "--arg1=81", - "--arg1=243", - "--arg1=-3", - "--arg1=2", - "--arg1=99", - "--arg1=19683", - "--arg1=-729" - ], - "hidden_test_results": [ - "True", - "True", - "False", - "True", - "True", - "False", - "False", - "False", - "True", - "False" - ], - "boilerplate": { - "python": "class Solution:\n def isPowerOfThree(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean isPowerOfThree(int n) {\n // Implementation here\n }\n}", - "cpp": "class Solution {\npublic:\n bool isPowerOfThree(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "std::string lowerCase(const std::string& str) {\n std::string lowerStr = str;\n std::transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(), ::tolower);\n return lowerStr;\n}\n\nreturn lowerCase(result) == lowerCase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=M2P2BAFmLlo&pp=ygUXTmVldENvZGUgUG93ZXIgb2YgVGhyZWU%3D" + "title": "Power of Three", + "source": "https://leetcode.com/problems/power-of-three/", + "description": "

Given an integer n, return true if it is a power of three. Otherwise, return false.

\n\n

An integer n is a power of three, if there exists an integer x such that n == 3x.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 27\nOutput: true\nExplanation: 27 = 33\n
\n\n

Example 2:

\n\n
\nInput: n = 0\nOutput: false\nExplanation: There is no x where 3x = 0.\n
\n\n

Example 3:

\n\n
\nInput: n = -1\nOutput: false\nExplanation: There is no x where 3x = (-1).\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=27", + "--arg1=0", + "--arg1=-1" + ], + "sample_test_results": [ + "true", + "false", + "false" + ], + "hidden_test_cases": [ + "--arg1=1", + "--arg1=9", + "--arg1=45", + "--arg1=81", + "--arg1=243", + "--arg1=-3", + "--arg1=2", + "--arg1=99", + "--arg1=19683", + "--arg1=-729" + ], + "hidden_test_results": [ + "true", + "true", + "false", + "true", + "true", + "false", + "false", + "false", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isPowerOfThree(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPowerOfThree(int n) {\n // Implementation here\n }\n}", + "cpp": "class Solution {\npublic:\n bool isPowerOfThree(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "std::string lowerCase(const std::string& str) {\n std::string lowerStr = str;\n std::transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(), ::tolower);\n return lowerStr;\n}\n\nreturn lowerCase(result) == lowerCase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=M2P2BAFmLlo&pp=ygUXTmVldENvZGUgUG93ZXIgb2YgVGhyZWU%3D", + "method_name": "isPowerOfThree" }, { - "title": "Power of Four", - "source": "https://leetcode.com/problems/power-of-four/", - "description": "

Given an integer n, return true if it is a power of four. Otherwise, return false.

\n\n

An integer n is a power of four, if there exists an integer x such that n == 4x.

\n\n

 

\n

Example 1:

\n
Input: n = 16\nOutput: true\n

Example 2:

\n
Input: n = 5\nOutput: false\n

Example 3:

\n
Input: n = 1\nOutput: true\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=16", - "--arg1=5", - "--arg1=1" - ], - "sample_test_results": [ - "True", - "False", - "True" - ], - "hidden_test_cases": [ - "--arg1=4", - "--arg1=64", - "--arg1=8", - "--arg1=256", - "--arg1=-4", - "--arg1=0", - "--arg1=2", - "--arg1=100", - "--arg1=1024", - "--arg1=-1024" - ], - "hidden_test_results": [ - "True", - "True", - "False", - "True", - "False", - "False", - "False", - "False", - "True", - "False" - ], - "boilerplate": { - "python": "class Solution:\n def isPowerOfFour(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean isPowerOfFour(int n) {\n\n }\n}", - "cpp": "class Solution {\npublic:\n bool isPowerOfFour(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return to_lowercopy(result) == to_lowercopy(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=qEYZPwnlM0U&pp=ygUWTmVldENvZGUgUG93ZXIgb2YgRm91cg%3D%3D" + "title": "Power of Four", + "source": "https://leetcode.com/problems/power-of-four/", + "description": "

Given an integer n, return true if it is a power of four. Otherwise, return false.

\n\n

An integer n is a power of four, if there exists an integer x such that n == 4x.

\n\n

 

\n

Example 1:

\n
Input: n = 16\nOutput: true\n

Example 2:

\n
Input: n = 5\nOutput: false\n

Example 3:

\n
Input: n = 1\nOutput: true\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=16", + "--arg1=5", + "--arg1=1" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=4", + "--arg1=64", + "--arg1=8", + "--arg1=256", + "--arg1=-4", + "--arg1=0", + "--arg1=2", + "--arg1=100", + "--arg1=1024", + "--arg1=-1024" + ], + "hidden_test_results": [ + "true", + "true", + "false", + "true", + "false", + "false", + "false", + "false", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isPowerOfFour(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPowerOfFour(int n) {\n\n }\n}", + "cpp": "class Solution {\npublic:\n bool isPowerOfFour(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return to_lowercopy(result) == to_lowercopy(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=qEYZPwnlM0U&pp=ygUWTmVldENvZGUgUG93ZXIgb2YgRm91cg%3D%3D", + "method_name": "isPowerOfFour" }, { - "title": "Reverse Vowels of a String", - "source": "https://leetcode.com/problems/reverse-vowels-of-a-string/", - "description": "

Given a string s, reverse only all the vowels in the string and return it.

\n\n

The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once.

\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "IceCreAm"

\n\n

Output: "AceCreIm"

\n\n

Explanation:

\n\n

The vowels in s are ['I', 'e', 'e', 'A']. On reversing the vowels, s becomes "AceCreIm".

\n
\n\n

Example 2:

\n\n
\n

Input: s = "leetcode"

\n\n

Output: "leotcede"

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 3 * 105
  • \n\t
  • s consist of printable ASCII characters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='IceCreAm'", - "--arg1='leetcode'" - ], - "sample_test_results": [ - "'AceCreIm'", - "'leotcede'" - ], - "hidden_test_cases": [ - "--arg1='hello'", - "--arg1='aA'", - "--arg1='race a car'", - "--arg1=''", - "--arg1='xyz'", - "--arg1='AEIOU'", - "--arg1='aeiou'", - "--arg1='. --arg2=!'", - "--arg1='Aa'", - "--arg1='LEetcOde'" - ], - "hidden_test_results": [ - "'holle'", - "'Aa'", - "'raca e car'", - "''", - "'xyz'", - "'UOIEA'", - "'uoiea'", - "'.,!'", - "'aA'", - "'LeOtcedE'" - ], - "boilerplate": { - "python": "class Solution:\n def reverseVowels(self, s: str) -> str:\n ", - "java": "class Solution {\n public String reverseVowels(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string reverseVowels(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=uHYjUMR3Tg8&pp=ygUjTmVldENvZGUgUmV2ZXJzZSBWb3dlbHMgb2YgYSBTdHJpbmc%3D" + "title": "Reverse Vowels of a String", + "source": "https://leetcode.com/problems/reverse-vowels-of-a-string/", + "description": "

Given a string s, reverse only all the vowels in the string and return it.

\n\n

The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once.

\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "IceCreAm"

\n\n

Output: "AceCreIm"

\n\n

Explanation:

\n\n

The vowels in s are ['I', 'e', 'e', 'A']. On reversing the vowels, s becomes "AceCreIm".

\n
\n\n

Example 2:

\n\n
\n

Input: s = "leetcode"

\n\n

Output: "leotcede"

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 3 * 105
  • \n\t
  • s consist of printable ASCII characters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='IceCreAm'", + "--arg1='leetcode'" + ], + "sample_test_results": [ + "'AceCreIm'", + "'leotcede'" + ], + "hidden_test_cases": [ + "--arg1='hello'", + "--arg1='aA'", + "--arg1='race a car'", + "--arg1=''", + "--arg1='xyz'", + "--arg1='AEIOU'", + "--arg1='aeiou'", + "--arg1='. --arg2=!'", + "--arg1='Aa'", + "--arg1='LEetcOde'" + ], + "hidden_test_results": [ + "'holle'", + "'Aa'", + "'raca e car'", + "''", + "'xyz'", + "'UOIEA'", + "'uoiea'", + "'.,!'", + "'aA'", + "'LeOtcedE'" + ], + "boilerplate": { + "python": "class Solution:\n def reverseVowels(self, s: str) -> str:\n ", + "java": "class Solution {\n public String reverseVowels(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string reverseVowels(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=uHYjUMR3Tg8&pp=ygUjTmVldENvZGUgUmV2ZXJzZSBWb3dlbHMgb2YgYSBTdHJpbmc%3D", + "method_name": "reverseVowels" }, { - "title": "Intersection of Two Arrays II", - "source": "https://leetcode.com/problems/intersection-of-two-arrays-ii/", - "description": "

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums1 = [1,2,2,1], nums2 = [2,2]\nOutput: [2,2]\n
\n\n

Example 2:

\n\n
\nInput: nums1 = [4,9,5], nums2 = [9,4,9,8,4]\nOutput: [4,9]\nExplanation: [9,4] is also accepted.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums1.length, nums2.length <= 1000
  • \n\t
  • 0 <= nums1[i], nums2[i] <= 1000
  • \n
\n\n

 

\n

Follow up:

\n\n
    \n\t
  • What if the given array is already sorted? How would you optimize your algorithm?
  • \n\t
  • What if nums1's size is small compared to nums2's size? Which algorithm is better?
  • \n\t
  • What if elements of nums2 are stored on disk, and the memory is limited such that you cannot load all elements into the memory at once?
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1,2,2,1 --arg2=[2 --arg3=2]", - "--arg1=4,9,5 --arg2=[9 --arg3=4 --arg4=9 --arg5=8 --arg6=4]" - ], - "sample_test_results": [ - "2, 2", - "9, 4" - ], - "hidden_test_cases": [ - "--arg1=1,1,1 --arg2=[1 --arg3=1]", - "--arg1=1,2 --arg2=[1 --arg3=1]", - "--arg1=1 --arg2=1", - "--arg1=1,2,3 --arg2=[4 --arg3=5 --arg4=6]", - "--arg1=1,2,3,4 --arg2=[1 --arg3=2 --arg4=3 --arg5=4]", - "--arg1=1,1,1,1 --arg2=1", - "--arg1= --arg2=1", - "--arg1=1,2,2,3 --arg2=[2 --arg3=2 --arg4=2 --arg5=3]", - "--arg1=1,2,3,4,5 --arg2=[5 --arg3=4 --arg4=3 --arg5=2 --arg6=1]", - "--arg1=1000,1000 --arg2=[1000 --arg3=1000]" - ], - "hidden_test_results": [ - "1, 1", - "1", - "1", - "", - "1, 2, 3, 4", - "1", - "", - "2, 2, 3", - "5, 4, 3, 2, 1", - "1000, 1000" - ], - "boilerplate": { - "python": "class Solution:\n def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List intersect(int[] nums1, int[] nums2) {\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector intersect(vector& nums1, vector& nums2) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "import java.util.Arrays;\n\nboolean compareFunction(Object result, String expected) {\n Object expectedList = eval(expected); // Assuming eval converts the expected\n return Arrays.equals(Arrays.sort(result), Arrays.sort(expectedList));\n}\n\n// Note: `eval` is a placeholder for your evaluation logic, as Java \n// doesn't provide a direct equivalent for Python's eval. You need \n// to implement conversion of 'expected' from String representation \n// to the required Object format.", - "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedSorted = eval(expected); // ensure eval yields vector of same type\nstd::sort(expectedSorted.begin(), expectedSorted.end());\nreturn result == expectedSorted;" - }, - "explanation": "https://www.youtube.com/watch?v=fwUTXaMom6U&pp=ygUmTmVldENvZGUgSW50ZXJzZWN0aW9uIG9mIFR3byBBcnJheXMgSUk%3D" + "title": "Intersection of Two Arrays II", + "source": "https://leetcode.com/problems/intersection-of-two-arrays-ii/", + "description": "

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums1 = [1,2,2,1], nums2 = [2,2]\nOutput: [2,2]\n
\n\n

Example 2:

\n\n
\nInput: nums1 = [4,9,5], nums2 = [9,4,9,8,4]\nOutput: [4,9]\nExplanation: [9,4] is also accepted.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums1.length, nums2.length <= 1000
  • \n\t
  • 0 <= nums1[i], nums2[i] <= 1000
  • \n
\n\n

 

\n

Follow up:

\n\n
    \n\t
  • What if the given array is already sorted? How would you optimize your algorithm?
  • \n\t
  • What if nums1's size is small compared to nums2's size? Which algorithm is better?
  • \n\t
  • What if elements of nums2 are stored on disk, and the memory is limited such that you cannot load all elements into the memory at once?
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,2,2,1] --arg2=[2,2]", + "--arg1=[4,9,5] --arg2=[9,4,9,8,4]" + ], + "sample_test_results": [ + "[2,2]", + "[9,4]" + ], + "hidden_test_cases": [ + "--arg1=[1,1,1] --arg2=[1,1]", + "--arg1=[1,2] --arg2=[1,1]", + "--arg1=[1] --arg2=[1]", + "--arg1=[1,2,3] --arg2=[4,5,6]", + "--arg1=[1,2,3,4] --arg2=[1,2,3,4]", + "--arg1=[1,1,1,1] --arg2=[1]", + "--arg1=[] --arg2=[1]", + "--arg1=[1,2,2,3] --arg2=[2,2,2,3]", + "--arg1=[1,2,3,4,5] --arg2=[5,4,3,2,1]", + "--arg1=[1000,1000] --arg2=[1000,1000]" + ], + "hidden_test_results": [ + "[1,1]", + "[1]", + "[1]", + "[]", + "[1,2,3,4]", + "[1]", + "[]", + "[2,2,3]", + "[5,4,3,2,1]", + "[1000,1000]" + ], + "boilerplate": { + "python": "class Solution:\n def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List intersect(int[] nums1, int[] nums2) {\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector intersect(vector& nums1, vector& nums2) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "import java.util.Arrays;\n\nboolean compareFunction(Object result, String expected) {\n Object expectedList = eval(expected); // Assuming eval converts the expected\n return Arrays.equals(Arrays.sort(result), Arrays.sort(expectedList));\n}\n\n// Note: `eval` is a placeholder for your evaluation logic, as Java \n// doesn't provide a direct equivalent for Python's eval. You need \n// to implement conversion of 'expected' from String representation \n// to the required Object format.", + "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedSorted = eval(expected); // ensure eval yields vector of same type\nstd::sort(expectedSorted.begin(), expectedSorted.end());\nreturn result == expectedSorted;" + }, + "explanation": "https://www.youtube.com/watch?v=fwUTXaMom6U&pp=ygUmTmVldENvZGUgSW50ZXJzZWN0aW9uIG9mIFR3byBBcnJheXMgSUk%3D", + "method_name": "intersect" }, { - "title": "Valid Perfect Square", - "source": "https://leetcode.com/problems/valid-perfect-square/", - "description": "

Given a positive integer num, return true if num is a perfect square or false otherwise.

\n\n

A perfect square is an integer that is the square of an integer. In other words, it is the product of some integer with itself.

\n\n

You must not use any built-in library function, such as sqrt.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = 16\nOutput: true\nExplanation: We return true because 4 * 4 = 16 and 4 is an integer.\n
\n\n

Example 2:

\n\n
\nInput: num = 14\nOutput: false\nExplanation: We return false because 3.742 * 3.742 = 14 and 3.742 is not an integer.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=16", - "--arg1=14", - "--arg1=1" - ], - "sample_test_results": [ - "True", - "False", - "True" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=4", - "--arg1=9", - "--arg1=25", - "--arg1=26", - "--arg1=100", - "--arg1=2147483647", - "--arg1=808201", - "--arg1=2", - "--arg1=3" - ], - "hidden_test_results": [ - "True", - "True", - "True", - "True", - "False", - "True", - "False", - "True", - "False", - "False" - ], - "boilerplate": { - "python": "class Solution:\n def isPerfectSquare(self, num: int) -> bool:\n ", - "java": "class Solution {\n public boolean isPerfectSquare(int num) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isPerfectSquare(int num) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=Cg_wWPHJ2Sk&pp=ygUdTmVldENvZGUgVmFsaWQgUGVyZmVjdCBTcXVhcmU%3D" + "title": "Valid Perfect Square", + "source": "https://leetcode.com/problems/valid-perfect-square/", + "description": "

Given a positive integer num, return true if num is a perfect square or false otherwise.

\n\n

A perfect square is an integer that is the square of an integer. In other words, it is the product of some integer with itself.

\n\n

You must not use any built-in library function, such as sqrt.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = 16\nOutput: true\nExplanation: We return true because 4 * 4 = 16 and 4 is an integer.\n
\n\n

Example 2:

\n\n
\nInput: num = 14\nOutput: false\nExplanation: We return false because 3.742 * 3.742 = 14 and 3.742 is not an integer.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=16", + "--arg1=14", + "--arg1=1" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=4", + "--arg1=9", + "--arg1=25", + "--arg1=26", + "--arg1=100", + "--arg1=2147483647", + "--arg1=808201", + "--arg1=2", + "--arg1=3" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "false", + "true", + "false", + "true", + "false", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isPerfectSquare(self, num: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPerfectSquare(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPerfectSquare(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Cg_wWPHJ2Sk&pp=ygUdTmVldENvZGUgVmFsaWQgUGVyZmVjdCBTcXVhcmU%3D", + "method_name": "isPerfectSquare" }, { - "title": "Find the Difference", - "source": "https://leetcode.com/problems/find-the-difference/", - "description": "

You are given two strings s and t.

\n\n

String t is generated by random shuffling string s and then add one more letter at a random position.

\n\n

Return the letter that was added to t.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abcd", t = "abcde"\nOutput: "e"\nExplanation: 'e' is the letter that was added.\n
\n\n

Example 2:

\n\n
\nInput: s = "", t = "y"\nOutput: "y"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s.length <= 1000
  • \n\t
  • t.length == s.length + 1
  • \n\t
  • s and t consist of lowercase English letters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='abcd' --arg2='abcde'", - "--arg1='' --arg2='y'", - "--arg1='ae' --arg2='aea'" - ], - "sample_test_results": [ - "'e'", - "'y'", - "'a'" - ], - "hidden_test_cases": [ - "--arg1='abcd' --arg2='abcde'", - "--arg1='' --arg2='y'", - "--arg1='a' --arg2='aa'", - "--arg1='ae' --arg2='aea'", - "--arg1='abc' --arg2='cabd'", - "--arg1='xyz' --arg2='xyzz'", - "--arg1='aaa' --arg2='aaaa'", - "--arg1='bb' --arg2='bbb'", - "--arg1='abcd' --arg2='dbcae'", - "--arg1='hello' --arg2='hollae'" - ], - "hidden_test_results": [ - "'e'", - "'y'", - "'a'", - "'a'", - "'d'", - "'z'", - "'a'", - "'b'", - "'e'", - "'a'" - ], - "boilerplate": { - "python": "class Solution:\n def findTheDifference(self, s: str, t: str) -> str:\n ", - "java": "class Solution {\n public char findTheDifference(String s, String t) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n char findTheDifference(string s, string t) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "Object evaluatedExpected = null;\ntry {\n evaluatedExpected = new ScriptEngineManager().getEngineByName(\"JavaScript\").eval(expected);\n} catch (Exception e) {\n return false;\n}\nreturn result.equals(evaluatedExpected);", - "cpp": "#include \n#include \n#include \n#include \n#include \n\nbool evaluateAndCompare(const std::string& result, const std::string& expected) {\n try {\n std::stringstream evaluationStream;\n evaluationStream << expected;\n double evaluatedExpected;\n evaluationStream >> evaluatedExpected;\n\n double resultValue;\n std::stringstream resultStream(result);\n resultStream >> resultValue;\n\n return resultValue == evaluatedExpected;\n } catch (const std::exception& e) {\n std::cerr << \"Error evaluating expression: \" << e.what() << std::endl;\n return false;\n }\n}" - }, - "explanation": "https://www.youtube.com/watch?v=a4wqKR-znBE&pp=ygUcTmVldENvZGUgRmluZCB0aGUgRGlmZmVyZW5jZQ%3D%3D" + "title": "Find the Difference", + "source": "https://leetcode.com/problems/find-the-difference/", + "description": "

You are given two strings s and t.

\n\n

String t is generated by random shuffling string s and then add one more letter at a random position.

\n\n

Return the letter that was added to t.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abcd", t = "abcde"\nOutput: "e"\nExplanation: 'e' is the letter that was added.\n
\n\n

Example 2:

\n\n
\nInput: s = "", t = "y"\nOutput: "y"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s.length <= 1000
  • \n\t
  • t.length == s.length + 1
  • \n\t
  • s and t consist of lowercase English letters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='abcd' --arg2='abcde'", + "--arg1='' --arg2='y'", + "--arg1='ae' --arg2='aea'" + ], + "sample_test_results": [ + "'e'", + "'y'", + "'a'" + ], + "hidden_test_cases": [ + "--arg1='abcd' --arg2='abcde'", + "--arg1='' --arg2='y'", + "--arg1='a' --arg2='aa'", + "--arg1='ae' --arg2='aea'", + "--arg1='abc' --arg2='cabd'", + "--arg1='xyz' --arg2='xyzz'", + "--arg1='aaa' --arg2='aaaa'", + "--arg1='bb' --arg2='bbb'", + "--arg1='abcd' --arg2='dbcae'", + "--arg1='hello' --arg2='hollae'" + ], + "hidden_test_results": [ + "'e'", + "'y'", + "'a'", + "'a'", + "'d'", + "'z'", + "'a'", + "'b'", + "'e'", + "'a'" + ], + "boilerplate": { + "python": "class Solution:\n def findTheDifference(self, s: str, t: str) -> str:\n ", + "java": "class Solution {\n public char findTheDifference(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n char findTheDifference(string s, string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "Object evaluatedExpected = null;\ntry {\n evaluatedExpected = new ScriptEngineManager().getEngineByName(\"JavaScript\").eval(expected);\n} catch (Exception e) {\n return false;\n}\nreturn result.equals(evaluatedExpected);", + "cpp": "#include \n#include \n#include \n#include \n#include \n\nbool evaluateAndCompare(const std::string& result, const std::string& expected) {\n try {\n std::stringstream evaluationStream;\n evaluationStream << expected;\n double evaluatedExpected;\n evaluationStream >> evaluatedExpected;\n\n double resultValue;\n std::stringstream resultStream(result);\n resultStream >> resultValue;\n\n return resultValue == evaluatedExpected;\n } catch (const std::exception& e) {\n std::cerr << \"Error evaluating expression: \" << e.what() << std::endl;\n return false;\n }\n}" + }, + "explanation": "https://www.youtube.com/watch?v=a4wqKR-znBE&pp=ygUcTmVldENvZGUgRmluZCB0aGUgRGlmZmVyZW5jZQ%3D%3D", + "method_name": "findTheDifference" }, { - "title": "Is Subsequence", - "source": "https://leetcode.com/problems/is-subsequence/", - "description": "

Given two strings s and t, return true if s is a subsequence of t, or false otherwise.

\n\n

A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not).

\n\n

 

\n

Example 1:

\n
Input: s = \"abc\", t = \"ahbgdc\"\nOutput: true\n

Example 2:

\n
Input: s = \"axc\", t = \"ahbgdc\"\nOutput: false\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s.length <= 100
  • \n\t
  • 0 <= t.length <= 104
  • \n\t
  • s and t consist only of lowercase English letters.
  • \n
\n\n

 

\nFollow up: Suppose there are lots of incoming s, say s1, s2, ..., sk where k >= 109, and you want to check one by one to see if t has its subsequence. In this scenario, how would you change your code?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='abc' --arg2='ahbgdc'", - "--arg1='axc' --arg2='ahbgdc'", - "--arg1='' --arg2='ahbgdc'" - ], - "sample_test_results": [ - "True", - "False", - "True" - ], - "hidden_test_cases": [ - "--arg1='abc' --arg2='ahbgdc'", - "--arg1='' --arg2=''", - "--arg1='abc' --arg2='abc'", - "--arg1='abc' --arg2='abcd'", - "--arg1='abc' --arg2='acb'", - "--arg1='ab' --arg2='baab'", - "--arg1='leetcode' --arg2='yleets'", - "--arg1='b' --arg2='abc'", - "--arg1='bb' --arg2='ahbgb'", - "--arg1='aaaaaa' --arg2='bbaaaa'" - ], - "hidden_test_results": [ - "True", - "True", - "True", - "True", - "False", - "True", - "False", - "True", - "True", - "False" - ], - "boilerplate": { - "python": "class Solution:\n def isSubsequence(self, s: str, t: str) -> bool:\n ", - "java": "class Solution {\n public boolean isSubsequence(String s, String t) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isSubsequence(string s, string t) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return toLowerCase(result) == toLowerCase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=99RVfqklbCE&pp=ygUXTmVldENvZGUgSXMgU3Vic2VxdWVuY2U%3D" + "title": "Is Subsequence", + "source": "https://leetcode.com/problems/is-subsequence/", + "description": "

Given two strings s and t, return true if s is a subsequence of t, or false otherwise.

\n\n

A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not).

\n\n

 

\n

Example 1:

\n
Input: s = \"abc\", t = \"ahbgdc\"\nOutput: true\n

Example 2:

\n
Input: s = \"axc\", t = \"ahbgdc\"\nOutput: false\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s.length <= 100
  • \n\t
  • 0 <= t.length <= 104
  • \n\t
  • s and t consist only of lowercase English letters.
  • \n
\n\n

 

\nFollow up: Suppose there are lots of incoming s, say s1, s2, ..., sk where k >= 109, and you want to check one by one to see if t has its subsequence. In this scenario, how would you change your code?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='abc' --arg2='ahbgdc'", + "--arg1='axc' --arg2='ahbgdc'", + "--arg1='' --arg2='ahbgdc'" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1='abc' --arg2='ahbgdc'", + "--arg1='' --arg2=''", + "--arg1='abc' --arg2='abc'", + "--arg1='abc' --arg2='abcd'", + "--arg1='abc' --arg2='acb'", + "--arg1='ab' --arg2='baab'", + "--arg1='leetcode' --arg2='yleets'", + "--arg1='b' --arg2='abc'", + "--arg1='bb' --arg2='ahbgb'", + "--arg1='aaaaaa' --arg2='bbaaaa'" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "false", + "true", + "false", + "true", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isSubsequence(self, s: str, t: str) -> bool:\n ", + "java": "class Solution {\n public boolean isSubsequence(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isSubsequence(string s, string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return toLowerCase(result) == toLowerCase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=99RVfqklbCE&pp=ygUXTmVldENvZGUgSXMgU3Vic2VxdWVuY2U%3D", + "method_name": "isSubsequence" }, { - "title": "Binary Watch", - "source": "https://leetcode.com/problems/binary-watch/", - "description": "

A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED represents a zero or one, with the least significant bit on the right.

\n\n
    \n\t
  • For example, the below binary watch reads "4:51".
  • \n
\n\n

\"\"

\n\n

Given an integer turnedOn which represents the number of LEDs that are currently on (ignoring the PM), return all possible times the watch could represent. You may return the answer in any order.

\n\n

The hour must not contain a leading zero.

\n\n
    \n\t
  • For example, "01:00" is not valid. It should be "1:00".
  • \n
\n\n

The minute must consist of two digits and may contain a leading zero.

\n\n
    \n\t
  • For example, "10:2" is not valid. It should be "10:02".
  • \n
\n\n

 

\n

Example 1:

\n
Input: turnedOn = 1\nOutput: [\"0:01\",\"0:02\",\"0:04\",\"0:08\",\"0:16\",\"0:32\",\"1:00\",\"2:00\",\"4:00\",\"8:00\"]\n

Example 2:

\n
Input: turnedOn = 9\nOutput: []\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= turnedOn <= 10
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1", - "--arg1=9", - "--arg1=2" - ], - "sample_test_results": [ - "'0:01', '0:02', '0:04', '0:08', '0:16', '0:32', '1:00', '2:00', '4:00', '8:00'", - "", - "'0:03', '0:05', '0:06', '0:09', '0:10', '0:12', '0:17', '0:18', '0:20', '0:24', '0:33', '0:34', '0:36', '0:40', '0:48', '1:01', '1:02', '1:04', '1:08', '1:16', '1:32', '2:01', '2:02', '2:04', '2:08', '2:16', '2:32', '3:00', '4:01', '4:02', '4:04', '4:08', '4:16', '4:32', '5:00', '6:00', '8:01', '8:02', '8:04', '8:08', '8:16', '8:32', '9:00', '10:00'" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=1", - "--arg1=2", - "--arg1=3", - "--arg1=4", - "--arg1=5", - "--arg1=6", - "--arg1=7", - "--arg1=8", - "--arg1=9" - ], - "hidden_test_results": [ - "'0:00'", - "'0:01', '0:02', '0:04', '0:08', '0:16', '0:32', '1:00', '2:00', '4:00', '8:00'", - "'0:03', '0:05', '0:06', '0:09', '0:10', '0:12', '0:17', '0:18', '0:20', '0:24', '0:33', '0:34', '0:36', '0:40', '0:48', '1:01', '1:02', '1:04', '1:08', '1:16', '1:32', '2:01', '2:02', '2:04', '2:08', '2:16', '2:32', '3:00', '4:01', '4:02', '4:04', '4:08', '4:16', '4:32', '5:00', '6:00', '8:01', '8:02', '8:04', '8:08', '8:16', '8:32', '9:00', '10:00'", - "'0:07', '0:11', '0:13', '0:14', '0:19', '0:21', '0:22', '0:25', '0:26', '0:28', '0:35', '0:37', '0:38', '0:41', '0:42', '0:44', '0:49', '0:50', '0:52', '0:56', '1:03', '1:05', '1:06', '1:09', '1:10', '1:12', '1:17', '1:18', '1:20', '1:24', '1:33', '1:34', '1:36', '1:40', '1:48', '2:03', '2:05', '2:06', '2:09', '2:10', '2:12', '2:17', '2:18', '2:20', '2:24', '2:33', '2:34', '2:36', '2:40', '2:48', '3:01', '3:02', '3:04', '3:08', '3:16', '3:32', '4:03', '4:05', '4:06', '4:09', '4:10', '4:12', '4:17', '4:18', '4:20', '4:24', '4:33', '4:34', '4:36', '4:40', '4:48', '5:01', '5:02', '5:04', '5:08', '5:16', '5:32', '6:01', '6:02', '6:04', '6:08', '6:16', '6:32', '7:00', '8:03', '8:05', '8:06', '8:09', '8:10', '8:12', '8:17', '8:18', '8:20', '8:24', '8:33', '8:34', '8:36', '8:40', '8:48', '9:01', '9:02', '9:04', '9:08', '9:16', '9:32', '10:01', '10:02', '10:04', '10:08', '10:16', '10:32', '11:00'", - "'0:15', '0:23', '0:27', '0:29', '0:30', '0:39', '0:43', '0:45', '0:46', '0:51', '0:53', '0:54', '0:57', '0:58', '1:07', '1:11', '1:13', '1:14', '1:19', '1:21', '1:22', '1:25', '1:26', '1:28', '1:35', '1:37', '1:38', '1:41', '1:42', '1:44', '1:49', '1:50', '1:52', '1:56', '2:07', '2:11', '2:13', '2:14', '2:19', '2:21', '2:22', '2:25', '2:26', '2:28', '2:35', '2:37', '2:38', '2:41', '2:42', '2:44', '2:49', '2:50', '2:52', '2:56', '3:03', '3:05', '3:06', '3:09', '3:10', '3:12', '3:17', '3:18', '3:20', '3:24', '3:33', '3:34', '3:36', '3:40', '3:48', '4:07', '4:11', '4:13', '4:14', '4:19', '4:21', '4:22', '4:25', '4:26', '4:28', '4:35', '4:37', '4:38', '4:41', '4:42', '4:44', '4:49', '4:50', '4:52', '4:56', '5:03', '5:05', '5:06', '5:09', '5:10', '5:12', '5:17', '5:18', '5:20', '5:24', '5:33', '5:34', '5:36', '5:40', '5:48', '6:03', '6:05', '6:06', '6:09', '6:10', '6:12', '6:17', '6:18', '6:20', '6:24', '6:33', '6:34', '6:36', '6:40', '6:48', '7:01', '7:02', '7:04', '7:08', '7:16', '7:32', '8:07', '8:11', '8:13', '8:14', '8:19', '8:21', '8:22', '8:25', '8:26', '8:28', '8:35', '8:37', '8:38', '8:41', '8:42', '8:44', '8:49', '8:50', '8:52', '8:56', '9:03', '9:05', '9:06', '9:09', '9:10', '9:12', '9:17', '9:18', '9:20', '9:24', '9:33', '9:34', '9:36', '9:40', '9:48', '10:03', '10:05', '10:06', '10:09', '10:10', '10:12', '10:17', '10:18', '10:20', '10:24', '10:33', '10:34', '10:36', '10:40', '10:48', '11:01', '11:02', '11:04', '11:08', '11:16', '11:32'", - "'0:31', '0:47', '0:55', '0:59', '1:15', '1:23', '1:27', '1:29', '1:30', '1:39', '1:43', '1:45', '1:46', '1:51', '1:53', '1:54', '1:57', '1:58', '2:15', '2:23', '2:27', '2:29', '2:30', '2:39', '2:43', '2:45', '2:46', '2:51', '2:53', '2:54', '2:57', '2:58', '3:07', '3:11', '3:13', '3:14', '3:19', '3:21', '3:22', '3:25', '3:26', '3:28', '3:35', '3:37', '3:38', '3:41', '3:42', '3:44', '3:49', '3:50', '3:52', '3:56', '4:15', '4:23', '4:27', '4:29', '4:30', '4:39', '4:43', '4:45', '4:46', '4:51', '4:53', '4:54', '4:57', '4:58', '5:07', '5:11', '5:13', '5:14', '5:19', '5:21', '5:22', '5:25', '5:26', '5:28', '5:35', '5:37', '5:38', '5:41', '5:42', '5:44', '5:49', '5:50', '5:52', '5:56', '6:07', '6:11', '6:13', '6:14', '6:19', '6:21', '6:22', '6:25', '6:26', '6:28', '6:35', '6:37', '6:38', '6:41', '6:42', '6:44', '6:49', '6:50', '6:52', '6:56', '7:03', '7:05', '7:06', '7:09', '7:10', '7:12', '7:17', '7:18', '7:20', '7:24', '7:33', '7:34', '7:36', '7:40', '7:48', '8:15', '8:23', '8:27', '8:29', '8:30', '8:39', '8:43', '8:45', '8:46', '8:51', '8:53', '8:54', '8:57', '8:58', '9:07', '9:11', '9:13', '9:14', '9:19', '9:21', '9:22', '9:25', '9:26', '9:28', '9:35', '9:37', '9:38', '9:41', '9:42', '9:44', '9:49', '9:50', '9:52', '9:56', '10:07', '10:11', '10:13', '10:14', '10:19', '10:21', '10:22', '10:25', '10:26', '10:28', '10:35', '10:37', '10:38', '10:41', '10:42', '10:44', '10:49', '10:50', '10:52', '10:56', '11:03', '11:05', '11:06', '11:09', '11:10', '11:12', '11:17', '11:18', '11:20', '11:24', '11:33', '11:34', '11:36', '11:40', '11:48'", - "'1:31', '1:47', '1:55', '1:59', '2:31', '2:47', '2:55', '2:59', '3:15', '3:23', '3:27', '3:29', '3:30', '3:39', '3:43', '3:45', '3:46', '3:51', '3:53', '3:54', '3:57', '3:58', '4:31', '4:47', '4:55', '4:59', '5:15', '5:23', '5:27', '5:29', '5:30', '5:39', '5:43', '5:45', '5:46', '5:51', '5:53', '5:54', '5:57', '5:58', '6:15', '6:23', '6:27', '6:29', '6:30', '6:39', '6:43', '6:45', '6:46', '6:51', '6:53', '6:54', '6:57', '6:58', '7:07', '7:11', '7:13', '7:14', '7:19', '7:21', '7:22', '7:25', '7:26', '7:28', '7:35', '7:37', '7:38', '7:41', '7:42', '7:44', '7:49', '7:50', '7:52', '7:56', '8:31', '8:47', '8:55', '8:59', '9:15', '9:23', '9:27', '9:29', '9:30', '9:39', '9:43', '9:45', '9:46', '9:51', '9:53', '9:54', '9:57', '9:58', '10:15', '10:23', '10:27', '10:29', '10:30', '10:39', '10:43', '10:45', '10:46', '10:51', '10:53', '10:54', '10:57', '10:58', '11:07', '11:11', '11:13', '11:14', '11:19', '11:21', '11:22', '11:25', '11:26', '11:28', '11:35', '11:37', '11:38', '11:41', '11:42', '11:44', '11:49', '11:50', '11:52', '11:56'", - "'3:31', '3:47', '3:55', '3:59', '5:31', '5:47', '5:55', '5:59', '6:31', '6:47', '6:55', '6:59', '7:15', '7:23', '7:27', '7:29', '7:30', '7:39', '7:43', '7:45', '7:46', '7:51', '7:53', '7:54', '7:57', '7:58', '9:31', '9:47', '9:55', '9:59', '10:31', '10:47', '10:55', '10:59', '11:15', '11:23', '11:27', '11:29', '11:30', '11:39', '11:43', '11:45', '11:46', '11:51', '11:53', '11:54', '11:57', '11:58'", - "'7:31', '7:47', '7:55', '7:59', '11:31', '11:47', '11:55', '11:59'", - "" - ], - "boilerplate": { - "python": "class Solution:\n def readBinaryWatch(self, turnedOn: int) -> List[str]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List readBinaryWatch(int turnedOn) {\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector readBinaryWatch(int turnedOn) {\n \n }\n};" - }, - "compare_func": { - "python": "def sorted_list_strings(lst):\n return sorted([str(x) for x in eval(lst)])\n return sorted(result) == sorted_list_strings(expected)", - "java": "boolean compareFunction(String result, String expected) {\n String[] expectedList = evalStrings(expected);\n String[] resultList = evalStrings(result);\n \n Arrays.sort(expectedList);\n Arrays.sort(resultList);\n \n return Arrays.equals(resultList, expectedList);\n}\n\nString[] evalStrings(String input) {\n String parsed = input.replaceAll(\"[\\[\\]\\\"]\", \"\");\n return parsed.split(\", ?\");\n}", - "cpp": "std::vector sortedListStrings(const std::string &lst) {\n // Assuming the input is a properly formatted string representation of a list\n std::stringstream ss(lst);\n std::string token;\n std::vector result; \n \n while(std::getline(ss, token, ',')) {\n // Remove potential leading/trailing spaces and quotes\n token.erase(std::remove_if(token.begin(), token.end(), ::isspace), token.end());\n token.erase(std::remove(token.begin(), token.end(), '\"'), token.end());\n token.erase(std::remove(token.begin(), token.end(), '\\\n'), token.end());\n result.push_back(token);\n }\n \n std::sort(result.begin(), result.end());\n return result;\n}\n\nstd::vector sortedList(const std::vector &lst) {\n std::vector result = lst;\n std::sort(result.begin(), result.end());\n return result;\n}\n\nbool compareFunction(const std::vector &result, const std::string &expected) {\n return sortedList(result) == sortedListStrings(expected);\n}" - }, - "explanation": "https://www.youtube.com/watch?v=0BanwDe6cMY&pp=ygUVTmVldENvZGUgQmluYXJ5IFdhdGNo" + "title": "Binary Watch", + "source": "https://leetcode.com/problems/binary-watch/", + "description": "

A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED represents a zero or one, with the least significant bit on the right.

\n\n
    \n\t
  • For example, the below binary watch reads "4:51".
  • \n
\n\n

\"\"

\n\n

Given an integer turnedOn which represents the number of LEDs that are currently on (ignoring the PM), return all possible times the watch could represent. You may return the answer in any order.

\n\n

The hour must not contain a leading zero.

\n\n
    \n\t
  • For example, "01:00" is not valid. It should be "1:00".
  • \n
\n\n

The minute must consist of two digits and may contain a leading zero.

\n\n
    \n\t
  • For example, "10:2" is not valid. It should be "10:02".
  • \n
\n\n

 

\n

Example 1:

\n
Input: turnedOn = 1\nOutput: [\"0:01\",\"0:02\",\"0:04\",\"0:08\",\"0:16\",\"0:32\",\"1:00\",\"2:00\",\"4:00\",\"8:00\"]\n

Example 2:

\n
Input: turnedOn = 9\nOutput: []\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= turnedOn <= 10
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=1", + "--arg1=9", + "--arg1=2" + ], + "sample_test_results": [ + "['0:01','0:02','0:04','0:08','0:16','0:32','1:00','2:00','4:00','8:00']", + "[]", + "['0:03','0:05','0:06','0:09','0:10','0:12','0:17','0:18','0:20','0:24','0:33','0:34','0:36','0:40','0:48','1:01','1:02','1:04','1:08','1:16','1:32','2:01','2:02','2:04','2:08','2:16','2:32','3:00','4:01','4:02','4:04','4:08','4:16','4:32','5:00','6:00','8:01','8:02','8:04','8:08','8:16','8:32','9:00','10:00']" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=1", + "--arg1=2", + "--arg1=3", + "--arg1=4", + "--arg1=5", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9" + ], + "hidden_test_results": [ + "['0:00']", + "['0:01','0:02','0:04','0:08','0:16','0:32','1:00','2:00','4:00','8:00']", + "['0:03','0:05','0:06','0:09','0:10','0:12','0:17','0:18','0:20','0:24','0:33','0:34','0:36','0:40','0:48','1:01','1:02','1:04','1:08','1:16','1:32','2:01','2:02','2:04','2:08','2:16','2:32','3:00','4:01','4:02','4:04','4:08','4:16','4:32','5:00','6:00','8:01','8:02','8:04','8:08','8:16','8:32','9:00','10:00']", + "['0:07','0:11','0:13','0:14','0:19','0:21','0:22','0:25','0:26','0:28','0:35','0:37','0:38','0:41','0:42','0:44','0:49','0:50','0:52','0:56','1:03','1:05','1:06','1:09','1:10','1:12','1:17','1:18','1:20','1:24','1:33','1:34','1:36','1:40','1:48','2:03','2:05','2:06','2:09','2:10','2:12','2:17','2:18','2:20','2:24','2:33','2:34','2:36','2:40','2:48','3:01','3:02','3:04','3:08','3:16','3:32','4:03','4:05','4:06','4:09','4:10','4:12','4:17','4:18','4:20','4:24','4:33','4:34','4:36','4:40','4:48','5:01','5:02','5:04','5:08','5:16','5:32','6:01','6:02','6:04','6:08','6:16','6:32','7:00','8:03','8:05','8:06','8:09','8:10','8:12','8:17','8:18','8:20','8:24','8:33','8:34','8:36','8:40','8:48','9:01','9:02','9:04','9:08','9:16','9:32','10:01','10:02','10:04','10:08','10:16','10:32','11:00']", + "['0:15','0:23','0:27','0:29','0:30','0:39','0:43','0:45','0:46','0:51','0:53','0:54','0:57','0:58','1:07','1:11','1:13','1:14','1:19','1:21','1:22','1:25','1:26','1:28','1:35','1:37','1:38','1:41','1:42','1:44','1:49','1:50','1:52','1:56','2:07','2:11','2:13','2:14','2:19','2:21','2:22','2:25','2:26','2:28','2:35','2:37','2:38','2:41','2:42','2:44','2:49','2:50','2:52','2:56','3:03','3:05','3:06','3:09','3:10','3:12','3:17','3:18','3:20','3:24','3:33','3:34','3:36','3:40','3:48','4:07','4:11','4:13','4:14','4:19','4:21','4:22','4:25','4:26','4:28','4:35','4:37','4:38','4:41','4:42','4:44','4:49','4:50','4:52','4:56','5:03','5:05','5:06','5:09','5:10','5:12','5:17','5:18','5:20','5:24','5:33','5:34','5:36','5:40','5:48','6:03','6:05','6:06','6:09','6:10','6:12','6:17','6:18','6:20','6:24','6:33','6:34','6:36','6:40','6:48','7:01','7:02','7:04','7:08','7:16','7:32','8:07','8:11','8:13','8:14','8:19','8:21','8:22','8:25','8:26','8:28','8:35','8:37','8:38','8:41','8:42','8:44','8:49','8:50','8:52','8:56','9:03','9:05','9:06','9:09','9:10','9:12','9:17','9:18','9:20','9:24','9:33','9:34','9:36','9:40','9:48','10:03','10:05','10:06','10:09','10:10','10:12','10:17','10:18','10:20','10:24','10:33','10:34','10:36','10:40','10:48','11:01','11:02','11:04','11:08','11:16','11:32']", + "['0:31','0:47','0:55','0:59','1:15','1:23','1:27','1:29','1:30','1:39','1:43','1:45','1:46','1:51','1:53','1:54','1:57','1:58','2:15','2:23','2:27','2:29','2:30','2:39','2:43','2:45','2:46','2:51','2:53','2:54','2:57','2:58','3:07','3:11','3:13','3:14','3:19','3:21','3:22','3:25','3:26','3:28','3:35','3:37','3:38','3:41','3:42','3:44','3:49','3:50','3:52','3:56','4:15','4:23','4:27','4:29','4:30','4:39','4:43','4:45','4:46','4:51','4:53','4:54','4:57','4:58','5:07','5:11','5:13','5:14','5:19','5:21','5:22','5:25','5:26','5:28','5:35','5:37','5:38','5:41','5:42','5:44','5:49','5:50','5:52','5:56','6:07','6:11','6:13','6:14','6:19','6:21','6:22','6:25','6:26','6:28','6:35','6:37','6:38','6:41','6:42','6:44','6:49','6:50','6:52','6:56','7:03','7:05','7:06','7:09','7:10','7:12','7:17','7:18','7:20','7:24','7:33','7:34','7:36','7:40','7:48','8:15','8:23','8:27','8:29','8:30','8:39','8:43','8:45','8:46','8:51','8:53','8:54','8:57','8:58','9:07','9:11','9:13','9:14','9:19','9:21','9:22','9:25','9:26','9:28','9:35','9:37','9:38','9:41','9:42','9:44','9:49','9:50','9:52','9:56','10:07','10:11','10:13','10:14','10:19','10:21','10:22','10:25','10:26','10:28','10:35','10:37','10:38','10:41','10:42','10:44','10:49','10:50','10:52','10:56','11:03','11:05','11:06','11:09','11:10','11:12','11:17','11:18','11:20','11:24','11:33','11:34','11:36','11:40','11:48']", + "['1:31','1:47','1:55','1:59','2:31','2:47','2:55','2:59','3:15','3:23','3:27','3:29','3:30','3:39','3:43','3:45','3:46','3:51','3:53','3:54','3:57','3:58','4:31','4:47','4:55','4:59','5:15','5:23','5:27','5:29','5:30','5:39','5:43','5:45','5:46','5:51','5:53','5:54','5:57','5:58','6:15','6:23','6:27','6:29','6:30','6:39','6:43','6:45','6:46','6:51','6:53','6:54','6:57','6:58','7:07','7:11','7:13','7:14','7:19','7:21','7:22','7:25','7:26','7:28','7:35','7:37','7:38','7:41','7:42','7:44','7:49','7:50','7:52','7:56','8:31','8:47','8:55','8:59','9:15','9:23','9:27','9:29','9:30','9:39','9:43','9:45','9:46','9:51','9:53','9:54','9:57','9:58','10:15','10:23','10:27','10:29','10:30','10:39','10:43','10:45','10:46','10:51','10:53','10:54','10:57','10:58','11:07','11:11','11:13','11:14','11:19','11:21','11:22','11:25','11:26','11:28','11:35','11:37','11:38','11:41','11:42','11:44','11:49','11:50','11:52','11:56']", + "['3:31','3:47','3:55','3:59','5:31','5:47','5:55','5:59','6:31','6:47','6:55','6:59','7:15','7:23','7:27','7:29','7:30','7:39','7:43','7:45','7:46','7:51','7:53','7:54','7:57','7:58','9:31','9:47','9:55','9:59','10:31','10:47','10:55','10:59','11:15','11:23','11:27','11:29','11:30','11:39','11:43','11:45','11:46','11:51','11:53','11:54','11:57','11:58']", + "['7:31','7:47','7:55','7:59','11:31','11:47','11:55','11:59']", + "[]" + ], + "boilerplate": { + "python": "class Solution:\n def readBinaryWatch(self, turnedOn: int) -> List[str]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List readBinaryWatch(int turnedOn) {\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector readBinaryWatch(int turnedOn) {\n \n }\n};" + }, + "compare_func": { + "python": "def sorted_list_strings(lst):\n return sorted([str(x) for x in eval(lst)])\n return sorted(result) == sorted_list_strings(expected)", + "java": "boolean compareFunction(String result, String expected) {\n String[] expectedList = evalStrings(expected);\n String[] resultList = evalStrings(result);\n \n Arrays.sort(expectedList);\n Arrays.sort(resultList);\n \n return Arrays.equals(resultList, expectedList);\n}\n\nString[] evalStrings(String input) {\n String parsed = input.replaceAll(\"[\\[\\]\\\"]\", \"\");\n return parsed.split(\", ?\");\n}", + "cpp": "std::vector sortedListStrings(const std::string &lst) {\n // Assuming the input is a properly formatted string representation of a list\n std::stringstream ss(lst);\n std::string token;\n std::vector result; \n \n while(std::getline(ss, token, ',')) {\n // Remove potential leading/trailing spaces and quotes\n token.erase(std::remove_if(token.begin(), token.end(), ::isspace), token.end());\n token.erase(std::remove(token.begin(), token.end(), '\"'), token.end());\n token.erase(std::remove(token.begin(), token.end(), '\\\n'), token.end());\n result.push_back(token);\n }\n \n std::sort(result.begin(), result.end());\n return result;\n}\n\nstd::vector sortedList(const std::vector &lst) {\n std::vector result = lst;\n std::sort(result.begin(), result.end());\n return result;\n}\n\nbool compareFunction(const std::vector &result, const std::string &expected) {\n return sortedList(result) == sortedListStrings(expected);\n}" + }, + "explanation": "https://www.youtube.com/watch?v=0BanwDe6cMY&pp=ygUVTmVldENvZGUgQmluYXJ5IFdhdGNo", + "method_name": "readBinaryWatch" }, { - "title": "Convert a Number to Hexadecimal", - "source": "https://leetcode.com/problems/convert-a-number-to-hexadecimal/", - "description": "

Given a 32-bit integer num, return a string representing its hexadecimal representation. For negative integers, two’s complement method is used.

\n\n

All the letters in the answer string should be lowercase characters, and there should not be any leading zeros in the answer except for the zero itself.

\n\n

Note: You are not allowed to use any built-in library method to directly solve this problem.

\n\n

 

\n

Example 1:

\n
Input: num = 26\nOutput: \"1a\"\n

Example 2:

\n
Input: num = -1\nOutput: \"ffffffff\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= num <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=26", - "--arg1=-1", - "--arg1=0" - ], - "sample_test_results": [ - "'1a'", - "'ffffffff'", - "'0'" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=16", - "--arg1=26", - "--arg1=-1", - "--arg1=2147483647", - "--arg1=-2147483648", - "--arg1=100", - "--arg1=-100", - "--arg1=255", - "--arg1=-255" - ], - "hidden_test_results": [ - "'0'", - "'10'", - "'1a'", - "'ffffffff'", - "'7fffffff'", - "'80000000'", - "'64'", - "'ffffff9c'", - "'ff'", - "'ffffff01'" - ], - "boilerplate": { - "python": "class Solution:\n def toHex(self, num: int) -> str:\n ", - "java": "class Solution {\n public String toHex(int num) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string toHex(int num) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "try {\n return result == std::stod(expected);\n} catch (const std::invalid_argument& e) {\n return false;\n}\ncatch (const std::out_of_range& e) {\n return false;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=I1HBykyZvbc&pp=ygUoTmVldENvZGUgQ29udmVydCBhIE51bWJlciB0byBIZXhhZGVjaW1hbA%3D%3D" + "title": "Convert a Number to Hexadecimal", + "source": "https://leetcode.com/problems/convert-a-number-to-hexadecimal/", + "description": "

Given a 32-bit integer num, return a string representing its hexadecimal representation. For negative integers, two’s complement method is used.

\n\n

All the letters in the answer string should be lowercase characters, and there should not be any leading zeros in the answer except for the zero itself.

\n\n

Note: You are not allowed to use any built-in library method to directly solve this problem.

\n\n

 

\n

Example 1:

\n
Input: num = 26\nOutput: \"1a\"\n

Example 2:

\n
Input: num = -1\nOutput: \"ffffffff\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= num <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=26", + "--arg1=-1", + "--arg1=0" + ], + "sample_test_results": [ + "'1a'", + "'ffffffff'", + "'0'" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=16", + "--arg1=26", + "--arg1=-1", + "--arg1=2147483647", + "--arg1=-2147483648", + "--arg1=100", + "--arg1=-100", + "--arg1=255", + "--arg1=-255" + ], + "hidden_test_results": [ + "'0'", + "'10'", + "'1a'", + "'ffffffff'", + "'7fffffff'", + "'80000000'", + "'64'", + "'ffffff9c'", + "'ff'", + "'ffffff01'" + ], + "boilerplate": { + "python": "class Solution:\n def toHex(self, num: int) -> str:\n ", + "java": "class Solution {\n public String toHex(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string toHex(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "try {\n return result == std::stod(expected);\n} catch (const std::invalid_argument& e) {\n return false;\n}\ncatch (const std::out_of_range& e) {\n return false;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=I1HBykyZvbc&pp=ygUoTmVldENvZGUgQ29udmVydCBhIE51bWJlciB0byBIZXhhZGVjaW1hbA%3D%3D", + "method_name": "toHex" }, { - "title": "Longest Palindrome", - "source": "https://leetcode.com/problems/longest-palindrome/", - "description": "

Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.

\n\n

Letters are case sensitive, for example, "Aa" is not considered a palindrome.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abccccdd"\nOutput: 7\nExplanation: One longest palindrome that can be built is "dccaccd", whose length is 7.\n
\n\n

Example 2:

\n\n
\nInput: s = "a"\nOutput: 1\nExplanation: The longest palindrome that can be built is "a", whose length is 1.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 2000
  • \n\t
  • s consists of lowercase and/or uppercase English letters only.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='abccccdd'", - "--arg1='a'", - "--arg1='Aa'" - ], - "sample_test_results": [ - "7", - "1", - "1" - ], - "hidden_test_cases": [ - "--arg1='racecar'", - "--arg1='aaaaaa'", - "--arg1='abcde'", - "--arg1='AAaa'", - "--arg1='aA'", - "--arg1='z'", - "--arg1='abccba'", - "--arg1='aaabbbcccc'", - "--arg1='abcABC'", - "--arg1=''" - ], - "hidden_test_results": [ - "7", - "6", - "1", - "4", - "1", - "1", - "6", - "9", - "1", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def longestPalindrome(self, s: str) -> int:\n ", - "java": "class Solution {\n public int longestPalindrome(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int longestPalindrome(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=_g9jrLuAphs&pp=ygUbTmVldENvZGUgTG9uZ2VzdCBQYWxpbmRyb21l" + "title": "Longest Palindrome", + "source": "https://leetcode.com/problems/longest-palindrome/", + "description": "

Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.

\n\n

Letters are case sensitive, for example, "Aa" is not considered a palindrome.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abccccdd"\nOutput: 7\nExplanation: One longest palindrome that can be built is "dccaccd", whose length is 7.\n
\n\n

Example 2:

\n\n
\nInput: s = "a"\nOutput: 1\nExplanation: The longest palindrome that can be built is "a", whose length is 1.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 2000
  • \n\t
  • s consists of lowercase and/or uppercase English letters only.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='abccccdd'", + "--arg1='a'", + "--arg1='Aa'" + ], + "sample_test_results": [ + "7", + "1", + "1" + ], + "hidden_test_cases": [ + "--arg1='racecar'", + "--arg1='aaaaaa'", + "--arg1='abcde'", + "--arg1='AAaa'", + "--arg1='aA'", + "--arg1='z'", + "--arg1='abccba'", + "--arg1='aaabbbcccc'", + "--arg1='abcABC'", + "--arg1=''" + ], + "hidden_test_results": [ + "7", + "6", + "1", + "4", + "1", + "1", + "6", + "9", + "1", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def longestPalindrome(self, s: str) -> int:\n ", + "java": "class Solution {\n public int longestPalindrome(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int longestPalindrome(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=_g9jrLuAphs&pp=ygUbTmVldENvZGUgTG9uZ2VzdCBQYWxpbmRyb21l", + "method_name": "longestPalindrome" }, { - "title": "Add Strings", - "source": "https://leetcode.com/problems/add-strings/", - "description": "

Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string.

\n\n

You must solve the problem without using any built-in library for handling large integers (such as BigInteger). You must also not convert the inputs to integers directly.

\n\n

 

\n

Example 1:

\n\n
\nInput: num1 = "11", num2 = "123"\nOutput: "134"\n
\n\n

Example 2:

\n\n
\nInput: num1 = "456", num2 = "77"\nOutput: "533"\n
\n\n

Example 3:

\n\n
\nInput: num1 = "0", num2 = "0"\nOutput: "0"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num1.length, num2.length <= 104
  • \n\t
  • num1 and num2 consist of only digits.
  • \n\t
  • num1 and num2 don't have any leading zeros except for the zero itself.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='11' --arg2='123'", - "--arg1='456' --arg2='77'", - "--arg1='0' --arg2='0'" - ], - "sample_test_results": [ - "'134'", - "'533'", - "'0'" - ], - "hidden_test_cases": [ - "--arg1='9' --arg2='1'", - "--arg1='999' --arg2='1'", - "--arg1='1' --arg2='999'", - "--arg1='0' --arg2='1'", - "--arg1='1' --arg2='0'", - "--arg1='999999' --arg2='1'", - "--arg1='123' --arg2='456'", - "--arg1='1000' --arg2='2000'", - "--arg1='9999' --arg2='9999'", - "--arg1='1111' --arg2='9999'" - ], - "hidden_test_results": [ - "'10'", - "'1000'", - "'1000'", - "'1'", - "'1'", - "'1000000'", - "'579'", - "'3000'", - "'19998'", - "'11110'" - ], - "boilerplate": { - "python": "class Solution:\n def addStrings(self, num1: str, num2: str) -> str:\n ", - "java": "class Solution {\n public String addStrings(String num1, String num2) {\n // Implementation will go here\n return null;\n }\n}", - "cpp": "class Solution {\npublic:\n string addStrings(string num1, string num2) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == eval(expected)", - "java": "return result.toString().equals(String.valueOf(eval(expected)));", - "cpp": "#include \n\ncompareFunction(const std::string &result, const std::string &expected) {\n return result == expected;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=jziDtPZJ4fw&pp=ygUUTmVldENvZGUgQWRkIFN0cmluZ3M%3D" + "title": "Add Strings", + "source": "https://leetcode.com/problems/add-strings/", + "description": "

Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string.

\n\n

You must solve the problem without using any built-in library for handling large integers (such as BigInteger). You must also not convert the inputs to integers directly.

\n\n

 

\n

Example 1:

\n\n
\nInput: num1 = "11", num2 = "123"\nOutput: "134"\n
\n\n

Example 2:

\n\n
\nInput: num1 = "456", num2 = "77"\nOutput: "533"\n
\n\n

Example 3:

\n\n
\nInput: num1 = "0", num2 = "0"\nOutput: "0"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num1.length, num2.length <= 104
  • \n\t
  • num1 and num2 consist of only digits.
  • \n\t
  • num1 and num2 don't have any leading zeros except for the zero itself.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='11' --arg2='123'", + "--arg1='456' --arg2='77'", + "--arg1='0' --arg2='0'" + ], + "sample_test_results": [ + "'134'", + "'533'", + "'0'" + ], + "hidden_test_cases": [ + "--arg1='9' --arg2='1'", + "--arg1='999' --arg2='1'", + "--arg1='1' --arg2='999'", + "--arg1='0' --arg2='1'", + "--arg1='1' --arg2='0'", + "--arg1='999999' --arg2='1'", + "--arg1='123' --arg2='456'", + "--arg1='1000' --arg2='2000'", + "--arg1='9999' --arg2='9999'", + "--arg1='1111' --arg2='9999'" + ], + "hidden_test_results": [ + "'10'", + "'1000'", + "'1000'", + "'1'", + "'1'", + "'1000000'", + "'579'", + "'3000'", + "'19998'", + "'11110'" + ], + "boilerplate": { + "python": "class Solution:\n def addStrings(self, num1: str, num2: str) -> str:\n ", + "java": "class Solution {\n public String addStrings(String num1, String num2) {\n // Implementation will go here\n return null;\n }\n}", + "cpp": "class Solution {\npublic:\n string addStrings(string num1, string num2) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == eval(expected)", + "java": "return result.toString().equals(String.valueOf(eval(expected)));", + "cpp": "#include \n\ncompareFunction(const std::string &result, const std::string &expected) {\n return result == expected;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=jziDtPZJ4fw&pp=ygUUTmVldENvZGUgQWRkIFN0cmluZ3M%3D", + "method_name": "addStrings" }, { - "title": "Arranging Coins", - "source": "https://leetcode.com/problems/arranging-coins/", - "description": "

You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete.

\n\n

Given the integer n, return the number of complete rows of the staircase you will build.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: n = 5\nOutput: 2\nExplanation: Because the 3rd row is incomplete, we return 2.\n
\n\n

Example 2:

\n\"\"\n
\nInput: n = 8\nOutput: 3\nExplanation: Because the 4th row is incomplete, we return 3.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=5", - "--arg1=8", - "--arg1=1" - ], - "sample_test_results": [ - "2", - "3", - "1" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=3", - "--arg1=10", - "--arg1=15", - "--arg1=21", - "--arg1=100", - "--arg1=1000", - "--arg1=10000", - "--arg1=2147483647", - "--arg1=6" - ], - "hidden_test_results": [ - "0", - "2", - "4", - "5", - "6", - "13", - "44", - "140", - "65535", - "3" - ], - "boilerplate": { - "python": "class Solution:\n def arrangeCoins(self, n: int) -> int:\n ", - "java": "class Solution {\n public int arrangeCoins(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int arrangeCoins(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.valueOf(result).equals(Integer.valueOf(expected));", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=5rHz_6s2Buw&pp=ygUYTmVldENvZGUgQXJyYW5naW5nIENvaW5z" + "title": "Arranging Coins", + "source": "https://leetcode.com/problems/arranging-coins/", + "description": "

You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete.

\n\n

Given the integer n, return the number of complete rows of the staircase you will build.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: n = 5\nOutput: 2\nExplanation: Because the 3rd row is incomplete, we return 2.\n
\n\n

Example 2:

\n\"\"\n
\nInput: n = 8\nOutput: 3\nExplanation: Because the 4th row is incomplete, we return 3.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=5", + "--arg1=8", + "--arg1=1" + ], + "sample_test_results": [ + "2", + "3", + "1" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=3", + "--arg1=10", + "--arg1=15", + "--arg1=21", + "--arg1=100", + "--arg1=1000", + "--arg1=10000", + "--arg1=2147483647", + "--arg1=6" + ], + "hidden_test_results": [ + "0", + "2", + "4", + "5", + "6", + "13", + "44", + "140", + "65535", + "3" + ], + "boilerplate": { + "python": "class Solution:\n def arrangeCoins(self, n: int) -> int:\n ", + "java": "class Solution {\n public int arrangeCoins(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int arrangeCoins(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.valueOf(result).equals(Integer.valueOf(expected));", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=5rHz_6s2Buw&pp=ygUYTmVldENvZGUgQXJyYW5naW5nIENvaW5z", + "method_name": "arrangeCoins" }, { - "title": "Assign Cookies", - "source": "https://leetcode.com/problems/assign-cookies/", - "description": "

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.

\n\n

Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and each cookie j has a size s[j]. If s[j] >= g[i], we can assign the cookie j to the child i, and the child i will be content. Your goal is to maximize the number of your content children and output the maximum number.

\n\n

 

\n

Example 1:

\n\n
\nInput: g = [1,2,3], s = [1,1]\nOutput: 1\nExplanation: You have 3 children and 2 cookies. The greed factors of 3 children are 1, 2, 3. \nAnd even though you have 2 cookies, since their size is both 1, you could only make the child whose greed factor is 1 content.\nYou need to output 1.\n
\n\n

Example 2:

\n\n
\nInput: g = [1,2], s = [1,2,3]\nOutput: 2\nExplanation: You have 2 children and 3 cookies. The greed factors of 2 children are 1, 2. \nYou have 3 cookies and their sizes are big enough to gratify all of the children, \nYou need to output 2.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= g.length <= 3 * 104
  • \n\t
  • 0 <= s.length <= 3 * 104
  • \n\t
  • 1 <= g[i], s[j] <= 231 - 1
  • \n
\n\n

 

\n

Note: This question is the same as 2410: Maximum Matching of Players With Trainers.

\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1,2,3 --arg2=[1 --arg3=1]", - "--arg1=1,2 --arg2=[1 --arg3=2 --arg4=3]", - "--arg1=1,2,3 --arg2=" - ], - "sample_test_results": [ - "1", - "2", - "0" - ], - "hidden_test_cases": [ - "--arg1= --arg2=[1 --arg3=2 --arg4=3]", - "--arg1=1,2 --arg2=1", - "--arg1=2 --arg2=1", - "--arg1=1,2,3 --arg2=[1 --arg3=2 --arg4=3]", - "--arg1=10,9,8,7 --arg2=[5 --arg3=6 --arg4=7 --arg5=8]", - "--arg1=1,1,1 --arg2=[1 --arg3=1 --arg4=1]", - "--arg1=2,3,4,5 --arg2=[1 --arg3=2 --arg4=3]", - "--arg1=1 --arg2=2", - "--arg1=3,4,5 --arg2=[1 --arg3=2]", - "--arg1=1,2,3 --arg2=3" - ], - "hidden_test_results": [ - "0", - "1", - "0", - "3", - "2", - "3", - "2", - "1", - "0", - "1" - ], - "boilerplate": { - "python": "class Solution:\n def findContentChildren(self, g: List[int], s: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int findContentChildren(List g, List s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int findContentChildren(vector& g, vector& s) {\n\n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=JW8fgvoxPTg&pp=ygUXTmVldENvZGUgQXNzaWduIENvb2tpZXM%3D" + "title": "Assign Cookies", + "source": "https://leetcode.com/problems/assign-cookies/", + "description": "

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.

\n\n

Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and each cookie j has a size s[j]. If s[j] >= g[i], we can assign the cookie j to the child i, and the child i will be content. Your goal is to maximize the number of your content children and output the maximum number.

\n\n

 

\n

Example 1:

\n\n
\nInput: g = [1,2,3], s = [1,1]\nOutput: 1\nExplanation: You have 3 children and 2 cookies. The greed factors of 3 children are 1, 2, 3. \nAnd even though you have 2 cookies, since their size is both 1, you could only make the child whose greed factor is 1 content.\nYou need to output 1.\n
\n\n

Example 2:

\n\n
\nInput: g = [1,2], s = [1,2,3]\nOutput: 2\nExplanation: You have 2 children and 3 cookies. The greed factors of 2 children are 1, 2. \nYou have 3 cookies and their sizes are big enough to gratify all of the children, \nYou need to output 2.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= g.length <= 3 * 104
  • \n\t
  • 0 <= s.length <= 3 * 104
  • \n\t
  • 1 <= g[i], s[j] <= 231 - 1
  • \n
\n\n

 

\n

Note: This question is the same as 2410: Maximum Matching of Players With Trainers.

\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,2,3] --arg2=[1,1]", + "--arg1=[1,2] --arg2=[1,2,3]", + "--arg1=[1,2,3] --arg2=[]" + ], + "sample_test_results": [ + "1", + "2", + "0" + ], + "hidden_test_cases": [ + "--arg1=[] --arg2=[1,2,3]", + "--arg1=[1,2] --arg2=[1]", + "--arg1=[2] --arg2=[1]", + "--arg1=[1,2,3] --arg2=[1,2,3]", + "--arg1=[10,9,8,7] --arg2=[5,6,7,8]", + "--arg1=[1,1,1] --arg2=[1,1,1]", + "--arg1=[2,3,4,5] --arg2=[1,2,3]", + "--arg1=[1] --arg2=[2]", + "--arg1=[3,4,5] --arg2=[1,2]", + "--arg1=[1,2,3] --arg2=[3]" + ], + "hidden_test_results": [ + "0", + "1", + "0", + "3", + "2", + "3", + "2", + "1", + "0", + "1" + ], + "boilerplate": { + "python": "class Solution:\n def findContentChildren(self, g: List[int], s: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int findContentChildren(List g, List s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findContentChildren(vector& g, vector& s) {\n\n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=JW8fgvoxPTg&pp=ygUXTmVldENvZGUgQXNzaWduIENvb2tpZXM%3D", + "method_name": "findContentChildren" }, { - "title": "Repeated Substring Pattern", - "source": "https://leetcode.com/problems/repeated-substring-pattern/", - "description": "

Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abab"\nOutput: true\nExplanation: It is the substring "ab" twice.\n
\n\n

Example 2:

\n\n
\nInput: s = "aba"\nOutput: false\n
\n\n

Example 3:

\n\n
\nInput: s = "abcabcabcabc"\nOutput: true\nExplanation: It is the substring "abc" four times or the substring "abcabc" twice.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of lowercase English letters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='abab'", - "--arg1='aba'", - "--arg1='abcabcabcabc'" - ], - "sample_test_results": [ - "True", - "False", - "True" - ], - "hidden_test_cases": [ - "--arg1=''", - "--arg1='a'", - "--arg1='aa'", - "--arg1='aaa'", - "--arg1='aabaaba'", - "--arg1='abaababaab'", - "--arg1='aaaaa'", - "--arg1='abcabc'", - "--arg1='abcabcabc'", - "--arg1='abac'" - ], - "hidden_test_results": [ - "True", - "False", - "True", - "True", - "False", - "True", - "True", - "True", - "True", - "False" - ], - "boilerplate": { - "python": "class Solution:\n def repeatedSubstringPattern(self, s: str) -> bool:\n ", - "java": "class Solution {\n public boolean repeatedSubstringPattern(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool repeatedSubstringPattern(std::string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.equalsIgnoreCase(expected);", - "cpp": "return result.size() == expected.size() && std::equal(result.begin(), result.end(), expected.begin(), [](char a, char b) { return std::tolower(a) == std::tolower(b); });" - }, - "explanation": "https://www.youtube.com/watch?v=2qEmA76Unm4&pp=ygUjTmVldENvZGUgUmVwZWF0ZWQgU3Vic3RyaW5nIFBhdHRlcm4%3D" + "title": "Repeated Substring Pattern", + "source": "https://leetcode.com/problems/repeated-substring-pattern/", + "description": "

Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abab"\nOutput: true\nExplanation: It is the substring "ab" twice.\n
\n\n

Example 2:

\n\n
\nInput: s = "aba"\nOutput: false\n
\n\n

Example 3:

\n\n
\nInput: s = "abcabcabcabc"\nOutput: true\nExplanation: It is the substring "abc" four times or the substring "abcabc" twice.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of lowercase English letters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='abab'", + "--arg1='aba'", + "--arg1='abcabcabcabc'" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=''", + "--arg1='a'", + "--arg1='aa'", + "--arg1='aaa'", + "--arg1='aabaaba'", + "--arg1='abaababaab'", + "--arg1='aaaaa'", + "--arg1='abcabc'", + "--arg1='abcabcabc'", + "--arg1='abac'" + ], + "hidden_test_results": [ + "true", + "false", + "true", + "true", + "false", + "true", + "true", + "true", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def repeatedSubstringPattern(self, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean repeatedSubstringPattern(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool repeatedSubstringPattern(std::string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.equalsIgnoreCase(expected);", + "cpp": "return result.size() == expected.size() && std::equal(result.begin(), result.end(), expected.begin(), [](char a, char b) { return std::tolower(a) == std::tolower(b); });" + }, + "explanation": "https://www.youtube.com/watch?v=2qEmA76Unm4&pp=ygUjTmVldENvZGUgUmVwZWF0ZWQgU3Vic3RyaW5nIFBhdHRlcm4%3D", + "method_name": "repeatedSubstringPattern" }, { - "title": "License Key Formatting", - "source": "https://leetcode.com/problems/license-key-formatting/", - "description": "

You are given a license key represented as a string s that consists of only alphanumeric characters and dashes. The string is separated into n + 1 groups by n dashes. You are also given an integer k.

\n\n

We want to reformat the string s such that each group contains exactly k characters, except for the first group, which could be shorter than k but still must contain at least one character. Furthermore, there must be a dash inserted between two groups, and you should convert all lowercase letters to uppercase.

\n\n

Return the reformatted license key.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "5F3Z-2e-9-w", k = 4\nOutput: "5F3Z-2E9W"\nExplanation: The string s has been split into two parts, each part has 4 characters.\nNote that the two extra dashes are not needed and can be removed.\n
\n\n

Example 2:

\n\n
\nInput: s = "2-5g-3-J", k = 2\nOutput: "2-5G-3J"\nExplanation: The string s has been split into three parts, each part has 2 characters except the first part as it could be shorter as mentioned above.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 105
  • \n\t
  • s consists of English letters, digits, and dashes '-'.
  • \n\t
  • 1 <= k <= 104
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='5F3Z-2e-9-w' --arg2=4", - "--arg1='2-5g-3-J' --arg2=2" - ], - "sample_test_results": [ - "'5F3Z-2E9W'", - "'2-5G-3J'" - ], - "hidden_test_cases": [ - "--arg1='a-a-a-a-' --arg2=1", - "--arg1='---' --arg2=3", - "--arg1='2' --arg2=2", - "--arg1='r' --arg2=1", - "--arg1='5F3Z-2e-9-w-a-b-c-d' --arg2=4", - "--arg1='2-5g-3-J-k-L' --arg2=3", - "--arg1='a-b-c' --arg2=3", - "--arg1='12345' --arg2=1", - "--arg1='ABCD' --arg2=2", - "--arg1='a-1-B-2' --arg2=2" - ], - "hidden_test_results": [ - "'A-A-A-A'", - "''", - "'2'", - "'R'", - "'5F3Z-2E9W-ABCD'", - "'2-5G3-JKL'", - "'ABC'", - "'1-2-3-4-5'", - "'AB-CD'", - "'A1-B2'" - ], - "boilerplate": { - "python": "class Solution:\n def licenseKeyFormatting(self, s: str, k: int) -> str:\n ", - "java": "class Solution {\n public String licenseKeyFormatting(String s, int k) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string licenseKeyFormatting(string s, int k) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=3KMlpe8eZ0E&pp=ygUfTmVldENvZGUgTGljZW5zZSBLZXkgRm9ybWF0dGluZw%3D%3D" + "title": "License Key Formatting", + "source": "https://leetcode.com/problems/license-key-formatting/", + "description": "

You are given a license key represented as a string s that consists of only alphanumeric characters and dashes. The string is separated into n + 1 groups by n dashes. You are also given an integer k.

\n\n

We want to reformat the string s such that each group contains exactly k characters, except for the first group, which could be shorter than k but still must contain at least one character. Furthermore, there must be a dash inserted between two groups, and you should convert all lowercase letters to uppercase.

\n\n

Return the reformatted license key.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "5F3Z-2e-9-w", k = 4\nOutput: "5F3Z-2E9W"\nExplanation: The string s has been split into two parts, each part has 4 characters.\nNote that the two extra dashes are not needed and can be removed.\n
\n\n

Example 2:

\n\n
\nInput: s = "2-5g-3-J", k = 2\nOutput: "2-5G-3J"\nExplanation: The string s has been split into three parts, each part has 2 characters except the first part as it could be shorter as mentioned above.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 105
  • \n\t
  • s consists of English letters, digits, and dashes '-'.
  • \n\t
  • 1 <= k <= 104
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='5F3Z-2e-9-w' --arg2=4", + "--arg1='2-5g-3-J' --arg2=2" + ], + "sample_test_results": [ + "'5F3Z-2E9W'", + "'2-5G-3J'" + ], + "hidden_test_cases": [ + "--arg1='a-a-a-a-' --arg2=1", + "--arg1='---' --arg2=3", + "--arg1='2' --arg2=2", + "--arg1='r' --arg2=1", + "--arg1='5F3Z-2e-9-w-a-b-c-d' --arg2=4", + "--arg1='2-5g-3-J-k-L' --arg2=3", + "--arg1='a-b-c' --arg2=3", + "--arg1='12345' --arg2=1", + "--arg1='ABCD' --arg2=2", + "--arg1='a-1-B-2' --arg2=2" + ], + "hidden_test_results": [ + "'A-A-A-A'", + "''", + "'2'", + "'R'", + "'5F3Z-2E9W-ABCD'", + "'2-5G3-JKL'", + "'ABC'", + "'1-2-3-4-5'", + "'AB-CD'", + "'A1-B2'" + ], + "boilerplate": { + "python": "class Solution:\n def licenseKeyFormatting(self, s: str, k: int) -> str:\n ", + "java": "class Solution {\n public String licenseKeyFormatting(String s, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string licenseKeyFormatting(string s, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=3KMlpe8eZ0E&pp=ygUfTmVldENvZGUgTGljZW5zZSBLZXkgRm9ybWF0dGluZw%3D%3D", + "method_name": "licenseKeyFormatting" }, { - "title": "Construct the Rectangle", - "source": "https://leetcode.com/problems/construct-the-rectangle/", - "description": "

A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:

\n\n
    \n\t
  1. The area of the rectangular web page you designed must equal to the given target area.
  2. \n\t
  3. The width W should not be larger than the length L, which means L >= W.
  4. \n\t
  5. The difference between length L and width W should be as small as possible.
  6. \n
\n\n

Return an array [L, W] where L and W are the length and width of the web page you designed in sequence.

\n\n

 

\n

Example 1:

\n\n
\nInput: area = 4\nOutput: [2,2]\nExplanation: The target area is 4, and all the possible ways to construct it are [1,4], [2,2], [4,1]. \nBut according to requirement 2, [1,4] is illegal; according to requirement 3,  [4,1] is not optimal compared to [2,2]. So the length L is 2, and the width W is 2.\n
\n\n

Example 2:

\n\n
\nInput: area = 37\nOutput: [37,1]\n
\n\n

Example 3:

\n\n
\nInput: area = 122122\nOutput: [427,286]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= area <= 107
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=4", - "--arg1=37", - "--arg1=122122" - ], - "sample_test_results": [ - "2, 2", - "37, 1", - "427, 286" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=9", - "--arg1=16", - "--arg1=24", - "--arg1=100", - "--arg1=1000", - "--arg1=10000", - "--arg1=99999", - "--arg1=1000000", - "--arg1=9999999" - ], - "hidden_test_results": [ - "1, 1", - "3, 3", - "4, 4", - "6, 4", - "10, 10", - "40, 25", - "100, 100", - "369, 271", - "1000, 1000", - "4649, 2151" - ], - "boilerplate": { - "python": "class Solution:\n def constructRectangle(self, area: int) -> List[int]:\n ", - "java": "import java.util.*;\n\nclass Solution {\n public List constructRectangle(int area) {\n List result = new ArrayList<>();\n // Placeholder for the implementation\n return result;\n }\n}", - "cpp": "class Solution {\npublic:\n std::vector constructRectangle(int area) {\n \n }\n};" - }, - "compare_func": { - "python": "expected = eval(expected); return result[0]*result[1] == expected[0]*expected[1] and result[0] >= result[1] and abs(result[0]-result[1]) <= abs(expected[0]-expected[1])", - "java": "return (result[0] * result[1] == expected[0] * expected[1]) && (result[0] >= result[1]) && (Math.abs(result[0] - result[1]) <= Math.abs(expected[0] - expected[1]));", - "cpp": "int expectedValue = std::stoi(expected);\nreturn (result[0] * result[1] == expected[0] * expected[1]) && (result[0] >= result[1]) && (std::abs(result[0] - result[1]) <= std::abs(expected[0] - expected[1]));" - }, - "explanation": "https://www.youtube.com/watch?v=-Lb4SvVyPCM&pp=ygUgTmVldENvZGUgQ29uc3RydWN0IHRoZSBSZWN0YW5nbGU%3D" + "title": "Construct the Rectangle", + "source": "https://leetcode.com/problems/construct-the-rectangle/", + "description": "

A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:

\n\n
    \n\t
  1. The area of the rectangular web page you designed must equal to the given target area.
  2. \n\t
  3. The width W should not be larger than the length L, which means L >= W.
  4. \n\t
  5. The difference between length L and width W should be as small as possible.
  6. \n
\n\n

Return an array [L, W] where L and W are the length and width of the web page you designed in sequence.

\n\n

 

\n

Example 1:

\n\n
\nInput: area = 4\nOutput: [2,2]\nExplanation: The target area is 4, and all the possible ways to construct it are [1,4], [2,2], [4,1]. \nBut according to requirement 2, [1,4] is illegal; according to requirement 3,  [4,1] is not optimal compared to [2,2]. So the length L is 2, and the width W is 2.\n
\n\n

Example 2:

\n\n
\nInput: area = 37\nOutput: [37,1]\n
\n\n

Example 3:

\n\n
\nInput: area = 122122\nOutput: [427,286]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= area <= 107
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=4", + "--arg1=37", + "--arg1=122122" + ], + "sample_test_results": [ + "[2,2]", + "[37,1]", + "[427,286]" + ], + "hidden_test_cases": [ + "--arg1=1", + "--arg1=9", + "--arg1=16", + "--arg1=24", + "--arg1=100", + "--arg1=1000", + "--arg1=10000", + "--arg1=99999", + "--arg1=1000000", + "--arg1=9999999" + ], + "hidden_test_results": [ + "[1,1]", + "[3,3]", + "[4,4]", + "[6,4]", + "[10,10]", + "[40,25]", + "[100,100]", + "[369,271]", + "[1000,1000]", + "[4649,2151]" + ], + "boilerplate": { + "python": "class Solution:\n def constructRectangle(self, area: int) -> List[int]:\n ", + "java": "import java.util.*;\n\nclass Solution {\n public List constructRectangle(int area) {\n List result = new ArrayList<>();\n // Placeholder for the implementation\n return result;\n }\n}", + "cpp": "class Solution {\npublic:\n std::vector constructRectangle(int area) {\n \n }\n};" + }, + "compare_func": { + "python": "expected = eval(expected); return result[0]*result[1] == expected[0]*expected[1] and result[0] >= result[1] and abs(result[0]-result[1]) <= abs(expected[0]-expected[1])", + "java": "return (result[0] * result[1] == expected[0] * expected[1]) && (result[0] >= result[1]) && (Math.abs(result[0] - result[1]) <= Math.abs(expected[0] - expected[1]));", + "cpp": "int expectedValue = std::stoi(expected);\nreturn (result[0] * result[1] == expected[0] * expected[1]) && (result[0] >= result[1]) && (std::abs(result[0] - result[1]) <= std::abs(expected[0] - expected[1]));" + }, + "explanation": "https://www.youtube.com/watch?v=-Lb4SvVyPCM&pp=ygUgTmVldENvZGUgQ29uc3RydWN0IHRoZSBSZWN0YW5nbGU%3D", + "method_name": "constructRectangle" }, { - "title": "Teemo Attacking", - "source": "https://leetcode.com/problems/teemo-attacking/", - "description": "

Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly duration seconds. More formally, an attack at second t will mean Ashe is poisoned during the inclusive time interval [t, t + duration - 1]. If Teemo attacks again before the poison effect ends, the timer for it is reset, and the poison effect will end duration seconds after the new attack.

\n\n

You are given a non-decreasing integer array timeSeries, where timeSeries[i] denotes that Teemo attacks Ashe at second timeSeries[i], and an integer duration.

\n\n

Return the total number of seconds that Ashe is poisoned.

\n\n

 

\n

Example 1:

\n\n
\nInput: timeSeries = [1,4], duration = 2\nOutput: 4\nExplanation: Teemo's attacks on Ashe go as follows:\n- At second 1, Teemo attacks, and Ashe is poisoned for seconds 1 and 2.\n- At second 4, Teemo attacks, and Ashe is poisoned for seconds 4 and 5.\nAshe is poisoned for seconds 1, 2, 4, and 5, which is 4 seconds in total.\n
\n\n

Example 2:

\n\n
\nInput: timeSeries = [1,2], duration = 2\nOutput: 3\nExplanation: Teemo's attacks on Ashe go as follows:\n- At second 1, Teemo attacks, and Ashe is poisoned for seconds 1 and 2.\n- At second 2 however, Teemo attacks again and resets the poison timer. Ashe is poisoned for seconds 2 and 3.\nAshe is poisoned for seconds 1, 2, and 3, which is 3 seconds in total.
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= timeSeries.length <= 104
  • \n\t
  • 0 <= timeSeries[i], duration <= 107
  • \n\t
  • timeSeries is sorted in non-decreasing order.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1,4 --arg2=2", - "--arg1=1,2 --arg2=2" - ], - "sample_test_results": [ - "4", - "3" - ], - "hidden_test_cases": [ - "--arg1=1 --arg2=1", - "--arg1=1,2,3,4,5 --arg2=1", - "--arg1=1,3,5,7,9 --arg2=3", - "--arg1=1,2,3,4,5 --arg2=5", - "--arg1=1,10,20,30 --arg2=5", - "--arg1=1,2,3,100 --arg2=2", - "--arg1=1,1,1,1 --arg2=2", - "--arg1=0,1,2 --arg2=1", - "--arg1=1,5,10 --arg2=2", - "--arg1=1,3 --arg2=3" - ], - "hidden_test_results": [ - "1", - "5", - "11", - "9", - "20", - "6", - "2", - "3", - "6", - "5" - ], - "boilerplate": { - "python": "class Solution:\n def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:\n ", - "java": "class Solution {\n public int findPoisonedDuration(List timeSeries, int duration) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int findPoisonedDuration(vector& timeSeries, int duration) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=NejSCTIdd5k&pp=ygUYTmVldENvZGUgVGVlbW8gQXR0YWNraW5n" + "title": "Teemo Attacking", + "source": "https://leetcode.com/problems/teemo-attacking/", + "description": "

Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly duration seconds. More formally, an attack at second t will mean Ashe is poisoned during the inclusive time interval [t, t + duration - 1]. If Teemo attacks again before the poison effect ends, the timer for it is reset, and the poison effect will end duration seconds after the new attack.

\n\n

You are given a non-decreasing integer array timeSeries, where timeSeries[i] denotes that Teemo attacks Ashe at second timeSeries[i], and an integer duration.

\n\n

Return the total number of seconds that Ashe is poisoned.

\n\n

 

\n

Example 1:

\n\n
\nInput: timeSeries = [1,4], duration = 2\nOutput: 4\nExplanation: Teemo's attacks on Ashe go as follows:\n- At second 1, Teemo attacks, and Ashe is poisoned for seconds 1 and 2.\n- At second 4, Teemo attacks, and Ashe is poisoned for seconds 4 and 5.\nAshe is poisoned for seconds 1, 2, 4, and 5, which is 4 seconds in total.\n
\n\n

Example 2:

\n\n
\nInput: timeSeries = [1,2], duration = 2\nOutput: 3\nExplanation: Teemo's attacks on Ashe go as follows:\n- At second 1, Teemo attacks, and Ashe is poisoned for seconds 1 and 2.\n- At second 2 however, Teemo attacks again and resets the poison timer. Ashe is poisoned for seconds 2 and 3.\nAshe is poisoned for seconds 1, 2, and 3, which is 3 seconds in total.
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= timeSeries.length <= 104
  • \n\t
  • 0 <= timeSeries[i], duration <= 107
  • \n\t
  • timeSeries is sorted in non-decreasing order.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,4] --arg2=2", + "--arg1=[1,2] --arg2=2" + ], + "sample_test_results": [ + "4", + "3" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=1", + "--arg1=[1,2,3,4,5] --arg2=1", + "--arg1=[1,3,5,7,9] --arg2=3", + "--arg1=[1,2,3,4,5] --arg2=5", + "--arg1=[1,10,20,30] --arg2=5", + "--arg1=[1,2,3,100] --arg2=2", + "--arg1=[1,1,1,1] --arg2=2", + "--arg1=[0,1,2] --arg2=1", + "--arg1=[1,5,10] --arg2=2", + "--arg1=[1,3] --arg2=3" + ], + "hidden_test_results": [ + "1", + "5", + "11", + "9", + "20", + "6", + "2", + "3", + "6", + "5" + ], + "boilerplate": { + "python": "class Solution:\n def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:\n ", + "java": "class Solution {\n public int findPoisonedDuration(List timeSeries, int duration) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findPoisonedDuration(vector& timeSeries, int duration) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=NejSCTIdd5k&pp=ygUYTmVldENvZGUgVGVlbW8gQXR0YWNraW5n", + "method_name": "findPoisonedDuration" }, { - "title": "Base 7", - "source": "https://leetcode.com/problems/base-7/", - "description": "

Given an integer num, return a string of its base 7 representation.

\n\n

 

\n

Example 1:

\n
Input: num = 100\nOutput: \"202\"\n

Example 2:

\n
Input: num = -7\nOutput: \"-10\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -107 <= num <= 107
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=100", - "--arg1=-7" - ], - "sample_test_results": [ - "'202'", - "'-10'" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=7", - "--arg1=-49", - "--arg1=1000000", - "--arg1=-1000000", - "--arg1=1", - "--arg1=-1", - "--arg1=49", - "--arg1=999999", - "--arg1=-999999" - ], - "hidden_test_results": [ - "'0'", - "'10'", - "'-100'", - "'11333311'", - "'-11333311'", - "'1'", - "'-1'", - "'100'", - "'11333310'", - "'-11333310'" - ], - "boilerplate": { - "python": "class Solution:\n def convertToBase7(self, num: int) -> str:\n ", - "java": "class Solution {\n public String convertToBase7(int num) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::string convertToBase7(int num) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "return result == std::stod(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=sbmq-efwOsA&pp=ygUPTmVldENvZGUgQmFzZSA3" + "title": "Base 7", + "source": "https://leetcode.com/problems/base-7/", + "description": "

Given an integer num, return a string of its base 7 representation.

\n\n

 

\n

Example 1:

\n
Input: num = 100\nOutput: \"202\"\n

Example 2:

\n
Input: num = -7\nOutput: \"-10\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -107 <= num <= 107
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=100", + "--arg1=-7" + ], + "sample_test_results": [ + "'202'", + "'-10'" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=7", + "--arg1=-49", + "--arg1=1000000", + "--arg1=-1000000", + "--arg1=1", + "--arg1=-1", + "--arg1=49", + "--arg1=999999", + "--arg1=-999999" + ], + "hidden_test_results": [ + "'0'", + "'10'", + "'-100'", + "'11333311'", + "'-11333311'", + "'1'", + "'-1'", + "'100'", + "'11333310'", + "'-11333310'" + ], + "boilerplate": { + "python": "class Solution:\n def convertToBase7(self, num: int) -> str:\n ", + "java": "class Solution {\n public String convertToBase7(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::string convertToBase7(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "return result == std::stod(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=sbmq-efwOsA&pp=ygUPTmVldENvZGUgQmFzZSA3", + "method_name": "convertToBase7" }, { - "title": "Perfect Number", - "source": "https://leetcode.com/problems/perfect-number/", - "description": "

A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. A divisor of an integer x is an integer that can divide x evenly.

\n\n

Given an integer n, return true if n is a perfect number, otherwise return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = 28\nOutput: true\nExplanation: 28 = 1 + 2 + 4 + 7 + 14\n1, 2, 4, 7, and 14 are all divisors of 28.\n
\n\n

Example 2:

\n\n
\nInput: num = 7\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num <= 108
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=28", - "--arg1=7" - ], - "sample_test_results": [ - "True", - "False" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=6", - "--arg1=496", - "--arg1=8128", - "--arg1=33550336", - "--arg1=12", - "--arg1=100", - "--arg1=1000", - "--arg1=10000", - "--arg1=100000" - ], - "hidden_test_results": [ - "False", - "True", - "True", - "True", - "True", - "False", - "False", - "False", - "False", - "False" - ], - "boilerplate": { - "python": "class Solution:\n def checkPerfectNumber(self, num: int) -> bool:\n ", - "java": "class Solution {\n public boolean checkPerfectNumber(int num) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool checkPerfectNumber(int num) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::tolower(result) == std::tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=HLZLwjzIVGo&pp=ygUXTmVldENvZGUgUGVyZmVjdCBOdW1iZXI%3D" + "title": "Perfect Number", + "source": "https://leetcode.com/problems/perfect-number/", + "description": "

A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. A divisor of an integer x is an integer that can divide x evenly.

\n\n

Given an integer n, return true if n is a perfect number, otherwise return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = 28\nOutput: true\nExplanation: 28 = 1 + 2 + 4 + 7 + 14\n1, 2, 4, 7, and 14 are all divisors of 28.\n
\n\n

Example 2:

\n\n
\nInput: num = 7\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num <= 108
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=28", + "--arg1=7" + ], + "sample_test_results": [ + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1=1", + "--arg1=6", + "--arg1=496", + "--arg1=8128", + "--arg1=33550336", + "--arg1=12", + "--arg1=100", + "--arg1=1000", + "--arg1=10000", + "--arg1=100000" + ], + "hidden_test_results": [ + "false", + "true", + "true", + "true", + "true", + "false", + "false", + "false", + "false", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def checkPerfectNumber(self, num: int) -> bool:\n ", + "java": "class Solution {\n public boolean checkPerfectNumber(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool checkPerfectNumber(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=HLZLwjzIVGo&pp=ygUXTmVldENvZGUgUGVyZmVjdCBOdW1iZXI%3D", + "method_name": "checkPerfectNumber" }, { - "title": "Zigzag Conversion", - "source": "https://leetcode.com/problems/zigzag-conversion/", - "description": "

The string "PAYPALISHIRING" 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)

\n\n
\nP   A   H   N\nA P L S I I G\nY   I   R\n
\n\n

And then read line by line: "PAHNAPLSIIGYIR"

\n\n

Write the code that will take a string and make this conversion given a number of rows:

\n\n
\nstring convert(string s, int numRows);\n
\n\n

 

\n

Example 1:

\n\n
\nInput: s = "PAYPALISHIRING", numRows = 3\nOutput: "PAHNAPLSIIGYIR"\n
\n\n

Example 2:

\n\n
\nInput: s = "PAYPALISHIRING", numRows = 4\nOutput: "PINALSIGYAHRPI"\nExplanation:\nP     I    N\nA   L S  I G\nY A   H R\nP     I\n
\n\n

Example 3:

\n\n
\nInput: s = "A", numRows = 1\nOutput: "A"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 1000
  • \n\t
  • s consists of English letters (lower-case and upper-case), ',' and '.'.
  • \n\t
  • 1 <= numRows <= 1000
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1='PAYPALISHIRING' --arg2=3", - "--arg1='PAYPALISHIRING' --arg2=4", - "--arg1='A' --arg2=1" - ], - "sample_test_results": [ - "'PAHNAPLSIIGYIR'", - "'PINALSIGYAHRPI'", - "'A'" - ], - "hidden_test_cases": [ - "--arg1='ABCDEF' --arg2=2", - "--arg1='HELLO' --arg2=1", - "--arg1='WORLD' --arg2=5", - "--arg1='TEST.TEST' --arg2=3", - "--arg1='A --arg2=B --arg3=C' --arg4=2", - "--arg1='abcdefghijklmnop' --arg2=4", - "--arg1='ANTHROPIC' --arg2=3", - "--arg1='Testing123' --arg2=2", - "--arg1='' --arg2=1", - "--arg1='AB' --arg2=1" - ], - "hidden_test_results": [ - "'ACEBDF'", - "'HELLO'", - "'WORLD'", - "'T.TETTSSE'", - "'ABC,,'", - "'agmbfhlnceikodjp'", - "'ARCNHOITP'", - "'Tsig2etn13'", - "''", - "'AB'" - ], - "boilerplate": { - "python": "class Solution:\n def convert(self, s: str, numRows: int) -> str:\n ", - "java": "class Solution {\n public String convert(String s, int numRows) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::string convert(std::string s, int numRows) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stol(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=Q2Tw6gcVEwc&pp=ygUaTmVldENvZGUgWmlnemFnIENvbnZlcnNpb24%3D" + "title": "Zigzag Conversion", + "source": "https://leetcode.com/problems/zigzag-conversion/", + "description": "

The string "PAYPALISHIRING" 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)

\n\n
\nP   A   H   N\nA P L S I I G\nY   I   R\n
\n\n

And then read line by line: "PAHNAPLSIIGYIR"

\n\n

Write the code that will take a string and make this conversion given a number of rows:

\n\n
\nstring convert(string s, int numRows);\n
\n\n

 

\n

Example 1:

\n\n
\nInput: s = "PAYPALISHIRING", numRows = 3\nOutput: "PAHNAPLSIIGYIR"\n
\n\n

Example 2:

\n\n
\nInput: s = "PAYPALISHIRING", numRows = 4\nOutput: "PINALSIGYAHRPI"\nExplanation:\nP     I    N\nA   L S  I G\nY A   H R\nP     I\n
\n\n

Example 3:

\n\n
\nInput: s = "A", numRows = 1\nOutput: "A"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 1000
  • \n\t
  • s consists of English letters (lower-case and upper-case), ',' and '.'.
  • \n\t
  • 1 <= numRows <= 1000
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1='PAYPALISHIRING' --arg2=3", + "--arg1='PAYPALISHIRING' --arg2=4", + "--arg1='A' --arg2=1" + ], + "sample_test_results": [ + "'PAHNAPLSIIGYIR'", + "'PINALSIGYAHRPI'", + "'A'" + ], + "hidden_test_cases": [ + "--arg1='ABCDEF' --arg2=2", + "--arg1='HELLO' --arg2=1", + "--arg1='WORLD' --arg2=5", + "--arg1='TEST.TEST' --arg2=3", + "--arg1='A --arg2=B --arg3=C' --arg4=2", + "--arg1='abcdefghijklmnop' --arg2=4", + "--arg1='ANTHROPIC' --arg2=3", + "--arg1='Testing123' --arg2=2", + "--arg1='' --arg2=1", + "--arg1='AB' --arg2=1" + ], + "hidden_test_results": [ + "'ACEBDF'", + "'HELLO'", + "'WORLD'", + "'T.TETTSSE'", + "'ABC,,'", + "'agmbfhlnceikodjp'", + "'ARCNHOITP'", + "'Tsig2etn13'", + "''", + "'AB'" + ], + "boilerplate": { + "python": "class Solution:\n def convert(self, s: str, numRows: int) -> str:\n ", + "java": "class Solution {\n public String convert(String s, int numRows) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::string convert(std::string s, int numRows) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stol(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Q2Tw6gcVEwc&pp=ygUaTmVldENvZGUgWmlnemFnIENvbnZlcnNpb24%3D", + "method_name": "convert" }, { - "title": "Container With Most Water", - "source": "https://leetcode.com/problems/container-with-most-water/", - "description": "

You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).

\n\n

Find two lines that together with the x-axis form a container, such that the container contains the most water.

\n\n

Return the maximum amount of water a container can store.

\n\n

Notice that you may not slant the container.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: height = [1,8,6,2,5,4,8,3,7]\nOutput: 49\nExplanation: The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49.\n
\n\n

Example 2:

\n\n
\nInput: height = [1,1]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == height.length
  • \n\t
  • 2 <= n <= 105
  • \n\t
  • 0 <= height[i] <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=1,8,6,2,5,4,8,3,7", - "--arg1=1,1" - ], - "sample_test_results": [ - "49", - "1" - ], - "hidden_test_cases": [ - "--arg1=4,3,2,1,4", - "--arg1=1,2,4,3", - "--arg1=1,2", - "--arg1=1,1,1", - "--arg1=2,3,4,5,18,17,6", - "--arg1=1,8,100,2,100,4,8,3,7", - "--arg1=1,2,3,4,5,6", - "--arg1=6,5,4,3,2,1", - "--arg1=0,0", - "--arg1=10000,1" - ], - "hidden_test_results": [ - "16", - "4", - "1", - "2", - "17", - "200", - "9", - "9", - "0", - "1" - ], - "boilerplate": { - "python": "class Solution:\n def maxArea(self, height: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int maxArea(List height) {\n\n }\n}", - "cpp": "class Solution {\npublic:\n int maxArea(vector& height) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=UuiTKBwPgAo&pp=ygUiTmVldENvZGUgQ29udGFpbmVyIFdpdGggTW9zdCBXYXRlcg%3D%3D" + "title": "Container With Most Water", + "source": "https://leetcode.com/problems/container-with-most-water/", + "description": "

You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).

\n\n

Find two lines that together with the x-axis form a container, such that the container contains the most water.

\n\n

Return the maximum amount of water a container can store.

\n\n

Notice that you may not slant the container.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: height = [1,8,6,2,5,4,8,3,7]\nOutput: 49\nExplanation: The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49.\n
\n\n

Example 2:

\n\n
\nInput: height = [1,1]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == height.length
  • \n\t
  • 2 <= n <= 105
  • \n\t
  • 0 <= height[i] <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[1,8,6,2,5,4,8,3,7]", + "--arg1=[1,1]" + ], + "sample_test_results": [ + "49", + "1" + ], + "hidden_test_cases": [ + "--arg1=[4,3,2,1,4]", + "--arg1=[1,2,4,3]", + "--arg1=[1,2]", + "--arg1=[1,1,1]", + "--arg1=[2,3,4,5,18,17,6]", + "--arg1=[1,8,100,2,100,4,8,3,7]", + "--arg1=[1,2,3,4,5,6]", + "--arg1=[6,5,4,3,2,1]", + "--arg1=[0,0]", + "--arg1=[10000,1]" + ], + "hidden_test_results": [ + "16", + "4", + "1", + "2", + "17", + "200", + "9", + "9", + "0", + "1" + ], + "boilerplate": { + "python": "class Solution:\n def maxArea(self, height: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int maxArea(List height) {\n\n }\n}", + "cpp": "class Solution {\npublic:\n int maxArea(vector& height) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=UuiTKBwPgAo&pp=ygUiTmVldENvZGUgQ29udGFpbmVyIFdpdGggTW9zdCBXYXRlcg%3D%3D", + "method_name": "maxArea" }, { - "title": "3Sum Closest", - "source": "https://leetcode.com/problems/3sum-closest/", - "description": "

Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target.

\n\n

Return the sum of the three integers.

\n\n

You may assume that each input would have exactly one solution.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [-1,2,1,-4], target = 1\nOutput: 2\nExplanation: The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,0,0], target = 1\nOutput: 0\nExplanation: The sum that is closest to the target is 0. (0 + 0 + 0 = 0).\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 3 <= nums.length <= 500
  • \n\t
  • -1000 <= nums[i] <= 1000
  • \n\t
  • -104 <= target <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=-1,2,1,-4 --arg2=1", - "--arg1=0,0,0 --arg2=1" - ], - "sample_test_results": [ - "2", - "0" - ], - "hidden_test_cases": [ - "--arg1=1,1,1,0 --arg2=100", - "--arg1=-1,0,1,2,3 --arg2=1", - "--arg1=0,0,0,0 --arg2=1", - "--arg1=-5,-4,-3,-2,-1 --arg2=0", - "--arg1=1,2,3,4,5 --arg2=10", - "--arg1=-1,-2,-3,1,2,3 --arg2=0", - "--arg1=1,1,-1,-1,3 --arg2=-1", - "--arg1=-100,-50,0,50,100 --arg2=23", - "--arg1=-1,2,1,-4,3,-3 --arg2=0", - "--arg1=-1000,1000,1000 --arg2=100" - ], - "hidden_test_results": [ - "3", - "1", - "0", - "-6", - "10", - "0", - "-1", - "0", - "0", - "1000" - ], - "boilerplate": { - "python": "class Solution:\n def threeSumClosest(self, nums: List[int], target: int) -> int:\n ", - "java": "class Solution {\n public int threeSumClosest(int[] nums, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int threeSumClosest(vector& nums, int target) {\n return 0;\n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=PXWT4wzkA6M&pp=ygUVTmVldENvZGUgM1N1bSBDbG9zZXN0" + "title": "3Sum Closest", + "source": "https://leetcode.com/problems/3sum-closest/", + "description": "

Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target.

\n\n

Return the sum of the three integers.

\n\n

You may assume that each input would have exactly one solution.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [-1,2,1,-4], target = 1\nOutput: 2\nExplanation: The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,0,0], target = 1\nOutput: 0\nExplanation: The sum that is closest to the target is 0. (0 + 0 + 0 = 0).\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 3 <= nums.length <= 500
  • \n\t
  • -1000 <= nums[i] <= 1000
  • \n\t
  • -104 <= target <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[-1,2,1,-4] --arg2=1", + "--arg1=[0,0,0] --arg2=1" + ], + "sample_test_results": [ + "2", + "0" + ], + "hidden_test_cases": [ + "--arg1=[1,1,1,0] --arg2=100", + "--arg1=[-1,0,1,2,3] --arg2=1", + "--arg1=[0,0,0,0] --arg2=1", + "--arg1=[-5,-4,-3,-2,-1] --arg2=0", + "--arg1=[1,2,3,4,5] --arg2=10", + "--arg1=[-1,-2,-3,1,2,3] --arg2=0", + "--arg1=[1,1,-1,-1,3] --arg2=-1", + "--arg1=[-100,-50,0,50,100] --arg2=23", + "--arg1=[-1,2,1,-4,3,-3] --arg2=0", + "--arg1=[-1000,1000,1000] --arg2=100" + ], + "hidden_test_results": [ + "3", + "1", + "0", + "-6", + "10", + "0", + "-1", + "0", + "0", + "1000" + ], + "boilerplate": { + "python": "class Solution:\n def threeSumClosest(self, nums: List[int], target: int) -> int:\n ", + "java": "class Solution {\n public int threeSumClosest(int[] nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int threeSumClosest(vector& nums, int target) {\n return 0;\n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=PXWT4wzkA6M&pp=ygUVTmVldENvZGUgM1N1bSBDbG9zZXN0", + "method_name": "threeSumClosest" }, { - "title": "Search in Rotated Sorted Array", - "source": "https://leetcode.com/problems/search-in-rotated-sorted-array/", - "description": "

There is an integer array nums sorted in ascending order (with distinct values).

\n\n

Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2].

\n\n

Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n
Input: nums = [4,5,6,7,0,1,2], target = 0\nOutput: 4\n

Example 2:

\n
Input: nums = [4,5,6,7,0,1,2], target = 3\nOutput: -1\n

Example 3:

\n
Input: nums = [1], target = 0\nOutput: -1\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 5000
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • All values of nums are unique.
  • \n\t
  • nums is an ascending array that is possibly rotated.
  • \n\t
  • -104 <= target <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=4,5,6,7,0,1,2 --arg2=0", - "--arg1=4,5,6,7,0,1,2 --arg2=3", - "--arg1=1 --arg2=0" - ], - "sample_test_results": [ - "4", - "-1", - "-1" - ], - "hidden_test_cases": [ - "--arg1=3,1 --arg2=1", - "--arg1=1,3,5 --arg2=3", - "--arg1=5,1,2,3,4 --arg2=1", - "--arg1=4,5,6,7,0,1,2 --arg2=5", - "--arg1=1 --arg2=1", - "--arg1=1,3 --arg2=3", - "--arg1=3,5,1 --arg2=3", - "--arg1=5,1,3 --arg2=5", - "--arg1=4,5,6,7,8,1,2,3 --arg2=8", - "--arg1=1,2,3,4,5 --arg2=6" - ], - "hidden_test_results": [ - "1", - "1", - "1", - "1", - "0", - "1", - "0", - "0", - "4", - "-1" - ], - "boilerplate": { - "python": "class Solution:\n def search(self, nums: List[int], target: int) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int search(List nums, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int search(vector& nums, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return Integer.valueOf(result).equals(Integer.valueOf(expected));", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=U8XENwh8Oy8&pp=ygUnTmVldENvZGUgU2VhcmNoIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5" + "title": "Search in Rotated Sorted Array", + "source": "https://leetcode.com/problems/search-in-rotated-sorted-array/", + "description": "

There is an integer array nums sorted in ascending order (with distinct values).

\n\n

Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2].

\n\n

Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n
Input: nums = [4,5,6,7,0,1,2], target = 0\nOutput: 4\n

Example 2:

\n
Input: nums = [4,5,6,7,0,1,2], target = 3\nOutput: -1\n

Example 3:

\n
Input: nums = [1], target = 0\nOutput: -1\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 5000
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • All values of nums are unique.
  • \n\t
  • nums is an ascending array that is possibly rotated.
  • \n\t
  • -104 <= target <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[4,5,6,7,0,1,2] --arg2=0", + "--arg1=[4,5,6,7,0,1,2] --arg2=3", + "--arg1=[1] --arg2=0" + ], + "sample_test_results": [ + "4", + "-1", + "-1" + ], + "hidden_test_cases": [ + "--arg1=[3,1] --arg2=1", + "--arg1=[1,3,5] --arg2=3", + "--arg1=[5,1,2,3,4] --arg2=1", + "--arg1=[4,5,6,7,0,1,2] --arg2=5", + "--arg1=[1] --arg2=1", + "--arg1=[1,3] --arg2=3", + "--arg1=[3,5,1] --arg2=3", + "--arg1=[5,1,3] --arg2=5", + "--arg1=[4,5,6,7,8,1,2,3] --arg2=8", + "--arg1=[1,2,3,4,5] --arg2=6" + ], + "hidden_test_results": [ + "1", + "1", + "1", + "1", + "0", + "1", + "0", + "0", + "4", + "-1" + ], + "boilerplate": { + "python": "class Solution:\n def search(self, nums: List[int], target: int) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int search(List nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int search(vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return Integer.valueOf(result).equals(Integer.valueOf(expected));", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=U8XENwh8Oy8&pp=ygUnTmVldENvZGUgU2VhcmNoIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5", + "method_name": "search" }, { - "title": "Find First and Last Position of Element in Sorted Array", - "source": "https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/", - "description": "

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.

\n\n

If target is not found in the array, return [-1, -1].

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n
Input: nums = [5,7,7,8,8,10], target = 8\nOutput: [3,4]\n

Example 2:

\n
Input: nums = [5,7,7,8,8,10], target = 6\nOutput: [-1,-1]\n

Example 3:

\n
Input: nums = [], target = 0\nOutput: [-1,-1]\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • nums is a non-decreasing array.
  • \n\t
  • -109 <= target <= 109
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=5,7,7,8,8,10 --arg2=8", - "--arg1=5,7,7,8,8,10 --arg2=6", - "--arg1= --arg2=0" - ], - "sample_test_results": [ - "(3, 4)", - "(-1, -1)", - "(-1, -1)" - ], - "hidden_test_cases": [ - "--arg1=1 --arg2=1", - "--arg1=1,1,1,1 --arg2=1", - "--arg1=1,2,3,4,5 --arg2=3", - "--arg1=1,2,2,3,4,4,4 --arg2=4", - "--arg1=1,1,2 --arg2=2", - "--arg1=1 --arg2=2", - "--arg1=1,2,3 --arg2=4", - "--arg1=1,1,1,2,2,3 --arg2=2", - "--arg1=1,2,3,3,3,4,5 --arg2=3", - "--arg1=1,2,3,4,5,5,5,5,6 --arg2=5" - ], - "hidden_test_results": [ - "(0, 0)", - "(0, 3)", - "(2, 2)", - "(4, 6)", - "(2, 2)", - "(-1, -1)", - "(-1, -1)", - "(3, 4)", - "(2, 4)", - "(4, 7)" - ], - "boilerplate": { - "python": "class Solution:\n def searchRange(self, nums: List[int], target: int) -> List[int]:\n ", - "java": "class Solution {\n public int[] searchRange(int[] nums, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n vector searchRange(vector& nums, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "Object eval(String expression);\n\nObject resultVal = eval(result);\nObject expectedVal = eval(expected);\nreturn resultVal.equals(expectedVal);", - "cpp": "try {\n return result == std::stoi(expected);\n} catch (std::invalid_argument& e) {\n return false;\n} catch (std::out_of_range& e) {\n return false;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=4sQL7R5ySUU&pp=ygVATmVldENvZGUgRmluZCBGaXJzdCBhbmQgTGFzdCBQb3NpdGlvbiBvZiBFbGVtZW50IGluIFNvcnRlZCBBcnJheQ%3D%3D" + "title": "Find First and Last Position of Element in Sorted Array", + "source": "https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/", + "description": "

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.

\n\n

If target is not found in the array, return [-1, -1].

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n
Input: nums = [5,7,7,8,8,10], target = 8\nOutput: [3,4]\n

Example 2:

\n
Input: nums = [5,7,7,8,8,10], target = 6\nOutput: [-1,-1]\n

Example 3:

\n
Input: nums = [], target = 0\nOutput: [-1,-1]\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • nums is a non-decreasing array.
  • \n\t
  • -109 <= target <= 109
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[5,7,7,8,8,10] --arg2=8", + "--arg1=[5,7,7,8,8,10] --arg2=6", + "--arg1=[] --arg2=0" + ], + "sample_test_results": [ + "(3, 4)", + "(-1, -1)", + "(-1, -1)" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=1", + "--arg1=[1,1,1,1] --arg2=1", + "--arg1=[1,2,3,4,5] --arg2=3", + "--arg1=[1,2,2,3,4,4,4] --arg2=4", + "--arg1=[1,1,2] --arg2=2", + "--arg1=[1] --arg2=2", + "--arg1=[1,2,3] --arg2=4", + "--arg1=[1,1,1,2,2,3] --arg2=2", + "--arg1=[1,2,3,3,3,4,5] --arg2=3", + "--arg1=[1,2,3,4,5,5,5,5,6] --arg2=5" + ], + "hidden_test_results": [ + "(0, 0)", + "(0, 3)", + "(2, 2)", + "(4, 6)", + "(2, 2)", + "(-1, -1)", + "(-1, -1)", + "(3, 4)", + "(2, 4)", + "(4, 7)" + ], + "boilerplate": { + "python": "class Solution:\n def searchRange(self, nums: List[int], target: int) -> List[int]:\n ", + "java": "class Solution {\n public int[] searchRange(int[] nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector searchRange(vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "Object eval(String expression);\n\nObject resultVal = eval(result);\nObject expectedVal = eval(expected);\nreturn resultVal.equals(expectedVal);", + "cpp": "try {\n return result == std::stoi(expected);\n} catch (std::invalid_argument& e) {\n return false;\n} catch (std::out_of_range& e) {\n return false;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=4sQL7R5ySUU&pp=ygVATmVldENvZGUgRmluZCBGaXJzdCBhbmQgTGFzdCBQb3NpdGlvbiBvZiBFbGVtZW50IGluIFNvcnRlZCBBcnJheQ%3D%3D", + "method_name": "searchRange" }, { - "title": "Count and Say", - "source": "https://leetcode.com/problems/count-and-say/", - "description": "

The count-and-say sequence is a sequence of digit strings defined by the recursive formula:

\n\n
    \n\t
  • countAndSay(1) = "1"
  • \n\t
  • countAndSay(n) is the run-length encoding of countAndSay(n - 1).
  • \n
\n\n

Run-length encoding (RLE) is a string compression method that works by replacing consecutive identical characters (repeated 2 or more times) with the concatenation of the character and the number marking the count of the characters (length of the run). For example, to compress the string "3322251" we replace "33" with "23", replace "222" with "32", replace "5" with "15" and replace "1" with "11". Thus the compressed string becomes "23321511".

\n\n

Given a positive integer n, return the nth element of the count-and-say sequence.

\n\n

 

\n

Example 1:

\n\n
\n

Input: n = 4

\n\n

Output: "1211"

\n\n

Explanation:

\n\n
\ncountAndSay(1) = "1"\ncountAndSay(2) = RLE of "1" = "11"\ncountAndSay(3) = RLE of "11" = "21"\ncountAndSay(4) = RLE of "21" = "1211"\n
\n
\n\n

Example 2:

\n\n
\n

Input: n = 1

\n\n

Output: "1"

\n\n

Explanation:

\n\n

This is the base case.

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 30
  • \n
\n\n

 

\nFollow up: Could you solve it iteratively?", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=4", - "--arg1=1", - "--arg1=5" - ], - "sample_test_results": [ - "'1211'", - "'1'", - "'111221'" - ], - "hidden_test_cases": [ - "--arg1=2", - "--arg1=3", - "--arg1=6", - "--arg1=7", - "--arg1=8", - "--arg1=9", - "--arg1=10", - "--arg1=15", - "--arg1=20", - "--arg1=30" - ], - "hidden_test_results": [ - "'11'", - "'21'", - "'312211'", - "'13112221'", - "'1113213211'", - "'31131211131221'", - "'13211311123113112211'", - "'311311222113111231131112132112311321322112111312211312111322212311322113212221'", - "'11131221131211132221232112111312111213111213211231132132211211131221131211221321123113213221123113112221131112311332211211131221131211132211121312211231131112311211232221121321132132211331121321231231121113112221121321133112132112312321123113112221121113122113121113123112112322111213211322211312113211'", - "'3113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112212211131221121321131211132221123113112221131112311332211211133112111311222112111312211311123113322112111312211312111322212321121113121112133221121321132132211331121321132213211231132132211211131221232112111312212221121123222112311311222113111231133211121321321122111312211312111322211213211321322123211211131211121332211231131122211311123113321112131221123113111231121123222112111331121113112221121113122113111231133221121113122113121113221112131221123113111231121123222112111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321132132211322132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211322113321132211221121332211231131122211311123113321112131221123113111231121113311211131221121321131211132221123113112211121312211231131122211211133112111311222112111312211312111322211213211321223112111311222112132113213221133122211311221122111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321132132211322132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211322113321132211221121332211213211321322113311213212312311211131122211213211331121321123123211231131122211211131221131112311332211213211321223112111311222112132113213221123123211231132132211231131122211311123113322112111312211312111322111213122112311311123112112322211213211321322113312211223113112221121113122113111231133221121321132132211331222113321112131122211332113221122112133221123113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112311332111213122112311311123112112322211322311311222113111231133211121312211231131112311211232221121113122113121113222123211211131221132211131221121321131211132221123113112211121312211231131122113221122112133221121321132132211331121321231231121113121113122122311311222113111231133221121113122113121113221112131221123113111231121123222112132113213221133112132123123112111312211322311211133112111312211213211311123113223112111321322123122113222122211211232221121113122113121113222123211211131211121311121321123113213221121113122123211211131221121311121312211213211321322112311311222113311213212322211211131221131211221321123113213221121113122113121113222112131112131221121321131211132221121321132132211331121321232221123113112221131112311322311211131122211213211331121321122112133221121113122113121113222123112221221321132132211231131122211331121321232221121113122113121113222123211211131211121332211213111213122112132113121113222112132113213221232112111312111213322112132113213221133112132123123112111311222112132113311213211221121332211231131122211311123113321112131221123113112221132231131122211211131221131112311332211213211321223112111311222112132113212221132221222112112322211211131221131211132221232112111312111213111213211231131112311311221122132113213221133112132123222112311311222113111231132231121113112221121321133112132112211213322112111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121311121312211213211312111322211213211321322123211211131211121332211213211321322113311213211322132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321133112132112312321123113112221121113122113111231133221121321132122311211131122211213211321222113222122211211232221123113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112311332111213213211221113122113121113222112132113213221232112111312111213322112132113213221133112132123123112111312211322311211133112111312212221121123222112132113213221133112132123222113223113112221131112311332111213122112311311123112112322211211131221131211132221232112111312111213111213211231132132211211131221131211221321123113213221123113112221131112211322212322211231131122211322111312211312111322211213211321322113311213211331121113122122211211132213211231131122212322211331222113112211'" - ], - "boilerplate": { - "python": "class Solution:\n def countAndSay(self, n: int) -> str:\n ", - "java": "class Solution {\n public String countAndSay(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string countAndSay(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(evaluate(expected));\n// Implement the evaluate(String expression) function to parse and evaluate the expression within expected", - "cpp": "return result == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=iP4RH2zespg&pp=ygUWTmVldENvZGUgQ291bnQgYW5kIFNheQ%3D%3D" + "title": "Count and Say", + "source": "https://leetcode.com/problems/count-and-say/", + "description": "

The count-and-say sequence is a sequence of digit strings defined by the recursive formula:

\n\n
    \n\t
  • countAndSay(1) = "1"
  • \n\t
  • countAndSay(n) is the run-length encoding of countAndSay(n - 1).
  • \n
\n\n

Run-length encoding (RLE) is a string compression method that works by replacing consecutive identical characters (repeated 2 or more times) with the concatenation of the character and the number marking the count of the characters (length of the run). For example, to compress the string "3322251" we replace "33" with "23", replace "222" with "32", replace "5" with "15" and replace "1" with "11". Thus the compressed string becomes "23321511".

\n\n

Given a positive integer n, return the nth element of the count-and-say sequence.

\n\n

 

\n

Example 1:

\n\n
\n

Input: n = 4

\n\n

Output: "1211"

\n\n

Explanation:

\n\n
\ncountAndSay(1) = "1"\ncountAndSay(2) = RLE of "1" = "11"\ncountAndSay(3) = RLE of "11" = "21"\ncountAndSay(4) = RLE of "21" = "1211"\n
\n
\n\n

Example 2:

\n\n
\n

Input: n = 1

\n\n

Output: "1"

\n\n

Explanation:

\n\n

This is the base case.

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 30
  • \n
\n\n

 

\nFollow up: Could you solve it iteratively?", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=4", + "--arg1=1", + "--arg1=5" + ], + "sample_test_results": [ + "'1211'", + "'1'", + "'111221'" + ], + "hidden_test_cases": [ + "--arg1=2", + "--arg1=3", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9", + "--arg1=10", + "--arg1=15", + "--arg1=20", + "--arg1=30" + ], + "hidden_test_results": [ + "'11'", + "'21'", + "'312211'", + "'13112221'", + "'1113213211'", + "'31131211131221'", + "'13211311123113112211'", + "'311311222113111231131112132112311321322112111312211312111322212311322113212221'", + "'11131221131211132221232112111312111213111213211231132132211211131221131211221321123113213221123113112221131112311332211211131221131211132211121312211231131112311211232221121321132132211331121321231231121113112221121321133112132112312321123113112221121113122113121113123112112322111213211322211312113211'", + "'3113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112212211131221121321131211132221123113112221131112311332211211133112111311222112111312211311123113322112111312211312111322212321121113121112133221121321132132211331121321132213211231132132211211131221232112111312212221121123222112311311222113111231133211121321321122111312211312111322211213211321322123211211131211121332211231131122211311123113321112131221123113111231121123222112111331121113112221121113122113111231133221121113122113121113221112131221123113111231121123222112111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321132132211322132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211322113321132211221121332211231131122211311123113321112131221123113111231121113311211131221121321131211132221123113112211121312211231131122211211133112111311222112111312211312111322211213211321223112111311222112132113213221133122211311221122111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321132132211322132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211322113321132211221121332211213211321322113311213212312311211131122211213211331121321123123211231131122211211131221131112311332211213211321223112111311222112132113213221123123211231132132211231131122211311123113322112111312211312111322111213122112311311123112112322211213211321322113312211223113112221121113122113111231133221121321132132211331222113321112131122211332113221122112133221123113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112311332111213122112311311123112112322211322311311222113111231133211121312211231131112311211232221121113122113121113222123211211131221132211131221121321131211132221123113112211121312211231131122113221122112133221121321132132211331121321231231121113121113122122311311222113111231133221121113122113121113221112131221123113111231121123222112132113213221133112132123123112111312211322311211133112111312211213211311123113223112111321322123122113222122211211232221121113122113121113222123211211131211121311121321123113213221121113122123211211131221121311121312211213211321322112311311222113311213212322211211131221131211221321123113213221121113122113121113222112131112131221121321131211132221121321132132211331121321232221123113112221131112311322311211131122211213211331121321122112133221121113122113121113222123112221221321132132211231131122211331121321232221121113122113121113222123211211131211121332211213111213122112132113121113222112132113213221232112111312111213322112132113213221133112132123123112111311222112132113311213211221121332211231131122211311123113321112131221123113112221132231131122211211131221131112311332211213211321223112111311222112132113212221132221222112112322211211131221131211132221232112111312111213111213211231131112311311221122132113213221133112132123222112311311222113111231132231121113112221121321133112132112211213322112111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121311121312211213211312111322211213211321322123211211131211121332211213211321322113311213211322132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321133112132112312321123113112221121113122113111231133221121321132122311211131122211213211321222113222122211211232221123113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112311332111213213211221113122113121113222112132113213221232112111312111213322112132113213221133112132123123112111312211322311211133112111312212221121123222112132113213221133112132123222113223113112221131112311332111213122112311311123112112322211211131221131211132221232112111312111213111213211231132132211211131221131211221321123113213221123113112221131112211322212322211231131122211322111312211312111322211213211321322113311213211331121113122122211211132213211231131122212322211331222113112211'" + ], + "boilerplate": { + "python": "class Solution:\n def countAndSay(self, n: int) -> str:\n ", + "java": "class Solution {\n public String countAndSay(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string countAndSay(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(evaluate(expected));\n// Implement the evaluate(String expression) function to parse and evaluate the expression within expected", + "cpp": "return result == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=iP4RH2zespg&pp=ygUWTmVldENvZGUgQ291bnQgYW5kIFNheQ%3D%3D", + "method_name": "countAndSay" }, { - "title": "Combination Sum II", - "source": "https://leetcode.com/problems/combination-sum-ii/", - "description": "

Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target.

\n\n

Each number in candidates may only be used once in the combination.

\n\n

Note: The solution set must not contain duplicate combinations.

\n\n

 

\n

Example 1:

\n\n
\nInput: candidates = [10,1,2,7,6,1,5], target = 8\nOutput: \n[\n[1,1,6],\n[1,2,5],\n[1,7],\n[2,6]\n]\n
\n\n

Example 2:

\n\n
\nInput: candidates = [2,5,2,1,2], target = 5\nOutput: \n[\n[1,2,2],\n[5]\n]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= candidates.length <= 100
  • \n\t
  • 1 <= candidates[i] <= 50
  • \n\t
  • 1 <= target <= 30
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=10,1,2,7,6,1,5 --arg2=8", - "--arg1=2,5,2,1,2 --arg2=5", - "--arg1=1,1,1,1,1,1,1 --arg2=3" - ], - "sample_test_results": [ - "[1, 1, 6], [1, 2, 5], [1, 7], [2, 6]", - "[1, 2, 2], [5]", - "[1, 1, 1]" - ], - "hidden_test_cases": [ - "--arg1=1 --arg2=1", - "--arg1=1,2,3 --arg2=6", - "--arg1=1,1,1,2,2 --arg2=3", - "--arg1=10,20,30,40,50 --arg2=60", - "--arg1=2,2,2,2,2 --arg2=4", - "--arg1=1,2,3,4,5 --arg2=10", - "--arg1=1,1,1,1,1,1,1,1,1,1 --arg2=5", - "--arg1=5,4,3,2,1 --arg2=8", - "--arg1=10,1,2,7,6,1,5 --arg2=9", - "--arg1=1,2,2,2,2,2,3 --arg2=7" - ], - "hidden_test_results": [ - "[1]", - "[1, 2, 3]", - "[1, 1, 1], [1, 2]", - "[10, 20, 30], [10, 50], [20, 40]", - "[2, 2]", - "[1, 2, 3, 4], [1, 4, 5], [2, 3, 5]", - "[1, 1, 1, 1, 1]", - "[1, 2, 5], [1, 3, 4], [3, 5]", - "[1, 1, 2, 5], [1, 1, 7], [1, 2, 6], [2, 7]", - "[1, 2, 2, 2], [2, 2, 3]" - ], - "boilerplate": { - "python": "class Solution:\n def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:\n ", - "java": "class Solution {\n public List> combinationSum2(List candidates, int target) {\n // code goes here\n return null; // placeholder return value\n }\n}", - "cpp": "class Solution {\npublic:\n vector> combinationSum2(vector& candidates, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted([sorted(x) for x in result]) == eval(expected)", - "java": "Collections.sort(resultSet, new Comparator>() {\n @Override\n public int compare(List a, List b) {\n Collections.sort(a);\n Collections.sort(b);\n return a.equals(b) ? 0 : -1;\n }\n});\nreturn resultSet.equals(expectedSet);", - "cpp": "std::vector> sortNestedVectors(const std::vector>& v) {\n std::vector> sorted_v = v;\n for (auto& vec : sorted_v) {\n std::sort(vec.begin(), vec.end());\n }\n std::sort(sorted_v.begin(), sorted_v.end());\n return sorted_v;\n}\n\nbool compareFunction(const std::vector>& result, const std::string& expected) {\n std::vector> expected_vec;\n // Assuming a function `stringToVector` is defined to convert the string representation to a vector of vectors\n expected_vec = stringToVector(expected);\n return sortNestedVectors(result) == expected_vec;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=FOyRpNUSFeA&pp=ygUbTmVldENvZGUgQ29tYmluYXRpb24gU3VtIElJ" + "title": "Combination Sum II", + "source": "https://leetcode.com/problems/combination-sum-ii/", + "description": "

Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target.

\n\n

Each number in candidates may only be used once in the combination.

\n\n

Note: The solution set must not contain duplicate combinations.

\n\n

 

\n

Example 1:

\n\n
\nInput: candidates = [10,1,2,7,6,1,5], target = 8\nOutput: \n[\n[1,1,6],\n[1,2,5],\n[1,7],\n[2,6]\n]\n
\n\n

Example 2:

\n\n
\nInput: candidates = [2,5,2,1,2], target = 5\nOutput: \n[\n[1,2,2],\n[5]\n]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= candidates.length <= 100
  • \n\t
  • 1 <= candidates[i] <= 50
  • \n\t
  • 1 <= target <= 30
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[10,1,2,7,6,1,5] --arg2=8", + "--arg1=[2,5,2,1,2] --arg2=5", + "--arg1=[1,1,1,1,1,1,1] --arg2=3" + ], + "sample_test_results": [ + "[[1,1,6],[1,2,5],[1,7],[2,6]]", + "[[1,2,2],[5]]", + "[[1,1,1]]" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=1", + "--arg1=[1,2,3] --arg2=6", + "--arg1=[1,1,1,2,2] --arg2=3", + "--arg1=[10,20,30,40,50] --arg2=60", + "--arg1=[2,2,2,2,2] --arg2=4", + "--arg1=[1,2,3,4,5] --arg2=10", + "--arg1=[1,1,1,1,1,1,1,1,1,1] --arg2=5", + "--arg1=[5,4,3,2,1] --arg2=8", + "--arg1=[10,1,2,7,6,1,5] --arg2=9", + "--arg1=[1,2,2,2,2,2,3] --arg2=7" + ], + "hidden_test_results": [ + "[[1]]", + "[[1,2,3]]", + "[[1,1,1],[1,2]]", + "[[10,20,30],[10,50],[20,40]]", + "[[2,2]]", + "[[1,2,3,4],[1,4,5],[2,3,5]]", + "[[1,1,1,1,1]]", + "[[1,2,5],[1,3,4],[3,5]]", + "[[1,1,2,5],[1,1,7],[1,2,6],[2,7]]", + "[[1,2,2,2],[2,2,3]]" + ], + "boilerplate": { + "python": "class Solution:\n def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:\n ", + "java": "class Solution {\n public List> combinationSum2(List candidates, int target) {\n // code goes here\n return null; // placeholder return value\n }\n}", + "cpp": "class Solution {\npublic:\n vector> combinationSum2(vector& candidates, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted([sorted(x) for x in result]) == eval(expected)", + "java": "Collections.sort(resultSet, new Comparator>() {\n @Override\n public int compare(List a, List b) {\n Collections.sort(a);\n Collections.sort(b);\n return a.equals(b) ? 0 : -1;\n }\n});\nreturn resultSet.equals(expectedSet);", + "cpp": "std::vector> sortNestedVectors(const std::vector>& v) {\n std::vector> sorted_v = v;\n for (auto& vec : sorted_v) {\n std::sort(vec.begin(), vec.end());\n }\n std::sort(sorted_v.begin(), sorted_v.end());\n return sorted_v;\n}\n\nbool compareFunction(const std::vector>& result, const std::string& expected) {\n std::vector> expected_vec;\n // Assuming a function `stringToVector` is defined to convert the string representation to a vector of vectors\n expected_vec = stringToVector(expected);\n return sortNestedVectors(result) == expected_vec;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=FOyRpNUSFeA&pp=ygUbTmVldENvZGUgQ29tYmluYXRpb24gU3VtIElJ", + "method_name": "combinationSum2" }, { - "title": "Multiply Strings", - "source": "https://leetcode.com/problems/multiply-strings/", - "description": "

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

\n\n

Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.

\n\n

 

\n

Example 1:

\n
Input: num1 = \"2\", num2 = \"3\"\nOutput: \"6\"\n

Example 2:

\n
Input: num1 = \"123\", num2 = \"456\"\nOutput: \"56088\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num1.length, num2.length <= 200
  • \n\t
  • num1 and num2 consist of digits only.
  • \n\t
  • Both num1 and num2 do not contain any leading zero, except the number 0 itself.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=\"2\" --arg2=\"3\"", - "--arg1=\"123\" --arg2=\"456\"", - "--arg1=\"9999\" --arg2=\"9999\"" - ], - "sample_test_results": [ - "'6'", - "'56088'", - "'99980001'" - ], - "hidden_test_cases": [ - "--arg1=\"0\" --arg2=\"0\"", - "--arg1=\"1\" --arg2=\"1\"", - "--arg1=\"999\" --arg2=\"999\"", - "--arg1=\"1234\" --arg2=\"5678\"", - "--arg1=\"99999\" --arg2=\"99999\"", - "--arg1=\"123456789\" --arg2=\"987654321\"", - "--arg1=\"1000000\" --arg2=\"1000000\"", - "--arg1=\"11111111\" --arg2=\"11111111\"", - "--arg1=\"12345678901234567890\" --arg2=\"12345678901234567890\"", - "--arg1=\"0\" --arg2=\"1234567890\"" - ], - "hidden_test_results": [ - "'0'", - "'1'", - "'998001'", - "'7006652'", - "'9999800001'", - "'121932631112635269'", - "'1000000000000'", - "'123456787654321'", - "'152415787532388367501905199875019052100'", - "'0'" - ], - "boilerplate": { - "python": "class Solution:\n def multiply(self, num1: str, num2: str) -> str:\n ", - "java": "class Solution {\n public String multiply(String num1, String num2) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string multiply(string num1, string num2) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=1vZswirL8Y8&pp=ygUZTmVldENvZGUgTXVsdGlwbHkgU3RyaW5ncw%3D%3D" + "title": "Multiply Strings", + "source": "https://leetcode.com/problems/multiply-strings/", + "description": "

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

\n\n

Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.

\n\n

 

\n

Example 1:

\n
Input: num1 = \"2\", num2 = \"3\"\nOutput: \"6\"\n

Example 2:

\n
Input: num1 = \"123\", num2 = \"456\"\nOutput: \"56088\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num1.length, num2.length <= 200
  • \n\t
  • num1 and num2 consist of digits only.
  • \n\t
  • Both num1 and num2 do not contain any leading zero, except the number 0 itself.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=\"2\" --arg2=\"3\"", + "--arg1=\"123\" --arg2=\"456\"", + "--arg1=\"9999\" --arg2=\"9999\"" + ], + "sample_test_results": [ + "'6'", + "'56088'", + "'99980001'" + ], + "hidden_test_cases": [ + "--arg1=\"0\" --arg2=\"0\"", + "--arg1=\"1\" --arg2=\"1\"", + "--arg1=\"999\" --arg2=\"999\"", + "--arg1=\"1234\" --arg2=\"5678\"", + "--arg1=\"99999\" --arg2=\"99999\"", + "--arg1=\"123456789\" --arg2=\"987654321\"", + "--arg1=\"1000000\" --arg2=\"1000000\"", + "--arg1=\"11111111\" --arg2=\"11111111\"", + "--arg1=\"12345678901234567890\" --arg2=\"12345678901234567890\"", + "--arg1=\"0\" --arg2=\"1234567890\"" + ], + "hidden_test_results": [ + "'0'", + "'1'", + "'998001'", + "'7006652'", + "'9999800001'", + "'121932631112635269'", + "'1000000000000'", + "'123456787654321'", + "'152415787532388367501905199875019052100'", + "'0'" + ], + "boilerplate": { + "python": "class Solution:\n def multiply(self, num1: str, num2: str) -> str:\n ", + "java": "class Solution {\n public String multiply(String num1, String num2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string multiply(string num1, string num2) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=1vZswirL8Y8&pp=ygUZTmVldENvZGUgTXVsdGlwbHkgU3RyaW5ncw%3D%3D", + "method_name": "multiply" }, { - "title": "Jump Game II", - "source": "https://leetcode.com/problems/jump-game-ii/", - "description": "

You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0].

\n\n

Each element nums[i] represents the maximum length of a forward jump from index i. In other words, if you are at nums[i], you can jump to any nums[i + j] where:

\n\n
    \n\t
  • 0 <= j <= nums[i] and
  • \n\t
  • i + j < n
  • \n
\n\n

Return the minimum number of jumps to reach nums[n - 1]. The test cases are generated such that you can reach nums[n - 1].

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [2,3,1,1,4]\nOutput: 2\nExplanation: The minimum number of jumps to reach the last index is 2. Jump 1 step from index 0 to 1, then 3 steps to the last index.\n
\n\n

Example 2:

\n\n
\nInput: nums = [2,3,0,1,4]\nOutput: 2\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 104
  • \n\t
  • 0 <= nums[i] <= 1000
  • \n\t
  • It's guaranteed that you can reach nums[n - 1].
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=2,3,1,1,4", - "--arg1=2,3,0,1,4", - "--arg1=1,2,3,4,5" - ], - "sample_test_results": [ - "2", - "2", - "3" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=2,1", - "--arg1=1,1,1,1", - "--arg1=3,2,1", - "--arg1=1,2,1,1,1", - "--arg1=5,9,3,2,1,0,2,3,3,1,0,0", - "--arg1=1,2,3,4,5", - "--arg1=4,1,1,3,1,1,1", - "--arg1=1,1,1,1,1,1,1,1,1,1", - "--arg1=10,9,8,7,6,5,4,3,2,1" - ], - "hidden_test_results": [ - "0", - "1", - "3", - "1", - "3", - "3", - "3", - "2", - "9", - "1" - ], - "boilerplate": { - "python": "class Solution:\n def jump(self, nums: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int jump(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int jump(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=dJ7sWiOoK7g&pp=ygUVTmVldENvZGUgSnVtcCBHYW1lIElJ" + "title": "Jump Game II", + "source": "https://leetcode.com/problems/jump-game-ii/", + "description": "

You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0].

\n\n

Each element nums[i] represents the maximum length of a forward jump from index i. In other words, if you are at nums[i], you can jump to any nums[i + j] where:

\n\n
    \n\t
  • 0 <= j <= nums[i] and
  • \n\t
  • i + j < n
  • \n
\n\n

Return the minimum number of jumps to reach nums[n - 1]. The test cases are generated such that you can reach nums[n - 1].

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [2,3,1,1,4]\nOutput: 2\nExplanation: The minimum number of jumps to reach the last index is 2. Jump 1 step from index 0 to 1, then 3 steps to the last index.\n
\n\n

Example 2:

\n\n
\nInput: nums = [2,3,0,1,4]\nOutput: 2\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 104
  • \n\t
  • 0 <= nums[i] <= 1000
  • \n\t
  • It's guaranteed that you can reach nums[n - 1].
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[2,3,1,1,4]", + "--arg1=[2,3,0,1,4]", + "--arg1=[1,2,3,4,5]" + ], + "sample_test_results": [ + "2", + "2", + "3" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[2,1]", + "--arg1=[1,1,1,1]", + "--arg1=[3,2,1]", + "--arg1=[1,2,1,1,1]", + "--arg1=[5,9,3,2,1,0,2,3,3,1,0,0]", + "--arg1=[1,2,3,4,5]", + "--arg1=[4,1,1,3,1,1,1]", + "--arg1=[1,1,1,1,1,1,1,1,1,1]", + "--arg1=[10,9,8,7,6,5,4,3,2,1]" + ], + "hidden_test_results": [ + "0", + "1", + "3", + "1", + "3", + "3", + "3", + "2", + "9", + "1" + ], + "boilerplate": { + "python": "class Solution:\n def jump(self, nums: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int jump(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int jump(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=dJ7sWiOoK7g&pp=ygUVTmVldENvZGUgSnVtcCBHYW1lIElJ", + "method_name": "jump" }, { - "title": "Maximum Subarray", - "source": "https://leetcode.com/problems/maximum-subarray/", - "description": "

Given an integer array nums, find the subarray with the largest sum, and return its sum.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [-2,1,-3,4,-1,2,1,-5,4]\nOutput: 6\nExplanation: The subarray [4,-1,2,1] has the largest sum 6.\n
\n\n

Example 2:

\n\n
\nInput: nums = [1]\nOutput: 1\nExplanation: The subarray [1] has the largest sum 1.\n
\n\n

Example 3:

\n\n
\nInput: nums = [5,4,-1,7,8]\nOutput: 23\nExplanation: The subarray [5,4,-1,7,8] has the largest sum 23.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -104 <= nums[i] <= 104
  • \n
\n\n

 

\n

Follow up: If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle.

\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=-2,1,-3,4,-1,2,1,-5,4", - "--arg1=1", - "--arg1=5,4,-1,7,8" - ], - "sample_test_results": [ - "6", - "1", - "23" - ], - "hidden_test_cases": [ - "--arg1=-1", - "--arg1=-2,-1", - "--arg1=1,2,3,4,5", - "--arg1=-1,-2,-3,-4,-5", - "--arg1=1,-1,1,-1,1,-1", - "--arg1=-2,1,-3,4,-1,2,1,-5,4", - "--arg1=0,0,0,0", - "--arg1=-1,0,-2,2", - "--arg1=1,-2,3,-4,5,-6,7,-8", - "--arg1=-1,-1,2,-1,-1" - ], - "hidden_test_results": [ - "-1", - "-1", - "15", - "-1", - "1", - "6", - "0", - "2", - "7", - "2" - ], - "boilerplate": { - "python": "class Solution:\n def maxSubArray(self, nums: List[int]) -> int:\n ", - "java": "class Solution {\n public int maxSubArray(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maxSubArray(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=5WZl3MMT0Eg&pp=ygUZTmVldENvZGUgTWF4aW11bSBTdWJhcnJheQ%3D%3D" + "title": "Maximum Subarray", + "source": "https://leetcode.com/problems/maximum-subarray/", + "description": "

Given an integer array nums, find the subarray with the largest sum, and return its sum.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [-2,1,-3,4,-1,2,1,-5,4]\nOutput: 6\nExplanation: The subarray [4,-1,2,1] has the largest sum 6.\n
\n\n

Example 2:

\n\n
\nInput: nums = [1]\nOutput: 1\nExplanation: The subarray [1] has the largest sum 1.\n
\n\n

Example 3:

\n\n
\nInput: nums = [5,4,-1,7,8]\nOutput: 23\nExplanation: The subarray [5,4,-1,7,8] has the largest sum 23.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -104 <= nums[i] <= 104
  • \n
\n\n

 

\n

Follow up: If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle.

\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[-2,1,-3,4,-1,2,1,-5,4]", + "--arg1=[1]", + "--arg1=[5,4,-1,7,8]" + ], + "sample_test_results": [ + "6", + "1", + "23" + ], + "hidden_test_cases": [ + "--arg1=[-1]", + "--arg1=[-2,-1]", + "--arg1=[1,2,3,4,5]", + "--arg1=[-1,-2,-3,-4,-5]", + "--arg1=[1,-1,1,-1,1,-1]", + "--arg1=[-2,1,-3,4,-1,2,1,-5,4]", + "--arg1=[0,0,0,0]", + "--arg1=[-1,0,-2,2]", + "--arg1=[1,-2,3,-4,5,-6,7,-8]", + "--arg1=[-1,-1,2,-1,-1]" + ], + "hidden_test_results": [ + "-1", + "-1", + "15", + "-1", + "1", + "6", + "0", + "2", + "7", + "2" + ], + "boilerplate": { + "python": "class Solution:\n def maxSubArray(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int maxSubArray(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxSubArray(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=5WZl3MMT0Eg&pp=ygUZTmVldENvZGUgTWF4aW11bSBTdWJhcnJheQ%3D%3D", + "method_name": "maxSubArray" }, { - "title": "Spiral Matrix", - "source": "https://leetcode.com/problems/spiral-matrix/", - "description": "

Given an m x n matrix, return all elements of the matrix in spiral order.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [[1,2,3],[4,5,6],[7,8,9]]\nOutput: [1,2,3,6,9,8,7,4,5]\n
\n\n

Example 2:

\n\"\"\n
\nInput: matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]\nOutput: [1,2,3,4,8,12,11,10,9,5,6,7]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == matrix.length
  • \n\t
  • n == matrix[i].length
  • \n\t
  • 1 <= m, n <= 10
  • \n\t
  • -100 <= matrix[i][j] <= 100
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[1,2,3 --arg2=4,5,6 --arg3=7,8,9 --arg4=]", - "--arg1=[1,2,3,4 --arg2=5,6,7,8 --arg3=9,10,11,12 --arg4=]" - ], - "sample_test_results": [ - "1, 2, 3, 6, 9, 8, 7, 4, 5", - "1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7" - ], - "hidden_test_cases": [ - "--arg1=[1 --arg2=]", - "--arg1=[1,2 --arg2=3,4 --arg3=]", - "--arg1=[1,2,3 --arg2=]", - "--arg1=[1 --arg2=2 --arg3=3 --arg4=]", - "--arg1=[1,2,3,4 --arg2=5,6,7,8 --arg3=]", - "--arg1=[1,2 --arg2=3,4 --arg3=5,6 --arg4=]", - "--arg1=[ --arg2=]", - "--arg1=", - "--arg1=[1,2,3 --arg2=4,5,6 --arg3=]", - "--arg1=[1,2 --arg2=3,4 --arg3=5,6 --arg4=7,8 --arg5=]" - ], - "hidden_test_results": [ - "1", - "1, 2, 4, 3", - "1, 2, 3", - "1, 2, 3", - "1, 2, 3, 4, 8, 7, 6, 5", - "1, 2, 4, 6, 5, 3", - "", - "", - "1, 2, 3, 6, 5, 4", - "1, 2, 4, 6, 8, 7, 5, 3" - ], - "boilerplate": { - "python": "class Solution:\n def spiralOrder(self, matrix: List[List[int]]) -> List[int]:\n ", - "java": "import java.util.ArrayList;\nimport java.util.List;\n\nclass Solution {\n public List spiralOrder(int[][] matrix) {\n List result = new ArrayList<>();\n // Implement the logic here\n return result;\n }\n}\n", - "cpp": "class Solution {\npublic:\n vector spiralOrder(vector>& matrix) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=BJnMZNwUk1M&pp=ygUWTmVldENvZGUgU3BpcmFsIE1hdHJpeA%3D%3D" + "title": "Spiral Matrix", + "source": "https://leetcode.com/problems/spiral-matrix/", + "description": "

Given an m x n matrix, return all elements of the matrix in spiral order.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [[1,2,3],[4,5,6],[7,8,9]]\nOutput: [1,2,3,6,9,8,7,4,5]\n
\n\n

Example 2:

\n\"\"\n
\nInput: matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]\nOutput: [1,2,3,4,8,12,11,10,9,5,6,7]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == matrix.length
  • \n\t
  • n == matrix[i].length
  • \n\t
  • 1 <= m, n <= 10
  • \n\t
  • -100 <= matrix[i][j] <= 100
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[1,2,3],[4,5,6],[7,8,9]]", + "--arg1=[[1,2,3,4],[5,6,7,8],[9,10,11,12]]" + ], + "sample_test_results": [ + "[1,2,3,6,9,8,7,4,5]", + "[1,2,3,4,8,12,11,10,9,5,6,7]" + ], + "hidden_test_cases": [ + "--arg1=[[1]]", + "--arg1=[[1,2],[3,4]]", + "--arg1=[[1,2,3]]", + "--arg1=[[1],[2],[3]]", + "--arg1=[[1,2,3,4],[5,6,7,8]]", + "--arg1=[[1,2],[3,4],[5,6]]", + "--arg1=[[]]", + "--arg1=[]", + "--arg1=[[1,2,3],[4,5,6]]", + "--arg1=[[1,2],[3,4],[5,6],[7,8]]" + ], + "hidden_test_results": [ + "[1]", + "[1,2,4,3]", + "[1,2,3]", + "[1,2,3]", + "[1,2,3,4,8,7,6,5]", + "[1,2,4,6,5,3]", + "[]", + "[]", + "[1,2,3,6,5,4]", + "[1,2,4,6,8,7,5,3]" + ], + "boilerplate": { + "python": "class Solution:\n def spiralOrder(self, matrix: List[List[int]]) -> List[int]:\n ", + "java": "import java.util.ArrayList;\nimport java.util.List;\n\nclass Solution {\n public List spiralOrder(int[][] matrix) {\n List result = new ArrayList<>();\n // Implement the logic here\n return result;\n }\n}\n", + "cpp": "class Solution {\npublic:\n vector spiralOrder(vector>& matrix) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=BJnMZNwUk1M&pp=ygUWTmVldENvZGUgU3BpcmFsIE1hdHJpeA%3D%3D", + "method_name": "spiralOrder" }, { - "title": "Merge Intervals", - "source": "https://leetcode.com/problems/merge-intervals/", - "description": "

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.

\n\n

 

\n

Example 1:

\n\n
\nInput: intervals = [[1,3],[2,6],[8,10],[15,18]]\nOutput: [[1,6],[8,10],[15,18]]\nExplanation: Since intervals [1,3] and [2,6] overlap, merge them into [1,6].\n
\n\n

Example 2:

\n\n
\nInput: intervals = [[1,4],[4,5]]\nOutput: [[1,5]]\nExplanation: Intervals [1,4] and [4,5] are considered overlapping.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= intervals.length <= 104
  • \n\t
  • intervals[i].length == 2
  • \n\t
  • 0 <= starti <= endi <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[1,3 --arg2=2,6 --arg3=8,10 --arg4=15,18 --arg5=]", - "--arg1=[1,4 --arg2=4,5 --arg3=]" - ], - "sample_test_results": [ - "[1, 6], [8, 10], [15, 18]", - "[1, 5]" - ], - "hidden_test_cases": [ - "--arg1=[1,4 --arg2=0,4 --arg3=]", - "--arg1=[1,4 --arg2=2,3 --arg3=]", - "--arg1=[1,4 --arg2=0,0 --arg3=]", - "--arg1=[1,4 --arg2=]", - "--arg1=[1,4 --arg2=5,6 --arg3=]", - "--arg1=[1,10 --arg2=2,3 --arg3=4,5 --arg4=6,7 --arg5=8,9 --arg6=]", - "--arg1=[1,2 --arg2=2,3 --arg3=3,4 --arg4=4,5 --arg5=]", - "--arg1=[1,5 --arg2=2,3 --arg3=]", - "--arg1=[1,4 --arg2=1,5 --arg3=]", - "--arg1=[1,4 --arg2=4,6 --arg3=5,7 --arg4=6,8 --arg5=]" - ], - "hidden_test_results": [ - "[0, 4]", - "[1, 4]", - "[0, 0], [1, 4]", - "[1, 4]", - "[1, 4], [5, 6]", - "[1, 10]", - "[1, 5]", - "[1, 5]", - "[1, 5]", - "[1, 8]" - ], - "boilerplate": { - "python": "class Solution:\n def merge(self, intervals: List[List[int]]) -> List[List[int]]:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public List> merge(List> intervals) {\n \n return null;\n }\n}", - "cpp": "class Solution {\npublic:\n vector> merge(vector>& intervals) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(sorted(result)) == str(eval(expected))", - "java": "return Arrays.toString(Arrays.stream(result).sorted().toArray()).equals(Arrays.toString(eval(expected)));", - "cpp": "std::string resultStr;\nstd::string expectedStr;\nfor (const auto &elem : result) {\n resultStr += std::to_string(elem) + \",\";\n}\nexpectedStr = expected;\nreturn resultStr == expectedStr;" - }, - "explanation": "https://www.youtube.com/watch?v=44H3cEC2fFM&pp=ygUYTmVldENvZGUgTWVyZ2UgSW50ZXJ2YWxz" + "title": "Merge Intervals", + "source": "https://leetcode.com/problems/merge-intervals/", + "description": "

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.

\n\n

 

\n

Example 1:

\n\n
\nInput: intervals = [[1,3],[2,6],[8,10],[15,18]]\nOutput: [[1,6],[8,10],[15,18]]\nExplanation: Since intervals [1,3] and [2,6] overlap, merge them into [1,6].\n
\n\n

Example 2:

\n\n
\nInput: intervals = [[1,4],[4,5]]\nOutput: [[1,5]]\nExplanation: Intervals [1,4] and [4,5] are considered overlapping.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= intervals.length <= 104
  • \n\t
  • intervals[i].length == 2
  • \n\t
  • 0 <= starti <= endi <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[1,3],[2,6],[8,10],[15,18]]", + "--arg1=[[1,4],[4,5]]" + ], + "sample_test_results": [ + "[[1,6],[8,10],[15,18]]", + "[[1,5]]" + ], + "hidden_test_cases": [ + "--arg1=[[1,4],[0,4]]", + "--arg1=[[1,4],[2,3]]", + "--arg1=[[1,4],[0,0]]", + "--arg1=[[1,4]]", + "--arg1=[[1,4],[5,6]]", + "--arg1=[[1,10],[2,3],[4,5],[6,7],[8,9]]", + "--arg1=[[1,2],[2,3],[3,4],[4,5]]", + "--arg1=[[1,5],[2,3]]", + "--arg1=[[1,4],[1,5]]", + "--arg1=[[1,4],[4,6],[5,7],[6,8]]" + ], + "hidden_test_results": [ + "[[0,4]]", + "[[1,4]]", + "[[0,0],[1,4]]", + "[[1,4]]", + "[[1,4],[5,6]]", + "[[1,10]]", + "[[1,5]]", + "[[1,5]]", + "[[1,5]]", + "[[1,8]]" + ], + "boilerplate": { + "python": "class Solution:\n def merge(self, intervals: List[List[int]]) -> List[List[int]]:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public List> merge(List> intervals) {\n \n return null;\n }\n}", + "cpp": "class Solution {\npublic:\n vector> merge(vector>& intervals) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(sorted(result)) == str(eval(expected))", + "java": "return Arrays.toString(Arrays.stream(result).sorted().toArray()).equals(Arrays.toString(eval(expected)));", + "cpp": "std::string resultStr;\nstd::string expectedStr;\nfor (const auto &elem : result) {\n resultStr += std::to_string(elem) + \",\";\n}\nexpectedStr = expected;\nreturn resultStr == expectedStr;" + }, + "explanation": "https://www.youtube.com/watch?v=44H3cEC2fFM&pp=ygUYTmVldENvZGUgTWVyZ2UgSW50ZXJ2YWxz", + "method_name": "merge" }, { - "title": "Insert Interval", - "source": "https://leetcode.com/problems/insert-interval/", - "description": "

You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and intervals is sorted in ascending order by starti. You are also given an interval newInterval = [start, end] that represents the start and end of another interval.

\n\n

Insert newInterval into intervals such that intervals is still sorted in ascending order by starti and intervals still does not have any overlapping intervals (merge overlapping intervals if necessary).

\n\n

Return intervals after the insertion.

\n\n

Note that you don't need to modify intervals in-place. You can make a new array and return it.

\n\n

 

\n

Example 1:

\n\n
\nInput: intervals = [[1,3],[6,9]], newInterval = [2,5]\nOutput: [[1,5],[6,9]]\n
\n\n

Example 2:

\n\n
\nInput: intervals = [[1,2],[3,5],[6,7],[8,10],[12,16]], newInterval = [4,8]\nOutput: [[1,2],[3,10],[12,16]]\nExplanation: Because the new interval [4,8] overlaps with [3,5],[6,7],[8,10].\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= intervals.length <= 104
  • \n\t
  • intervals[i].length == 2
  • \n\t
  • 0 <= starti <= endi <= 105
  • \n\t
  • intervals is sorted by starti in ascending order.
  • \n\t
  • newInterval.length == 2
  • \n\t
  • 0 <= start <= end <= 105
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[1,3 --arg2=6,9 --arg3=] --arg4=[2 --arg5=5]", - "--arg1=[1,2 --arg2=3,5 --arg3=6,7 --arg4=8,10 --arg5=12,16 --arg6=] --arg7=[4 --arg8=8]" - ], - "sample_test_results": [ - "[1, 5], [6, 9]", - "[1, 2], [3, 10], [12, 16]" - ], - "hidden_test_cases": [ - "--arg1= --arg2=[5 --arg3=7]", - "--arg1=[1,5 --arg2=] --arg3=[2 --arg4=3]", - "--arg1=[1,5 --arg2=] --arg3=[2 --arg4=7]", - "--arg1=[1,5 --arg2=] --arg3=[6 --arg4=8]", - "--arg1=[1,5 --arg2=] --arg3=[0 --arg4=3]", - "--arg1=[3,5 --arg2=12,15 --arg3=] --arg4=[6 --arg5=6]", - "--arg1=[1,2 --arg2=3,5 --arg3=6,7 --arg4=8,10 --arg5=12,16 --arg6=] --arg7=[4 --arg8=8]", - "--arg1=[1,5 --arg2=] --arg3=[0 --arg4=0]", - "--arg1=[3,5 --arg2=12,15 --arg3=] --arg4=[1 --arg5=2]", - "--arg1=[1,5 --arg2=6,7 --arg3=] --arg4=[0 --arg5=8]" - ], - "hidden_test_results": [ - "[5, 7]", - "[1, 5]", - "[1, 7]", - "[1, 5], [6, 8]", - "[0, 5]", - "[3, 5], [6, 6], [12, 15]", - "[1, 2], [3, 10], [12, 16]", - "[0, 0], [1, 5]", - "[1, 2], [3, 5], [12, 15]", - "[0, 8]" - ], - "boilerplate": { - "python": "class Solution:\n def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List> insert(List> intervals, List newInterval) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n vector> insert(vector>& intervals, vector& newInterval) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(sorted(result)) == str(eval(expected))", - "java": "return Arrays.toString(Arrays.stream(result).sorted().toArray()).equals(evalExpected(expected));\n\nString evalExpected(String expected) {\n // Implement a method to evaluate the expected string\n // This may involve parsing the expected notation and constructing an equivalent Java object\n return someConstructedValue;\n}", - "cpp": "#include \n#include \n#include \n\nbool compareFunction(const std::vector& result, const std::string& expected) {\n std::vector sortedResult = result; // Make a copy of result\n std::sort(sortedResult.begin(), sortedResult.end()); // Sort the copy\n \n std::stringstream ss;\n ss << \"[\";\n for(size_t i = 0; i < sortedResult.size(); ++i) {\n ss << sortedResult[i];\n if (i != sortedResult.size() - 1) {\n ss << \", \";\n }\n }\n ss << \"]\";\n\n return ss.str() == expected;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=A8NUOmlwOlM&pp=ygUYTmVldENvZGUgSW5zZXJ0IEludGVydmFs" + "title": "Insert Interval", + "source": "https://leetcode.com/problems/insert-interval/", + "description": "

You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and intervals is sorted in ascending order by starti. You are also given an interval newInterval = [start, end] that represents the start and end of another interval.

\n\n

Insert newInterval into intervals such that intervals is still sorted in ascending order by starti and intervals still does not have any overlapping intervals (merge overlapping intervals if necessary).

\n\n

Return intervals after the insertion.

\n\n

Note that you don't need to modify intervals in-place. You can make a new array and return it.

\n\n

 

\n

Example 1:

\n\n
\nInput: intervals = [[1,3],[6,9]], newInterval = [2,5]\nOutput: [[1,5],[6,9]]\n
\n\n

Example 2:

\n\n
\nInput: intervals = [[1,2],[3,5],[6,7],[8,10],[12,16]], newInterval = [4,8]\nOutput: [[1,2],[3,10],[12,16]]\nExplanation: Because the new interval [4,8] overlaps with [3,5],[6,7],[8,10].\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= intervals.length <= 104
  • \n\t
  • intervals[i].length == 2
  • \n\t
  • 0 <= starti <= endi <= 105
  • \n\t
  • intervals is sorted by starti in ascending order.
  • \n\t
  • newInterval.length == 2
  • \n\t
  • 0 <= start <= end <= 105
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[1,3],[6,9]] --arg2=[2,5]", + "--arg1=[[1,2],[3,5],[6,7],[8,10],[12,16]] --arg2=[4,8]" + ], + "sample_test_results": [ + "[[1,5],[6,9]]", + "[[1,2],[3,10],[12,16]]" + ], + "hidden_test_cases": [ + "--arg1=[] --arg2=[5,7]", + "--arg1=[[1,5]] --arg2=[2,3]", + "--arg1=[[1,5]] --arg2=[2,7]", + "--arg1=[[1,5]] --arg2=[6,8]", + "--arg1=[[1,5]] --arg2=[0,3]", + "--arg1=[[3,5],[12,15]] --arg2=[6,6]", + "--arg1=[[1,2],[3,5],[6,7],[8,10],[12,16]] --arg2=[4,8]", + "--arg1=[[1,5]] --arg2=[0,0]", + "--arg1=[[3,5],[12,15]] --arg2=[1,2]", + "--arg1=[[1,5],[6,7]] --arg2=[0,8]" + ], + "hidden_test_results": [ + "[[5,7]]", + "[[1,5]]", + "[[1,7]]", + "[[1,5],[6,8]]", + "[[0,5]]", + "[[3,5],[6,6],[12,15]]", + "[[1,2],[3,10],[12,16]]", + "[[0,0],[1,5]]", + "[[1,2],[3,5],[12,15]]", + "[[0,8]]" + ], + "boilerplate": { + "python": "class Solution:\n def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List> insert(List> intervals, List newInterval) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector> insert(vector>& intervals, vector& newInterval) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(sorted(result)) == str(eval(expected))", + "java": "return Arrays.toString(Arrays.stream(result).sorted().toArray()).equals(evalExpected(expected));\n\nString evalExpected(String expected) {\n // Implement a method to evaluate the expected string\n // This may involve parsing the expected notation and constructing an equivalent Java object\n return someConstructedValue;\n}", + "cpp": "#include \n#include \n#include \n\nbool compareFunction(const std::vector& result, const std::string& expected) {\n std::vector sortedResult = result; // Make a copy of result\n std::sort(sortedResult.begin(), sortedResult.end()); // Sort the copy\n \n std::stringstream ss;\n ss << \"[\";\n for(size_t i = 0; i < sortedResult.size(); ++i) {\n ss << sortedResult[i];\n if (i != sortedResult.size() - 1) {\n ss << \", \";\n }\n }\n ss << \"]\";\n\n return ss.str() == expected;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=A8NUOmlwOlM&pp=ygUYTmVldENvZGUgSW5zZXJ0IEludGVydmFs", + "method_name": "insert" }, { - "title": "Unique Paths II", - "source": "https://leetcode.com/problems/unique-paths-ii/", - "description": "

You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time.

\n\n

An obstacle and space are marked as 1 or 0 respectively in grid. A path that the robot takes cannot include any square that is an obstacle.

\n\n

Return the number of possible unique paths that the robot can take to reach the bottom-right corner.

\n\n

The testcases are generated so that the answer will be less than or equal to 2 * 109.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: obstacleGrid = [[0,0,0],[0,1,0],[0,0,0]]\nOutput: 2\nExplanation: There is one obstacle in the middle of the 3x3 grid above.\nThere are two ways to reach the bottom-right corner:\n1. Right -> Right -> Down -> Down\n2. Down -> Down -> Right -> Right\n
\n\n

Example 2:

\n\"\"\n
\nInput: obstacleGrid = [[0,1],[0,0]]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == obstacleGrid.length
  • \n\t
  • n == obstacleGrid[i].length
  • \n\t
  • 1 <= m, n <= 100
  • \n\t
  • obstacleGrid[i][j] is 0 or 1.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[0,0,0 --arg2=0,1,0 --arg3=0,0,0 --arg4=]", - "--arg1=[0,1 --arg2=0,0 --arg3=]" - ], - "sample_test_results": [ - "2", - "1" - ], - "hidden_test_cases": [ - "--arg1=[0 --arg2=]", - "--arg1=[1 --arg2=]", - "--arg1=[0,0 --arg2=0,1 --arg3=]", - "--arg1=[0,0 --arg2=1,0 --arg3=]", - "--arg1=[0,0,0 --arg2=]", - "--arg1=[0 --arg2=0 --arg3=0 --arg4=]", - "--arg1=[1,0 --arg2=]", - "--arg1=[0,1 --arg2=1,0 --arg3=]", - "--arg1=[0,0,0,0 --arg2=0,1,0,0 --arg3=0,0,1,0 --arg4=0,0,0,0 --arg5=]", - "--arg1=[0,0,0 --arg2=0,0,0 --arg3=0,0,1 --arg4=]" - ], - "hidden_test_results": [ - "1", - "0", - "0", - "1", - "1", - "1", - "0", - "0", - "4", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:\n ", - "java": "class Solution {\n public int uniquePathsWithObstacles(int[][] obstacleGrid) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int uniquePathsWithObstacles(vector>& obstacleGrid) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=d3UOz7zdE4I&pp=ygUYTmVldENvZGUgVW5pcXVlIFBhdGhzIElJ" + "title": "Unique Paths II", + "source": "https://leetcode.com/problems/unique-paths-ii/", + "description": "

You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time.

\n\n

An obstacle and space are marked as 1 or 0 respectively in grid. A path that the robot takes cannot include any square that is an obstacle.

\n\n

Return the number of possible unique paths that the robot can take to reach the bottom-right corner.

\n\n

The testcases are generated so that the answer will be less than or equal to 2 * 109.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: obstacleGrid = [[0,0,0],[0,1,0],[0,0,0]]\nOutput: 2\nExplanation: There is one obstacle in the middle of the 3x3 grid above.\nThere are two ways to reach the bottom-right corner:\n1. Right -> Right -> Down -> Down\n2. Down -> Down -> Right -> Right\n
\n\n

Example 2:

\n\"\"\n
\nInput: obstacleGrid = [[0,1],[0,0]]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == obstacleGrid.length
  • \n\t
  • n == obstacleGrid[i].length
  • \n\t
  • 1 <= m, n <= 100
  • \n\t
  • obstacleGrid[i][j] is 0 or 1.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[0,0,0],[0,1,0],[0,0,0]]", + "--arg1=[[0,1],[0,0]]" + ], + "sample_test_results": [ + "2", + "1" + ], + "hidden_test_cases": [ + "--arg1=[[0]]", + "--arg1=[[1]]", + "--arg1=[[0,0],[0,1]]", + "--arg1=[[0,0],[1,0]]", + "--arg1=[[0,0,0]]", + "--arg1=[[0],[0],[0]]", + "--arg1=[[1,0]]", + "--arg1=[[0,1],[1,0]]", + "--arg1=[[0,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,0]]", + "--arg1=[[0,0,0],[0,0,0],[0,0,1]]" + ], + "hidden_test_results": [ + "1", + "0", + "0", + "1", + "1", + "1", + "0", + "0", + "4", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:\n ", + "java": "class Solution {\n public int uniquePathsWithObstacles(int[][] obstacleGrid) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int uniquePathsWithObstacles(vector>& obstacleGrid) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=d3UOz7zdE4I&pp=ygUYTmVldENvZGUgVW5pcXVlIFBhdGhzIElJ", + "method_name": "uniquePathsWithObstacles" }, { - "title": "Simplify Path", - "source": "https://leetcode.com/problems/simplify-path/", - "description": "

You are given an absolute path for a Unix-style file system, which always begins with a slash '/'. Your task is to transform this absolute path into its simplified canonical path.

\n\n

The rules of a Unix-style file system are as follows:

\n\n
    \n\t
  • A single period '.' represents the current directory.
  • \n\t
  • A double period '..' represents the previous/parent directory.
  • \n\t
  • Multiple consecutive slashes such as '//' and '///' are treated as a single slash '/'.
  • \n\t
  • Any sequence of periods that does not match the rules above should be treated as a valid directory or file name. For example, '...' and '....' are valid directory or file names.
  • \n
\n\n

The simplified canonical path should follow these rules:

\n\n
    \n\t
  • The path must start with a single slash '/'.
  • \n\t
  • Directories within the path must be separated by exactly one slash '/'.
  • \n\t
  • The path must not end with a slash '/', unless it is the root directory.
  • \n\t
  • The path must not have any single or double periods ('.' and '..') used to denote current or parent directories.
  • \n
\n\n

Return the simplified canonical path.

\n\n

 

\n

Example 1:

\n\n
\n

Input: path = "/home/"

\n\n

Output: "/home"

\n\n

Explanation:

\n\n

The trailing slash should be removed.

\n
\n\n

Example 2:

\n\n
\n

Input: path = "/home//foo/"

\n\n

Output: "/home/foo"

\n\n

Explanation:

\n\n

Multiple consecutive slashes are replaced by a single one.

\n
\n\n

Example 3:

\n\n
\n

Input: path = "/home/user/Documents/../Pictures"

\n\n

Output: "/home/user/Pictures"

\n\n

Explanation:

\n\n

A double period ".." refers to the directory up a level (the parent directory).

\n
\n\n

Example 4:

\n\n
\n

Input: path = "/../"

\n\n

Output: "/"

\n\n

Explanation:

\n\n

Going one level up from the root directory is not possible.

\n
\n\n

Example 5:

\n\n
\n

Input: path = "/.../a/../b/c/../d/./"

\n\n

Output: "/.../b/d"

\n\n

Explanation:

\n\n

"..." is a valid name for a directory in this problem.

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= path.length <= 3000
  • \n\t
  • path consists of English letters, digits, period '.', slash '/' or '_'.
  • \n\t
  • path is a valid absolute Unix path.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=\"/home/\"", - "--arg1=\"/home//foo/\"", - "--arg1=\"/home/user/Documents/../Pictures\"", - "--arg1=\"/../\"", - "--arg1=\"/.../a/../b/c/../d/./\"" - ], - "sample_test_results": [ - "'/home'", - "'/home/foo'", - "'/home/user/Pictures'", - "'/'", - "'/.../b/d'" - ], - "hidden_test_cases": [ - "--arg1=\"/a/./b/../../c/\"", - "--arg1=\"/home/\"", - "--arg1=\"/...\"", - "--arg1=\"/..hidden\"", - "--arg1=\"//\"", - "--arg1=\"/a//b////c/d//././/..\"", - "--arg1=\"/abc/...\"", - "--arg1=\"/a/./b/./c/./d/\"", - "--arg1=\"/a/../../b/../c//.//\"", - "--arg1=\"/a//b//./c/d/\"" - ], - "hidden_test_results": [ - "'/c'", - "'/home'", - "'/...'", - "'/..hidden'", - "'/'", - "'/a/b/c'", - "'/abc/...'", - "'/a/b/c/d'", - "'/c'", - "'/a/b/c/d'" - ], - "boilerplate": { - "python": "class Solution:\n def simplifyPath(self, path: str) -> str:\n ", - "java": "class Solution {\n public String simplifyPath(String path) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string simplifyPath(string path) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=qYlHrAKJfyA&pp=ygUWTmVldENvZGUgU2ltcGxpZnkgUGF0aA%3D%3D" + "title": "Simplify Path", + "source": "https://leetcode.com/problems/simplify-path/", + "description": "

You are given an absolute path for a Unix-style file system, which always begins with a slash '/'. Your task is to transform this absolute path into its simplified canonical path.

\n\n

The rules of a Unix-style file system are as follows:

\n\n
    \n\t
  • A single period '.' represents the current directory.
  • \n\t
  • A double period '..' represents the previous/parent directory.
  • \n\t
  • Multiple consecutive slashes such as '//' and '///' are treated as a single slash '/'.
  • \n\t
  • Any sequence of periods that does not match the rules above should be treated as a valid directory or file name. For example, '...' and '....' are valid directory or file names.
  • \n
\n\n

The simplified canonical path should follow these rules:

\n\n
    \n\t
  • The path must start with a single slash '/'.
  • \n\t
  • Directories within the path must be separated by exactly one slash '/'.
  • \n\t
  • The path must not end with a slash '/', unless it is the root directory.
  • \n\t
  • The path must not have any single or double periods ('.' and '..') used to denote current or parent directories.
  • \n
\n\n

Return the simplified canonical path.

\n\n

 

\n

Example 1:

\n\n
\n

Input: path = "/home/"

\n\n

Output: "/home"

\n\n

Explanation:

\n\n

The trailing slash should be removed.

\n
\n\n

Example 2:

\n\n
\n

Input: path = "/home//foo/"

\n\n

Output: "/home/foo"

\n\n

Explanation:

\n\n

Multiple consecutive slashes are replaced by a single one.

\n
\n\n

Example 3:

\n\n
\n

Input: path = "/home/user/Documents/../Pictures"

\n\n

Output: "/home/user/Pictures"

\n\n

Explanation:

\n\n

A double period ".." refers to the directory up a level (the parent directory).

\n
\n\n

Example 4:

\n\n
\n

Input: path = "/../"

\n\n

Output: "/"

\n\n

Explanation:

\n\n

Going one level up from the root directory is not possible.

\n
\n\n

Example 5:

\n\n
\n

Input: path = "/.../a/../b/c/../d/./"

\n\n

Output: "/.../b/d"

\n\n

Explanation:

\n\n

"..." is a valid name for a directory in this problem.

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= path.length <= 3000
  • \n\t
  • path consists of English letters, digits, period '.', slash '/' or '_'.
  • \n\t
  • path is a valid absolute Unix path.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=\"/home/\"", + "--arg1=\"/home//foo/\"", + "--arg1=\"/home/user/Documents/../Pictures\"", + "--arg1=\"/../\"", + "--arg1=\"/.../a/../b/c/../d/./\"" + ], + "sample_test_results": [ + "'/home'", + "'/home/foo'", + "'/home/user/Pictures'", + "'/'", + "'/.../b/d'" + ], + "hidden_test_cases": [ + "--arg1=\"/a/./b/../../c/\"", + "--arg1=\"/home/\"", + "--arg1=\"/...\"", + "--arg1=\"/..hidden\"", + "--arg1=\"//\"", + "--arg1=\"/a//b////c/d//././/..\"", + "--arg1=\"/abc/...\"", + "--arg1=\"/a/./b/./c/./d/\"", + "--arg1=\"/a/../../b/../c//.//\"", + "--arg1=\"/a//b//./c/d/\"" + ], + "hidden_test_results": [ + "'/c'", + "'/home'", + "'/...'", + "'/..hidden'", + "'/'", + "'/a/b/c'", + "'/abc/...'", + "'/a/b/c/d'", + "'/c'", + "'/a/b/c/d'" + ], + "boilerplate": { + "python": "class Solution:\n def simplifyPath(self, path: str) -> str:\n ", + "java": "class Solution {\n public String simplifyPath(String path) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string simplifyPath(string path) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=qYlHrAKJfyA&pp=ygUWTmVldENvZGUgU2ltcGxpZnkgUGF0aA%3D%3D", + "method_name": "simplifyPath" }, { - "title": "Edit Distance", - "source": "https://leetcode.com/problems/edit-distance/", - "description": "

Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.

\n\n

You have the following three operations permitted on a word:

\n\n
    \n\t
  • Insert a character
  • \n\t
  • Delete a character
  • \n\t
  • Replace a character
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: word1 = "horse", word2 = "ros"\nOutput: 3\nExplanation: \nhorse -> rorse (replace 'h' with 'r')\nrorse -> rose (remove 'r')\nrose -> ros (remove 'e')\n
\n\n

Example 2:

\n\n
\nInput: word1 = "intention", word2 = "execution"\nOutput: 5\nExplanation: \nintention -> inention (remove 't')\ninention -> enention (replace 'i' with 'e')\nenention -> exention (replace 'n' with 'x')\nexention -> exection (replace 'n' with 'c')\nexection -> execution (insert 'u')\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= word1.length, word2.length <= 500
  • \n\t
  • word1 and word2 consist of lowercase English letters.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1='horse' --arg2='ros'", - "--arg1='intention' --arg2='execution'", - "--arg1='' --arg2='a'" - ], - "sample_test_results": [ - "3", - "5", - "1" - ], - "hidden_test_cases": [ - "--arg1='' --arg2=''", - "--arg1='a' --arg2=''", - "--arg1='abc' --arg2='abc'", - "--arg1='abcde' --arg2='ace'", - "--arg1='sea' --arg2='eat'", - "--arg1='leetcode' --arg2='practice'", - "--arg1='hello' --arg2='world'", - "--arg1='pneumonoultramicroscopicsilicovolcanoconiosis' --arg2='ultramicroscopically'", - "--arg1='abc' --arg2='def'", - "--arg1='aaa' --arg2='bbb'" - ], - "hidden_test_results": [ - "0", - "1", - "0", - "2", - "2", - "7", - "4", - "27", - "3", - "3" - ], - "boilerplate": { - "python": "class Solution:\n def minDistance(self, word1: str, word2: str) -> int:\n ", - "java": "class Solution {\n public int minDistance(String word1, String word2) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int minDistance(string word1, string word2) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=XYi2-LPrwm4&pp=ygUWTmVldENvZGUgRWRpdCBEaXN0YW5jZQ%3D%3D" + "title": "Edit Distance", + "source": "https://leetcode.com/problems/edit-distance/", + "description": "

Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.

\n\n

You have the following three operations permitted on a word:

\n\n
    \n\t
  • Insert a character
  • \n\t
  • Delete a character
  • \n\t
  • Replace a character
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: word1 = "horse", word2 = "ros"\nOutput: 3\nExplanation: \nhorse -> rorse (replace 'h' with 'r')\nrorse -> rose (remove 'r')\nrose -> ros (remove 'e')\n
\n\n

Example 2:

\n\n
\nInput: word1 = "intention", word2 = "execution"\nOutput: 5\nExplanation: \nintention -> inention (remove 't')\ninention -> enention (replace 'i' with 'e')\nenention -> exention (replace 'n' with 'x')\nexention -> exection (replace 'n' with 'c')\nexection -> execution (insert 'u')\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= word1.length, word2.length <= 500
  • \n\t
  • word1 and word2 consist of lowercase English letters.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1='horse' --arg2='ros'", + "--arg1='intention' --arg2='execution'", + "--arg1='' --arg2='a'" + ], + "sample_test_results": [ + "3", + "5", + "1" + ], + "hidden_test_cases": [ + "--arg1='' --arg2=''", + "--arg1='a' --arg2=''", + "--arg1='abc' --arg2='abc'", + "--arg1='abcde' --arg2='ace'", + "--arg1='sea' --arg2='eat'", + "--arg1='leetcode' --arg2='practice'", + "--arg1='hello' --arg2='world'", + "--arg1='pneumonoultramicroscopicsilicovolcanoconiosis' --arg2='ultramicroscopically'", + "--arg1='abc' --arg2='def'", + "--arg1='aaa' --arg2='bbb'" + ], + "hidden_test_results": [ + "0", + "1", + "0", + "2", + "2", + "7", + "4", + "27", + "3", + "3" + ], + "boilerplate": { + "python": "class Solution:\n def minDistance(self, word1: str, word2: str) -> int:\n ", + "java": "class Solution {\n public int minDistance(String word1, String word2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int minDistance(string word1, string word2) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=XYi2-LPrwm4&pp=ygUWTmVldENvZGUgRWRpdCBEaXN0YW5jZQ%3D%3D", + "method_name": "minDistance" }, { - "title": "Search a 2D Matrix", - "source": "https://leetcode.com/problems/search-a-2d-matrix/", - "description": "

You are given an m x n integer matrix matrix with the following two properties:

\n\n
    \n\t
  • Each row is sorted in non-decreasing order.
  • \n\t
  • The first integer of each row is greater than the last integer of the previous row.
  • \n
\n\n

Given an integer target, return true if target is in matrix or false otherwise.

\n\n

You must write a solution in O(log(m * n)) time complexity.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3\nOutput: true\n
\n\n

Example 2:

\n\"\"\n
\nInput: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == matrix.length
  • \n\t
  • n == matrix[i].length
  • \n\t
  • 1 <= m, n <= 100
  • \n\t
  • -104 <= matrix[i][j], target <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[1,3,5,7 --arg2=10,11,16,20 --arg3=23,30,34,60 --arg4=] --arg5=3", - "--arg1=[1,3,5,7 --arg2=10,11,16,20 --arg3=23,30,34,60 --arg4=] --arg5=13", - "--arg1=[1 --arg2=] --arg3=1" - ], - "sample_test_results": [ - "True", - "False", - "True" - ], - "hidden_test_cases": [ - "--arg1=[1 --arg2=] --arg3=2", - "--arg1=[1,2,3 --arg2=] --arg3=2", - "--arg1=[1 --arg2=2 --arg3=3 --arg4=] --arg5=2", - "--arg1=[1,2 --arg2=3,4 --arg3=] --arg4=4", - "--arg1=[-10,-8 --arg2=15,20 --arg3=] --arg4=-8", - "--arg1=[1,2,3,4 --arg2=5,6,7,8 --arg3=] --arg4=6", - "--arg1=[1,2,3 --arg2=4,5,6 --arg3=7,8,9 --arg4=] --arg5=9", - "--arg1=[1 --arg2=] --arg3=0", - "--arg1=[1,3,5 --arg2=] --arg3=5", - "--arg1=[1 --arg2=3 --arg3=5 --arg4=] --arg5=3" - ], - "hidden_test_results": [ - "False", - "True", - "True", - "True", - "True", - "True", - "True", - "False", - "True", - "True" - ], - "boilerplate": { - "python": "class Solution:\n def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public boolean searchMatrix(List> matrix, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool searchMatrix(std::vector>& matrix, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) == std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" - }, - "explanation": "https://www.youtube.com/watch?v=Ber2pi2C0j0&pp=ygUbTmVldENvZGUgU2VhcmNoIGEgMkQgTWF0cml4" + "title": "Search a 2D Matrix", + "source": "https://leetcode.com/problems/search-a-2d-matrix/", + "description": "

You are given an m x n integer matrix matrix with the following two properties:

\n\n
    \n\t
  • Each row is sorted in non-decreasing order.
  • \n\t
  • The first integer of each row is greater than the last integer of the previous row.
  • \n
\n\n

Given an integer target, return true if target is in matrix or false otherwise.

\n\n

You must write a solution in O(log(m * n)) time complexity.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3\nOutput: true\n
\n\n

Example 2:

\n\"\"\n
\nInput: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == matrix.length
  • \n\t
  • n == matrix[i].length
  • \n\t
  • 1 <= m, n <= 100
  • \n\t
  • -104 <= matrix[i][j], target <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[1,3,5,7],[10,11,16,20],[23,30,34,60]] --arg2=3", + "--arg1=[[1,3,5,7],[10,11,16,20],[23,30,34,60]] --arg2=13", + "--arg1=[[1]] --arg2=1" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=[[1]] --arg2=2", + "--arg1=[[1,2,3]] --arg2=2", + "--arg1=[[1],[2],[3]] --arg2=2", + "--arg1=[[1,2],[3,4]] --arg2=4", + "--arg1=[[-10,-8],[15,20]] --arg2=-8", + "--arg1=[[1,2,3,4],[5,6,7,8]] --arg2=6", + "--arg1=[[1,2,3],[4,5,6],[7,8,9]] --arg2=9", + "--arg1=[[1]] --arg2=0", + "--arg1=[[1,3,5]] --arg2=5", + "--arg1=[[1],[3],[5]] --arg2=3" + ], + "hidden_test_results": [ + "false", + "true", + "true", + "true", + "true", + "true", + "true", + "false", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public boolean searchMatrix(List> matrix, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool searchMatrix(std::vector>& matrix, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) == std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" + }, + "explanation": "https://www.youtube.com/watch?v=Ber2pi2C0j0&pp=ygUbTmVldENvZGUgU2VhcmNoIGEgMkQgTWF0cml4", + "method_name": "searchMatrix" }, { - "title": "Word Search", - "source": "https://leetcode.com/problems/word-search/", - "description": "

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

\n\n

The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"\nOutput: true\n
\n\n

Example 2:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "SEE"\nOutput: true\n
\n\n

Example 3:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB"\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == board.length
  • \n\t
  • n = board[i].length
  • \n\t
  • 1 <= m, n <= 6
  • \n\t
  • 1 <= word.length <= 15
  • \n\t
  • board and word consists of only lowercase and uppercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you use search pruning to make your solution faster with a larger board?

\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=['A','B','C','E' --arg2='S','F','C','S' --arg3='A','D','E','E' --arg4=] --arg5='ABCCED'", - "--arg1=['A','B','C','E' --arg2='S','F','C','S' --arg3='A','D','E','E' --arg4=] --arg5='SEE'", - "--arg1=['A','B','C','E' --arg2='S','F','C','S' --arg3='A','D','E','E' --arg4=] --arg5='ABCB'" - ], - "sample_test_results": [ - "True", - "True", - "False" - ], - "hidden_test_cases": [ - "--arg1=['A' --arg2=] --arg3='A'", - "--arg1=['A','B' --arg2='C','D' --arg3=] --arg4='ABDC'", - "--arg1=['A','B' --arg2=] --arg3='BA'", - "--arg1=['A','B','C' --arg2='D','E','F' --arg3=] --arg4='CBA'", - "--arg1=['A' --arg2=] --arg3='B'", - "--arg1=['A','A' --arg2=] --arg3='AAA'", - "--arg1=['A','B','C' --arg2=] --arg3='ABC'", - "--arg1=['A' --arg2='B' --arg3='C' --arg4=] --arg5='ABC'", - "--arg1=['A','B' --arg2='C','D' --arg3=] --arg4='AC'", - "--arg1=['A','B','C' --arg2='D','E','F' --arg3='G','H','I' --arg4=] --arg5='ABCFIHG'" - ], - "hidden_test_results": [ - "True", - "True", - "True", - "True", - "False", - "False", - "True", - "True", - "True", - "True" - ], - "boilerplate": { - "python": "class Solution:\n def exist(self, board: List[List[str]], word: str) -> bool:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public boolean exist(List> board, String word) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool exist(vector>& board, string word) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return toLowerCase(result) == toLowerCase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=pfiQ_PS1g8E&pp=ygUUTmVldENvZGUgV29yZCBTZWFyY2g%3D" + "title": "Word Search", + "source": "https://leetcode.com/problems/word-search/", + "description": "

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

\n\n

The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"\nOutput: true\n
\n\n

Example 2:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "SEE"\nOutput: true\n
\n\n

Example 3:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB"\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == board.length
  • \n\t
  • n = board[i].length
  • \n\t
  • 1 <= m, n <= 6
  • \n\t
  • 1 <= word.length <= 15
  • \n\t
  • board and word consists of only lowercase and uppercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you use search pruning to make your solution faster with a larger board?

\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[['A','B','C','E'],['S','F','C','S'],['A','D','E','E']] --arg2='ABCCED'", + "--arg1=[['A','B','C','E'],['S','F','C','S'],['A','D','E','E']] --arg2='SEE'", + "--arg1=[['A','B','C','E'],['S','F','C','S'],['A','D','E','E']] --arg2='ABCB'" + ], + "sample_test_results": [ + "true", + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1=[['A']] --arg2='A'", + "--arg1=[['A','B'],['C','D']] --arg2='ABDC'", + "--arg1=[['A','B']] --arg2='BA'", + "--arg1=[['A','B','C'],['D','E','F']] --arg2='CBA'", + "--arg1=[['A']] --arg2='B'", + "--arg1=[['A','A']] --arg2='AAA'", + "--arg1=[['A','B','C']] --arg2='ABC'", + "--arg1=[['A'],['B'],['C']] --arg2='ABC'", + "--arg1=[['A','B'],['C','D']] --arg2='AC'", + "--arg1=[['A','B','C'],['D','E','F'],['G','H','I']] --arg2='ABCFIHG'" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "false", + "false", + "true", + "true", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def exist(self, board: List[List[str]], word: str) -> bool:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public boolean exist(List> board, String word) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool exist(vector>& board, string word) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return toLowerCase(result) == toLowerCase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=pfiQ_PS1g8E&pp=ygUUTmVldENvZGUgV29yZCBTZWFyY2g%3D", + "method_name": "exist" }, { - "title": "Subsets II", - "source": "https://leetcode.com/problems/subsets-ii/", - "description": "

Given an integer array nums that may contain duplicates, return all possible subsets (the power set).

\n\n

The solution set must not contain duplicate subsets. Return the solution in any order.

\n\n

 

\n

Example 1:

\n
Input: nums = [1,2,2]\nOutput: [[],[1],[1,2],[1,2,2],[2],[2,2]]\n

Example 2:

\n
Input: nums = [0]\nOutput: [[],[0]]\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 10
  • \n\t
  • -10 <= nums[i] <= 10
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=1,2,2", - "--arg1=0", - "--arg1=1,1,1" - ], - "sample_test_results": [ - "[], [1], [1, 2], [1, 2, 2], [2], [2, 2]", - "[], [0]", - "[], [1], [1, 1], [1, 1, 1]" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=1,2", - "--arg1=1,2,3", - "--arg1=2,2,2,2", - "--arg1=1,2,2,3", - "--arg1=1,1,2,2", - "--arg1=3,2,1", - "--arg1=-1,0,1", - "--arg1=0,0,0", - "--arg1=4,4,4,1,4" - ], - "hidden_test_results": [ - "[], [1]", - "[], [1], [1, 2], [2]", - "[], [1], [1, 2], [1, 2, 3], [1, 3], [2], [2, 3], [3]", - "[], [2], [2, 2], [2, 2, 2], [2, 2, 2, 2]", - "[], [1], [1, 2], [1, 2, 2], [1, 2, 2, 3], [1, 2, 3], [1, 3], [2], [2, 2], [2, 2, 3], [2, 3], [3]", - "[], [1], [1, 1], [1, 1, 2], [1, 1, 2, 2], [1, 2], [1, 2, 2], [2], [2, 2]", - "[], [1], [1, 2], [1, 2, 3], [1, 3], [2], [2, 3], [3]", - "[], [-1], [-1, 0], [-1, 0, 1], [-1, 1], [0], [0, 1], [1]", - "[], [0], [0, 0], [0, 0, 0]", - "[], [1], [1, 4], [1, 4, 4], [1, 4, 4, 4], [1, 4, 4, 4, 4], [4], [4, 4], [4, 4, 4], [4, 4, 4, 4]" - ], - "boilerplate": { - "python": "class Solution:\n def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:\n ", - "java": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nclass Solution {\n public List> subsetsWithDup(int[] nums) {\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector> subsetsWithDup(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted([sorted(x) for x in result]) == sorted(eval(expected))", - "java": "List> sortedResult = new ArrayList<>();\nfor (List list : result) {\n List sortedList = new ArrayList<>(list);\n Collections.sort(sortedList);\n sortedResult.add(sortedList);\n}\nCollections.sort(sortedResult, new Comparator>() {\n public int compare(List o1, List o2) {\n for (int i = 0; i < Math.min(o1.size(), o2.size()); i++) {\n if (!o1.get(i).equals(o2.get(i))) {\n return o1.get(i) - o2.get(i);\n }\n }\n return o1.size() - o2.size();\n }\n});\n\nList> sortedExpected = new ArrayList<>();\nfor (List list : expected) {\n List sortedList = new ArrayList<>(list);\n Collections.sort(sortedList);\n sortedExpected.add(sortedList);\n}\nCollections.sort(sortedExpected, new Comparator>() {\n public int compare(List o1, List o2) {\n for (int i = 0; i < Math.min(o1.size(), o2.size()); i++) {\n if (!o1.get(i).equals(o2.get(i))) {\n return o1.get(i) - o2.get(i);\n }\n }\n return o1.size() - o2.size();\n }\n});\n\nreturn sortedResult.equals(sortedExpected);", - "cpp": "vector> sortNestedVector(const vector> &vecs) {\n vector> sortedVecs = vecs;\n for (auto &vec : sortedVecs) {\n sort(vec.begin(), vec.end());\n }\n sort(sortedVecs.begin(), sortedVecs.end());\n return sortedVecs;\n}\n\nvector> evalExpected(const string &expected) {\n vector> evalVecs; // This needs to be implemented to match Python's eval behavior\n // Some parsing logic or a mock function would be here to convert `expected` to a vector of vectors\n return evalVecs;\n}\n\ncompareFunction(const vector> &result, const string &expected) {\n vector> sortedResult = sortNestedVector(result);\n vector> sortedExpected = sortNestedVector(evalExpected(expected));\n return sortedResult == sortedExpected;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=Vn2v6ajA7U0&pp=ygUTTmVldENvZGUgU3Vic2V0cyBJSQ%3D%3D" + "title": "Subsets II", + "source": "https://leetcode.com/problems/subsets-ii/", + "description": "

Given an integer array nums that may contain duplicates, return all possible subsets (the power set).

\n\n

The solution set must not contain duplicate subsets. Return the solution in any order.

\n\n

 

\n

Example 1:

\n
Input: nums = [1,2,2]\nOutput: [[],[1],[1,2],[1,2,2],[2],[2,2]]\n

Example 2:

\n
Input: nums = [0]\nOutput: [[],[0]]\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 10
  • \n\t
  • -10 <= nums[i] <= 10
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[1,2,2]", + "--arg1=[0]", + "--arg1=[1,1,1]" + ], + "sample_test_results": [ + "[[],[1],[1,2],[1,2,2],[2],[2,2]]", + "[[],[0]]", + "[[],[1],[1,1],[1,1,1]]" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,2]", + "--arg1=[1,2,3]", + "--arg1=[2,2,2,2]", + "--arg1=[1,2,2,3]", + "--arg1=[1,1,2,2]", + "--arg1=[3,2,1]", + "--arg1=[-1,0,1]", + "--arg1=[0,0,0]", + "--arg1=[4,4,4,1,4]" + ], + "hidden_test_results": [ + "[[],[1]]", + "[[],[1],[1,2],[2]]", + "[[],[1],[1,2],[1,2,3],[1,3],[2],[2,3],[3]]", + "[[],[2],[2,2],[2,2,2],[2,2,2,2]]", + "[[],[1],[1,2],[1,2,2],[1,2,2,3],[1,2,3],[1,3],[2],[2,2],[2,2,3],[2,3],[3]]", + "[[],[1],[1,1],[1,1,2],[1,1,2,2],[1,2],[1,2,2],[2],[2,2]]", + "[[],[1],[1,2],[1,2,3],[1,3],[2],[2,3],[3]]", + "[[],[-1],[-1,0],[-1,0,1],[-1,1],[0],[0,1],[1]]", + "[[],[0],[0,0],[0,0,0]]", + "[[],[1],[1,4],[1,4,4],[1,4,4,4],[1,4,4,4,4],[4],[4,4],[4,4,4],[4,4,4,4]]" + ], + "boilerplate": { + "python": "class Solution:\n def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:\n ", + "java": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nclass Solution {\n public List> subsetsWithDup(int[] nums) {\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector> subsetsWithDup(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted([sorted(x) for x in result]) == sorted(eval(expected))", + "java": "List> sortedResult = new ArrayList<>();\nfor (List list : result) {\n List sortedList = new ArrayList<>(list);\n Collections.sort(sortedList);\n sortedResult.add(sortedList);\n}\nCollections.sort(sortedResult, new Comparator>() {\n public int compare(List o1, List o2) {\n for (int i = 0; i < Math.min(o1.size(), o2.size()); i++) {\n if (!o1.get(i).equals(o2.get(i))) {\n return o1.get(i) - o2.get(i);\n }\n }\n return o1.size() - o2.size();\n }\n});\n\nList> sortedExpected = new ArrayList<>();\nfor (List list : expected) {\n List sortedList = new ArrayList<>(list);\n Collections.sort(sortedList);\n sortedExpected.add(sortedList);\n}\nCollections.sort(sortedExpected, new Comparator>() {\n public int compare(List o1, List o2) {\n for (int i = 0; i < Math.min(o1.size(), o2.size()); i++) {\n if (!o1.get(i).equals(o2.get(i))) {\n return o1.get(i) - o2.get(i);\n }\n }\n return o1.size() - o2.size();\n }\n});\n\nreturn sortedResult.equals(sortedExpected);", + "cpp": "vector> sortNestedVector(const vector> &vecs) {\n vector> sortedVecs = vecs;\n for (auto &vec : sortedVecs) {\n sort(vec.begin(), vec.end());\n }\n sort(sortedVecs.begin(), sortedVecs.end());\n return sortedVecs;\n}\n\nvector> evalExpected(const string &expected) {\n vector> evalVecs; // This needs to be implemented to match Python's eval behavior\n // Some parsing logic or a mock function would be here to convert `expected` to a vector of vectors\n return evalVecs;\n}\n\ncompareFunction(const vector> &result, const string &expected) {\n vector> sortedResult = sortNestedVector(result);\n vector> sortedExpected = sortNestedVector(evalExpected(expected));\n return sortedResult == sortedExpected;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=Vn2v6ajA7U0&pp=ygUTTmVldENvZGUgU3Vic2V0cyBJSQ%3D%3D", + "method_name": "subsetsWithDup" }, { - "title": "Restore IP Addresses", - "source": "https://leetcode.com/problems/restore-ip-addresses/", - "description": "

A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclusive) and cannot have leading zeros.

\n\n
    \n\t
  • For example, "0.1.2.201" and "192.168.1.1" are valid IP addresses, but "0.011.255.245", "192.168.1.312" and "192.168@1.1" are invalid IP addresses.
  • \n
\n\n

Given a string s containing only digits, return all possible valid IP addresses that can be formed by inserting dots into s. You are not allowed to reorder or remove any digits in s. You may return the valid IP addresses in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "25525511135"\nOutput: ["255.255.11.135","255.255.111.35"]\n
\n\n

Example 2:

\n\n
\nInput: s = "0000"\nOutput: ["0.0.0.0"]\n
\n\n

Example 3:

\n\n
\nInput: s = "101023"\nOutput: ["1.0.10.23","1.0.102.3","10.1.0.23","10.10.2.3","101.0.2.3"]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 20
  • \n\t
  • s consists of digits only.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1='25525511135'", - "--arg1='0000'", - "--arg1='101023'" - ], - "sample_test_results": [ - "'255.255.11.135', '255.255.111.35'", - "'0.0.0.0'", - "'1.0.10.23', '1.0.102.3', '10.1.0.23', '10.10.2.3', '101.0.2.3'" - ], - "hidden_test_cases": [ - "--arg1='1111'", - "--arg1='010010'", - "--arg1='0'", - "--arg1='999999'", - "--arg1='1921680'", - "--arg1='2552551113'", - "--arg1='00001'", - "--arg1='100100'", - "--arg1='12345'", - "--arg1='1111111'" - ], - "hidden_test_results": [ - "'1.1.1.1'", - "'0.10.0.10', '0.100.1.0'", - "", - "'9.9.99.99', '9.99.9.99', '9.99.99.9', '99.9.9.99', '99.9.99.9', '99.99.9.9'", - "'1.9.216.80', '1.92.16.80', '1.92.168.0', '19.2.16.80', '19.2.168.0', '19.21.6.80', '19.21.68.0', '19.216.8.0', '192.1.6.80', '192.1.68.0', '192.16.8.0'", - "'255.25.51.113', '255.255.1.113', '255.255.11.13', '255.255.111.3'", - "", - "'1.0.0.100', '10.0.10.0', '100.1.0.0'", - "'1.2.3.45', '1.2.34.5', '1.23.4.5', '12.3.4.5'", - "'1.1.11.111', '1.1.111.11', '1.11.1.111', '1.11.11.11', '1.11.111.1', '1.111.1.11', '1.111.11.1', '11.1.1.111', '11.1.11.11', '11.1.111.1', '11.11.1.11', '11.11.11.1', '11.111.1.1', '111.1.1.11', '111.1.11.1', '111.11.1.1'" - ], - "boilerplate": { - "python": "class Solution:\n def restoreIpAddresses(self, s: str) -> List[str]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List restoreIpAddresses(String s) {\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector restoreIpAddresses(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray())", - "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedSorted = eval(expected);\nstd::sort(expectedSorted.begin(), expectedSorted.end());\nreturn result == expectedSorted;" - }, - "explanation": "https://www.youtube.com/watch?v=61tN4YEdiTM&pp=ygUdTmVldENvZGUgUmVzdG9yZSBJUCBBZGRyZXNzZXM%3D" + "title": "Restore IP Addresses", + "source": "https://leetcode.com/problems/restore-ip-addresses/", + "description": "

A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclusive) and cannot have leading zeros.

\n\n
    \n\t
  • For example, "0.1.2.201" and "192.168.1.1" are valid IP addresses, but "0.011.255.245", "192.168.1.312" and "192.168@1.1" are invalid IP addresses.
  • \n
\n\n

Given a string s containing only digits, return all possible valid IP addresses that can be formed by inserting dots into s. You are not allowed to reorder or remove any digits in s. You may return the valid IP addresses in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "25525511135"\nOutput: ["255.255.11.135","255.255.111.35"]\n
\n\n

Example 2:

\n\n
\nInput: s = "0000"\nOutput: ["0.0.0.0"]\n
\n\n

Example 3:

\n\n
\nInput: s = "101023"\nOutput: ["1.0.10.23","1.0.102.3","10.1.0.23","10.10.2.3","101.0.2.3"]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 20
  • \n\t
  • s consists of digits only.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1='25525511135'", + "--arg1='0000'", + "--arg1='101023'" + ], + "sample_test_results": [ + "['255.255.11.135','255.255.111.35']", + "['0.0.0.0']", + "['1.0.10.23','1.0.102.3','10.1.0.23','10.10.2.3','101.0.2.3']" + ], + "hidden_test_cases": [ + "--arg1='1111'", + "--arg1='010010'", + "--arg1='0'", + "--arg1='999999'", + "--arg1='1921680'", + "--arg1='2552551113'", + "--arg1='00001'", + "--arg1='100100'", + "--arg1='12345'", + "--arg1='1111111'" + ], + "hidden_test_results": [ + "['1.1.1.1']", + "['0.10.0.10','0.100.1.0']", + "[]", + "['9.9.99.99','9.99.9.99','9.99.99.9','99.9.9.99','99.9.99.9','99.99.9.9']", + "['1.9.216.80','1.92.16.80','1.92.168.0','19.2.16.80','19.2.168.0','19.21.6.80','19.21.68.0','19.216.8.0','192.1.6.80','192.1.68.0','192.16.8.0']", + "['255.25.51.113','255.255.1.113','255.255.11.13','255.255.111.3']", + "[]", + "['1.0.0.100','10.0.10.0','100.1.0.0']", + "['1.2.3.45','1.2.34.5','1.23.4.5','12.3.4.5']", + "['1.1.11.111','1.1.111.11','1.11.1.111','1.11.11.11','1.11.111.1','1.111.1.11','1.111.11.1','11.1.1.111','11.1.11.11','11.1.111.1','11.11.1.11','11.11.11.1','11.111.1.1','111.1.1.11','111.1.11.1','111.11.1.1']" + ], + "boilerplate": { + "python": "class Solution:\n def restoreIpAddresses(self, s: str) -> List[str]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List restoreIpAddresses(String s) {\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n vector restoreIpAddresses(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray())", + "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedSorted = eval(expected);\nstd::sort(expectedSorted.begin(), expectedSorted.end());\nreturn result == expectedSorted;" + }, + "explanation": "https://www.youtube.com/watch?v=61tN4YEdiTM&pp=ygUdTmVldENvZGUgUmVzdG9yZSBJUCBBZGRyZXNzZXM%3D", + "method_name": "restoreIpAddresses" }, { - "title": "Interleaving String", - "source": "https://leetcode.com/problems/interleaving-string/", - "description": "

Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2.

\n\n

An interleaving of two strings s and t is a configuration where s and t are divided into n and m substrings respectively, such that:

\n\n
    \n\t
  • s = s1 + s2 + ... + sn
  • \n\t
  • t = t1 + t2 + ... + tm
  • \n\t
  • |n - m| <= 1
  • \n\t
  • The interleaving is s1 + t1 + s2 + t2 + s3 + t3 + ... or t1 + s1 + t2 + s2 + t3 + s3 + ...
  • \n
\n\n

Note: a + b is the concatenation of strings a and b.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"\nOutput: true\nExplanation: One way to obtain s3 is:\nSplit s1 into s1 = "aa" + "bc" + "c", and s2 into s2 = "dbbc" + "a".\nInterleaving the two splits, we get "aa" + "dbbc" + "bc" + "a" + "c" = "aadbbcbcac".\nSince s3 can be obtained by interleaving s1 and s2, we return true.\n
\n\n

Example 2:

\n\n
\nInput: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc"\nOutput: false\nExplanation: Notice how it is impossible to interleave s2 with any other string to obtain s3.\n
\n\n

Example 3:

\n\n
\nInput: s1 = "", s2 = "", s3 = ""\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s1.length, s2.length <= 100
  • \n\t
  • 0 <= s3.length <= 200
  • \n\t
  • s1, s2, and s3 consist of lowercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you solve it using only O(s2.length) additional memory space?

\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1='aabcc' --arg2='dbbca' --arg3='aadbbcbcac'", - "--arg1='aabcc' --arg2='dbbca' --arg3='aadbbbaccc'", - "--arg1='' --arg2='' --arg3=''" - ], - "sample_test_results": [ - "True", - "False", - "True" - ], - "hidden_test_cases": [ - "--arg1='abc' --arg2='def' --arg3='adbecf'", - "--arg1='a' --arg2='b' --arg3='ab'", - "--arg1='a' --arg2='b' --arg3='ba'", - "--arg1='aa' --arg2='ab' --arg3='aaba'", - "--arg1='aaa' --arg2='bbb' --arg3='ababab'", - "--arg1='' --arg2='abc' --arg3='abc'", - "--arg1='abc' --arg2='' --arg3='abc'", - "--arg1='abc' --arg2='def' --arg3='abcdef'", - "--arg1='aaa' --arg2='aaa' --arg3='aaaaaa'", - "--arg1='abc' --arg2='def' --arg3='abcef'" - ], - "hidden_test_results": [ - "True", - "True", - "True", - "True", - "True", - "True", - "True", - "True", - "True", - "False" - ], - "boilerplate": { - "python": "class Solution:\n def isInterleave(self, s1: str, s2: str, s3: str) -> bool:\n ", - "java": "class Solution {\n public boolean isInterleave(String s1, String s2, String s3) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isInterleave(string s1, string s2, string s3) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return to_lowercase(result) == to_lowercase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=3Rw3p9LrgvE&pp=ygUcTmVldENvZGUgSW50ZXJsZWF2aW5nIFN0cmluZw%3D%3D" + "title": "Interleaving String", + "source": "https://leetcode.com/problems/interleaving-string/", + "description": "

Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2.

\n\n

An interleaving of two strings s and t is a configuration where s and t are divided into n and m substrings respectively, such that:

\n\n
    \n\t
  • s = s1 + s2 + ... + sn
  • \n\t
  • t = t1 + t2 + ... + tm
  • \n\t
  • |n - m| <= 1
  • \n\t
  • The interleaving is s1 + t1 + s2 + t2 + s3 + t3 + ... or t1 + s1 + t2 + s2 + t3 + s3 + ...
  • \n
\n\n

Note: a + b is the concatenation of strings a and b.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"\nOutput: true\nExplanation: One way to obtain s3 is:\nSplit s1 into s1 = "aa" + "bc" + "c", and s2 into s2 = "dbbc" + "a".\nInterleaving the two splits, we get "aa" + "dbbc" + "bc" + "a" + "c" = "aadbbcbcac".\nSince s3 can be obtained by interleaving s1 and s2, we return true.\n
\n\n

Example 2:

\n\n
\nInput: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc"\nOutput: false\nExplanation: Notice how it is impossible to interleave s2 with any other string to obtain s3.\n
\n\n

Example 3:

\n\n
\nInput: s1 = "", s2 = "", s3 = ""\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s1.length, s2.length <= 100
  • \n\t
  • 0 <= s3.length <= 200
  • \n\t
  • s1, s2, and s3 consist of lowercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you solve it using only O(s2.length) additional memory space?

\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1='aabcc' --arg2='dbbca' --arg3='aadbbcbcac'", + "--arg1='aabcc' --arg2='dbbca' --arg3='aadbbbaccc'", + "--arg1='' --arg2='' --arg3=''" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1='abc' --arg2='def' --arg3='adbecf'", + "--arg1='a' --arg2='b' --arg3='ab'", + "--arg1='a' --arg2='b' --arg3='ba'", + "--arg1='aa' --arg2='ab' --arg3='aaba'", + "--arg1='aaa' --arg2='bbb' --arg3='ababab'", + "--arg1='' --arg2='abc' --arg3='abc'", + "--arg1='abc' --arg2='' --arg3='abc'", + "--arg1='abc' --arg2='def' --arg3='abcdef'", + "--arg1='aaa' --arg2='aaa' --arg3='aaaaaa'", + "--arg1='abc' --arg2='def' --arg3='abcef'" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "true", + "true", + "true", + "true", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isInterleave(self, s1: str, s2: str, s3: str) -> bool:\n ", + "java": "class Solution {\n public boolean isInterleave(String s1, String s2, String s3) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isInterleave(string s1, string s2, string s3) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return to_lowercase(result) == to_lowercase(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=3Rw3p9LrgvE&pp=ygUcTmVldENvZGUgSW50ZXJsZWF2aW5nIFN0cmluZw%3D%3D", + "method_name": "isInterleave" }, { - "title": "Triangle", - "source": "https://leetcode.com/problems/triangle/", - "description": "

Given a triangle array, return the minimum path sum from top to bottom.

\n\n

For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i + 1 on the next row.

\n\n

 

\n

Example 1:

\n\n
\nInput: triangle = [[2],[3,4],[6,5,7],[4,1,8,3]]\nOutput: 11\nExplanation: The triangle looks like:\n   2\n  3 4\n 6 5 7\n4 1 8 3\nThe minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11 (underlined above).\n
\n\n

Example 2:

\n\n
\nInput: triangle = [[-10]]\nOutput: -10\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= triangle.length <= 200
  • \n\t
  • triangle[0].length == 1
  • \n\t
  • triangle[i].length == triangle[i - 1].length + 1
  • \n\t
  • -104 <= triangle[i][j] <= 104
  • \n
\n\n

 

\nFollow up: Could you do this using only O(n) extra space, where n is the total number of rows in the triangle?", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[2 --arg2=3,4 --arg3=6,5,7 --arg4=4,1,8,3 --arg5=]", - "--arg1=[-10 --arg2=]" - ], - "sample_test_results": [ - "11", - "-10" - ], - "hidden_test_cases": [ - "--arg1=[1 --arg2=]", - "--arg1=[1 --arg2=2,3 --arg3=]", - "--arg1=[-1 --arg2=2,3 --arg3=1,-1,3 --arg4=]", - "--arg1=[1 --arg2=1,2 --arg3=1,2,3 --arg4=1,2,3,4 --arg5=]", - "--arg1=[0 --arg2=-1,2 --arg3=1,-2,3 --arg4=-3,1,-1,2 --arg5=]", - "--arg1=[1 --arg2=-5,2 --arg3=2,-1,3 --arg4=1,2,-4,5 --arg5=]", - "--arg1=[0 --arg2=0,0 --arg3=0,0,0 --arg4=]", - "--arg1=[1 --arg2=-1,-2 --arg3=3,-3,1 --arg4=-4,5,-6,2 --arg5=]", - "--arg1=[10 --arg2=-2,-3 --arg3=1,2,-1 --arg4=]", - "--arg1=[1 --arg2=2,1 --arg3=3,3,1 --arg4=]" - ], - "hidden_test_results": [ - "1", - "3", - "0", - "4", - "-4", - "-9", - "0", - "-10", - "6", - "3" - ], - "boilerplate": { - "python": "class Solution:\n def minimumTotal(self, triangle: List[List[int]]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int minimumTotal(List> triangle) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int minimumTotal(vector>& triangle) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=OM1MTokvxs4&pp=ygURTmVldENvZGUgVHJpYW5nbGU%3D" + "title": "Triangle", + "source": "https://leetcode.com/problems/triangle/", + "description": "

Given a triangle array, return the minimum path sum from top to bottom.

\n\n

For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i + 1 on the next row.

\n\n

 

\n

Example 1:

\n\n
\nInput: triangle = [[2],[3,4],[6,5,7],[4,1,8,3]]\nOutput: 11\nExplanation: The triangle looks like:\n   2\n  3 4\n 6 5 7\n4 1 8 3\nThe minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11 (underlined above).\n
\n\n

Example 2:

\n\n
\nInput: triangle = [[-10]]\nOutput: -10\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= triangle.length <= 200
  • \n\t
  • triangle[0].length == 1
  • \n\t
  • triangle[i].length == triangle[i - 1].length + 1
  • \n\t
  • -104 <= triangle[i][j] <= 104
  • \n
\n\n

 

\nFollow up: Could you do this using only O(n) extra space, where n is the total number of rows in the triangle?", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[2],[3,4],[6,5,7],[4,1,8,3]]", + "--arg1=[[-10]]" + ], + "sample_test_results": [ + "11", + "-10" + ], + "hidden_test_cases": [ + "--arg1=[[1]]", + "--arg1=[[1],[2,3]]", + "--arg1=[[-1],[2,3],[1,-1,3]]", + "--arg1=[[1],[1,2],[1,2,3],[1,2,3,4]]", + "--arg1=[[0],[-1,2],[1,-2,3],[-3,1,-1,2]]", + "--arg1=[[1],[-5,2],[2,-1,3],[1,2,-4,5]]", + "--arg1=[[0],[0,0],[0,0,0]]", + "--arg1=[[1],[-1,-2],[3,-3,1],[-4,5,-6,2]]", + "--arg1=[[10],[-2,-3],[1,2,-1]]", + "--arg1=[[1],[2,1],[3,3,1]]" + ], + "hidden_test_results": [ + "1", + "3", + "0", + "4", + "-4", + "-9", + "0", + "-10", + "6", + "3" + ], + "boilerplate": { + "python": "class Solution:\n def minimumTotal(self, triangle: List[List[int]]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int minimumTotal(List> triangle) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int minimumTotal(vector>& triangle) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=OM1MTokvxs4&pp=ygURTmVldENvZGUgVHJpYW5nbGU%3D", + "method_name": "minimumTotal" }, { - "title": "Longest Consecutive Sequence", - "source": "https://leetcode.com/problems/longest-consecutive-sequence/", - "description": "

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.

\n\n

You must write an algorithm that runs in O(n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [100,4,200,1,3,2]\nOutput: 4\nExplanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,3,7,2,5,8,4,6,0,1]\nOutput: 9\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=100,4,200,1,3,2", - "--arg1=0,3,7,2,5,8,4,6,0,1" - ], - "sample_test_results": [ - "4", - "9" - ], - "hidden_test_cases": [ - "--arg1=", - "--arg1=1", - "--arg1=1,2,3,4,5", - "--arg1=1,3,5,7,9", - "--arg1=-5,-4,-3,-2,-1", - "--arg1=1,1,1,1,1", - "--arg1=1,2,0,1", - "--arg1=0,-1,2,-2,3,-3", - "--arg1=1000,1,2,3,4,999", - "--arg1=5,4,3,2,1,6,7,8,9" - ], - "hidden_test_results": [ - "0", - "1", - "5", - "1", - "5", - "1", - "3", - "4", - "4", - "9" - ], - "boilerplate": { - "python": "class Solution:\n def longestConsecutive(self, nums: List[int]) -> int:\n ", - "java": "import java.util.List;\nimport java.util.HashSet;\n\nclass Solution {\n public int longestConsecutive(List nums) {\n \n }\n}", - "cpp": "#include \n#include \n\nclass Solution {\npublic:\n int longestConsecutive(std::vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=P6RZZMu_maU&pp=ygUlTmVldENvZGUgTG9uZ2VzdCBDb25zZWN1dGl2ZSBTZXF1ZW5jZQ%3D%3D" + "title": "Longest Consecutive Sequence", + "source": "https://leetcode.com/problems/longest-consecutive-sequence/", + "description": "

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.

\n\n

You must write an algorithm that runs in O(n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [100,4,200,1,3,2]\nOutput: 4\nExplanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,3,7,2,5,8,4,6,0,1]\nOutput: 9\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[100,4,200,1,3,2]", + "--arg1=[0,3,7,2,5,8,4,6,0,1]" + ], + "sample_test_results": [ + "4", + "9" + ], + "hidden_test_cases": [ + "--arg1=[]", + "--arg1=[1]", + "--arg1=[1,2,3,4,5]", + "--arg1=[1,3,5,7,9]", + "--arg1=[-5,-4,-3,-2,-1]", + "--arg1=[1,1,1,1,1]", + "--arg1=[1,2,0,1]", + "--arg1=[0,-1,2,-2,3,-3]", + "--arg1=[1000,1,2,3,4,999]", + "--arg1=[5,4,3,2,1,6,7,8,9]" + ], + "hidden_test_results": [ + "0", + "1", + "5", + "1", + "5", + "1", + "3", + "4", + "4", + "9" + ], + "boilerplate": { + "python": "class Solution:\n def longestConsecutive(self, nums: List[int]) -> int:\n ", + "java": "import java.util.List;\nimport java.util.HashSet;\n\nclass Solution {\n public int longestConsecutive(List nums) {\n \n }\n}", + "cpp": "#include \n#include \n\nclass Solution {\npublic:\n int longestConsecutive(std::vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=P6RZZMu_maU&pp=ygUlTmVldENvZGUgTG9uZ2VzdCBDb25zZWN1dGl2ZSBTZXF1ZW5jZQ%3D%3D", + "method_name": "longestConsecutive" }, { - "title": "Gas Station", - "source": "https://leetcode.com/problems/gas-station/", - "description": "

There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i].

\n\n

You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from the ith station to its next (i + 1)th station. You begin the journey with an empty tank at one of the gas stations.

\n\n

Given two integer arrays gas and cost, return the starting gas station's index if you can travel around the circuit once in the clockwise direction, otherwise return -1. If there exists a solution, it is guaranteed to be unique.

\n\n

 

\n

Example 1:

\n\n
\nInput: gas = [1,2,3,4,5], cost = [3,4,5,1,2]\nOutput: 3\nExplanation:\nStart at station 3 (index 3) and fill up with 4 unit of gas. Your tank = 0 + 4 = 4\nTravel to station 4. Your tank = 4 - 1 + 5 = 8\nTravel to station 0. Your tank = 8 - 2 + 1 = 7\nTravel to station 1. Your tank = 7 - 3 + 2 = 6\nTravel to station 2. Your tank = 6 - 4 + 3 = 5\nTravel to station 3. The cost is 5. Your gas is just enough to travel back to station 3.\nTherefore, return 3 as the starting index.\n
\n\n

Example 2:

\n\n
\nInput: gas = [2,3,4], cost = [3,4,3]\nOutput: -1\nExplanation:\nYou can't start at station 0 or 1, as there is not enough gas to travel to the next station.\nLet's start at station 2 and fill up with 4 unit of gas. Your tank = 0 + 4 = 4\nTravel to station 0. Your tank = 4 - 3 + 2 = 3\nTravel to station 1. Your tank = 3 - 3 + 3 = 3\nYou cannot travel back to station 2, as it requires 4 unit of gas but you only have 3.\nTherefore, you can't travel around the circuit once no matter where you start.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == gas.length == cost.length
  • \n\t
  • 1 <= n <= 105
  • \n\t
  • 0 <= gas[i], cost[i] <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=1,2,3,4,5 --arg2=[3 --arg3=4 --arg4=5 --arg5=1 --arg6=2]", - "--arg1=2,3,4 --arg2=[3 --arg3=4 --arg4=3]" - ], - "sample_test_results": [ - "3", - "-1" - ], - "hidden_test_cases": [ - "--arg1=1 --arg2=1", - "--arg1=2 --arg2=1", - "--arg1=1,2 --arg2=[2 --arg3=1]", - "--arg1=5,1,2,3,4 --arg2=[4 --arg3=4 --arg4=1 --arg5=5 --arg6=1]", - "--arg1=4,5,2,6,5,3 --arg2=[3 --arg3=2 --arg4=7 --arg5=3 --arg6=2 --arg7=9]", - "--arg1=1,2,3 --arg2=[2 --arg3=3 --arg4=1]", - "--arg1=3,1,1 --arg2=[1 --arg3=2 --arg4=2]", - "--arg1=5,8,2,8 --arg2=[6 --arg3=5 --arg4=6 --arg5=6]", - "--arg1=1,1,1 --arg2=[1 --arg3=1 --arg4=1]", - "--arg1=2,0,1 --arg2=[1 --arg3=1 --arg4=1]" - ], - "hidden_test_results": [ - "0", - "0", - "1", - "4", - "-1", - "2", - "0", - "3", - "0", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:\n ", - "java": "class Solution {\n public int canCompleteCircuit(int[] gas, int[] cost) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int canCompleteCircuit(vector& gas, vector& cost) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result != null && result.toString().equals(expected);", - "cpp": "std::string compareFunction(const std::string &result, const std::string &expected) {\n return result == expected;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=lJwbPZGo05A&pp=ygUUTmVldENvZGUgR2FzIFN0YXRpb24%3D" + "title": "Gas Station", + "source": "https://leetcode.com/problems/gas-station/", + "description": "

There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i].

\n\n

You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from the ith station to its next (i + 1)th station. You begin the journey with an empty tank at one of the gas stations.

\n\n

Given two integer arrays gas and cost, return the starting gas station's index if you can travel around the circuit once in the clockwise direction, otherwise return -1. If there exists a solution, it is guaranteed to be unique.

\n\n

 

\n

Example 1:

\n\n
\nInput: gas = [1,2,3,4,5], cost = [3,4,5,1,2]\nOutput: 3\nExplanation:\nStart at station 3 (index 3) and fill up with 4 unit of gas. Your tank = 0 + 4 = 4\nTravel to station 4. Your tank = 4 - 1 + 5 = 8\nTravel to station 0. Your tank = 8 - 2 + 1 = 7\nTravel to station 1. Your tank = 7 - 3 + 2 = 6\nTravel to station 2. Your tank = 6 - 4 + 3 = 5\nTravel to station 3. The cost is 5. Your gas is just enough to travel back to station 3.\nTherefore, return 3 as the starting index.\n
\n\n

Example 2:

\n\n
\nInput: gas = [2,3,4], cost = [3,4,3]\nOutput: -1\nExplanation:\nYou can't start at station 0 or 1, as there is not enough gas to travel to the next station.\nLet's start at station 2 and fill up with 4 unit of gas. Your tank = 0 + 4 = 4\nTravel to station 0. Your tank = 4 - 3 + 2 = 3\nTravel to station 1. Your tank = 3 - 3 + 3 = 3\nYou cannot travel back to station 2, as it requires 4 unit of gas but you only have 3.\nTherefore, you can't travel around the circuit once no matter where you start.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == gas.length == cost.length
  • \n\t
  • 1 <= n <= 105
  • \n\t
  • 0 <= gas[i], cost[i] <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[1,2,3,4,5] --arg2=[3,4,5,1,2]", + "--arg1=[2,3,4] --arg2=[3,4,3]" + ], + "sample_test_results": [ + "3", + "-1" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=[1]", + "--arg1=[2] --arg2=[1]", + "--arg1=[1,2] --arg2=[2,1]", + "--arg1=[5,1,2,3,4] --arg2=[4,4,1,5,1]", + "--arg1=[4,5,2,6,5,3] --arg2=[3,2,7,3,2,9]", + "--arg1=[1,2,3] --arg2=[2,3,1]", + "--arg1=[3,1,1] --arg2=[1,2,2]", + "--arg1=[5,8,2,8] --arg2=[6,5,6,6]", + "--arg1=[1,1,1] --arg2=[1,1,1]", + "--arg1=[2,0,1] --arg2=[1,1,1]" + ], + "hidden_test_results": [ + "0", + "0", + "1", + "4", + "-1", + "2", + "0", + "3", + "0", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:\n ", + "java": "class Solution {\n public int canCompleteCircuit(int[] gas, int[] cost) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int canCompleteCircuit(vector& gas, vector& cost) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result != null && result.toString().equals(expected);", + "cpp": "std::string compareFunction(const std::string &result, const std::string &expected) {\n return result == expected;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=lJwbPZGo05A&pp=ygUUTmVldENvZGUgR2FzIFN0YXRpb24%3D", + "method_name": "canCompleteCircuit" }, { - "title": "Word Break", - "source": "https://leetcode.com/problems/word-break/", - "description": "

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

\n\n

Note that the same word in the dictionary may be reused multiple times in the segmentation.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "leetcode", wordDict = ["leet","code"]\nOutput: true\nExplanation: Return true because "leetcode" can be segmented as "leet code".\n
\n\n

Example 2:

\n\n
\nInput: s = "applepenapple", wordDict = ["apple","pen"]\nOutput: true\nExplanation: Return true because "applepenapple" can be segmented as "apple pen apple".\nNote that you are allowed to reuse a dictionary word.\n
\n\n

Example 3:

\n\n
\nInput: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"]\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 300
  • \n\t
  • 1 <= wordDict.length <= 1000
  • \n\t
  • 1 <= wordDict[i].length <= 20
  • \n\t
  • s and wordDict[i] consist of only lowercase English letters.
  • \n\t
  • All the strings of wordDict are unique.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1='leetcode' --arg2=['leet' --arg3='code']", - "--arg1='applepenapple' --arg2=['apple' --arg3='pen']", - "--arg1='catsandog' --arg2=['cats' --arg3='dog' --arg4='sand' --arg5='and' --arg6='cat']" - ], - "sample_test_results": [ - "True", - "True", - "False" - ], - "hidden_test_cases": [ - "--arg1='a' --arg2='a'", - "--arg1='ab' --arg2=['a' --arg3='b']", - "--arg1='cars' --arg2=['car' --arg3='ca' --arg4='rs']", - "--arg1='goalspecial' --arg2=['go' --arg3='goal' --arg4='goals' --arg5='special']", - "--arg1='aaaaaaa' --arg2=['aaa' --arg3='aaaa']", - "--arg1='impossible' --arg2=['imp' --arg3='possible']", - "--arg1='python' --arg2=['py' --arg3='thon']", - "--arg1='abcd' --arg2=['ab' --arg3='abc' --arg4='cd' --arg5='abcd']", - "--arg1='helloworld' --arg2=['hello' --arg3='world' --arg4='hell' --arg5='or']", - "--arg1='noway' --arg2=['no' --arg3='way' --arg4='now' --arg5='ay']" - ], - "hidden_test_results": [ - "True", - "True", - "True", - "True", - "True", - "False", - "True", - "True", - "True", - "True" - ], - "boilerplate": { - "python": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> bool:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public boolean wordBreak(String s, List wordDict) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool wordBreak(std::string s, std::vector& wordDict) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=Sx9NNgInc3A&pp=ygUTTmVldENvZGUgV29yZCBCcmVhaw%3D%3D" + "title": "Word Break", + "source": "https://leetcode.com/problems/word-break/", + "description": "

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

\n\n

Note that the same word in the dictionary may be reused multiple times in the segmentation.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "leetcode", wordDict = ["leet","code"]\nOutput: true\nExplanation: Return true because "leetcode" can be segmented as "leet code".\n
\n\n

Example 2:

\n\n
\nInput: s = "applepenapple", wordDict = ["apple","pen"]\nOutput: true\nExplanation: Return true because "applepenapple" can be segmented as "apple pen apple".\nNote that you are allowed to reuse a dictionary word.\n
\n\n

Example 3:

\n\n
\nInput: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"]\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 300
  • \n\t
  • 1 <= wordDict.length <= 1000
  • \n\t
  • 1 <= wordDict[i].length <= 20
  • \n\t
  • s and wordDict[i] consist of only lowercase English letters.
  • \n\t
  • All the strings of wordDict are unique.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1='leetcode' --arg2=['leet','code']", + "--arg1='applepenapple' --arg2=['apple','pen']", + "--arg1='catsandog' --arg2=['cats','dog','sand','and','cat']" + ], + "sample_test_results": [ + "true", + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1='a' --arg2=['a']", + "--arg1='ab' --arg2=['a','b']", + "--arg1='cars' --arg2=['car','ca','rs']", + "--arg1='goalspecial' --arg2=['go','goal','goals','special']", + "--arg1='aaaaaaa' --arg2=['aaa','aaaa']", + "--arg1='impossible' --arg2=['imp','possible']", + "--arg1='python' --arg2=['py','thon']", + "--arg1='abcd' --arg2=['ab','abc','cd','abcd']", + "--arg1='helloworld' --arg2=['hello','world','hell','or']", + "--arg1='noway' --arg2=['no','way','now','ay']" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "true", + "false", + "true", + "true", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> bool:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public boolean wordBreak(String s, List wordDict) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool wordBreak(std::string s, std::vector& wordDict) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Sx9NNgInc3A&pp=ygUTTmVldENvZGUgV29yZCBCcmVhaw%3D%3D", + "method_name": "wordBreak" }, { - "title": "Evaluate Reverse Polish Notation", - "source": "https://leetcode.com/problems/evaluate-reverse-polish-notation/", - "description": "

You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation.

\n\n

Evaluate the expression. Return an integer that represents the value of the expression.

\n\n

Note that:

\n\n
    \n\t
  • The valid operators are '+', '-', '*', and '/'.
  • \n\t
  • Each operand may be an integer or another expression.
  • \n\t
  • The division between two integers always truncates toward zero.
  • \n\t
  • There will not be any division by zero.
  • \n\t
  • The input represents a valid arithmetic expression in a reverse polish notation.
  • \n\t
  • The answer and all the intermediate calculations can be represented in a 32-bit integer.
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: tokens = ["2","1","+","3","*"]\nOutput: 9\nExplanation: ((2 + 1) * 3) = 9\n
\n\n

Example 2:

\n\n
\nInput: tokens = ["4","13","5","/","+"]\nOutput: 6\nExplanation: (4 + (13 / 5)) = 6\n
\n\n

Example 3:

\n\n
\nInput: tokens = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"]\nOutput: 22\nExplanation: ((10 * (6 / ((9 + 3) * -11))) + 17) + 5\n= ((10 * (6 / (12 * -11))) + 17) + 5\n= ((10 * (6 / -132)) + 17) + 5\n= ((10 * 0) + 17) + 5\n= (0 + 17) + 5\n= 17 + 5\n= 22\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= tokens.length <= 104
  • \n\t
  • tokens[i] is either an operator: "+", "-", "*", or "/", or an integer in the range [-200, 200].
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=\"2\",\"1\",\"+\",\"3\",\"*\"", - "--arg1=\"4\",\"13\",\"5\",\"/\",\"+\"", - "--arg1=\"10\",\"6\",\"9\",\"3\",\"+\",\"-11\",\"*\",\"/\",\"*\",\"17\",\"+\",\"5\",\"+\"" - ], - "sample_test_results": [ - "9", - "6", - "22" - ], - "hidden_test_cases": [ - "--arg1=\"1\"", - "--arg1=\"2\",\"3\",\"+\"", - "--arg1=\"4\",\"5\",\"*\"", - "--arg1=\"10\",\"5\",\"/\"", - "--arg1=\"15\",\"7\",\"-\"", - "--arg1=\"2\",\"1\",\"3\",\"*\",\"+\"", - "--arg1=\"-2\",\"3\",\"*\",\"4\",\"+\"", - "--arg1=\"10\",\"2\",\"*\",\"3\",\"4\",\"*\",\"+\"", - "--arg1=\"5\",\"3\",\"/\",\"2\",\"*\"", - "--arg1=\"100\",\"200\",\"+\",\"2\",\"/\"" - ], - "hidden_test_results": [ - "1", - "5", - "20", - "2", - "8", - "5", - "-2", - "32", - "2", - "150" - ], - "boilerplate": { - "python": "class Solution:\n def evalRPN(self, tokens: List[str]) -> int:\n ", - "java": "import java.util.List;\nimport java.util.Stack;\n\nclass Solution {\n public int evalRPN(List tokens) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int evalRPN(vector& tokens) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return stoi(result) == stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=iu0082c4HDE&pp=ygUpTmVldENvZGUgRXZhbHVhdGUgUmV2ZXJzZSBQb2xpc2ggTm90YXRpb24%3D" + "title": "Evaluate Reverse Polish Notation", + "source": "https://leetcode.com/problems/evaluate-reverse-polish-notation/", + "description": "

You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation.

\n\n

Evaluate the expression. Return an integer that represents the value of the expression.

\n\n

Note that:

\n\n
    \n\t
  • The valid operators are '+', '-', '*', and '/'.
  • \n\t
  • Each operand may be an integer or another expression.
  • \n\t
  • The division between two integers always truncates toward zero.
  • \n\t
  • There will not be any division by zero.
  • \n\t
  • The input represents a valid arithmetic expression in a reverse polish notation.
  • \n\t
  • The answer and all the intermediate calculations can be represented in a 32-bit integer.
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: tokens = ["2","1","+","3","*"]\nOutput: 9\nExplanation: ((2 + 1) * 3) = 9\n
\n\n

Example 2:

\n\n
\nInput: tokens = ["4","13","5","/","+"]\nOutput: 6\nExplanation: (4 + (13 / 5)) = 6\n
\n\n

Example 3:

\n\n
\nInput: tokens = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"]\nOutput: 22\nExplanation: ((10 * (6 / ((9 + 3) * -11))) + 17) + 5\n= ((10 * (6 / (12 * -11))) + 17) + 5\n= ((10 * (6 / -132)) + 17) + 5\n= ((10 * 0) + 17) + 5\n= (0 + 17) + 5\n= 17 + 5\n= 22\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= tokens.length <= 104
  • \n\t
  • tokens[i] is either an operator: "+", "-", "*", or "/", or an integer in the range [-200, 200].
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[\"2\",\"1\",\"+\",\"3\",\"*\"]", + "--arg1=[\"4\",\"13\",\"5\",\"/\",\"+\"]", + "--arg1=[\"10\",\"6\",\"9\",\"3\",\"+\",\"-11\",\"*\",\"/\",\"*\",\"17\",\"+\",\"5\",\"+\"]" + ], + "sample_test_results": [ + "9", + "6", + "22" + ], + "hidden_test_cases": [ + "--arg1=[\"1\"]", + "--arg1=[\"2\",\"3\",\"+\"]", + "--arg1=[\"4\",\"5\",\"*\"]", + "--arg1=[\"10\",\"5\",\"/\"]", + "--arg1=[\"15\",\"7\",\"-\"]", + "--arg1=[\"2\",\"1\",\"3\",\"*\",\"+\"]", + "--arg1=[\"-2\",\"3\",\"*\",\"4\",\"+\"]", + "--arg1=[\"10\",\"2\",\"*\",\"3\",\"4\",\"*\",\"+\"]", + "--arg1=[\"5\",\"3\",\"/\",\"2\",\"*\"]", + "--arg1=[\"100\",\"200\",\"+\",\"2\",\"/\"]" + ], + "hidden_test_results": [ + "1", + "5", + "20", + "2", + "8", + "5", + "-2", + "32", + "2", + "150" + ], + "boilerplate": { + "python": "class Solution:\n def evalRPN(self, tokens: List[str]) -> int:\n ", + "java": "import java.util.List;\nimport java.util.Stack;\n\nclass Solution {\n public int evalRPN(List tokens) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int evalRPN(vector& tokens) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return stoi(result) == stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=iu0082c4HDE&pp=ygUpTmVldENvZGUgRXZhbHVhdGUgUmV2ZXJzZSBQb2xpc2ggTm90YXRpb24%3D", + "method_name": "evalRPN" }, { - "title": "Reverse Words in a String", - "source": "https://leetcode.com/problems/reverse-words-in-a-string/", - "description": "

Given an input string s, reverse the order of the words.

\n\n

A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space.

\n\n

Return a string of the words in reverse order concatenated by a single space.

\n\n

Note that s may contain leading or trailing spaces or multiple spaces between two words. The returned string should only have a single space separating the words. Do not include any extra spaces.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "the sky is blue"\nOutput: "blue is sky the"\n
\n\n

Example 2:

\n\n
\nInput: s = "  hello world  "\nOutput: "world hello"\nExplanation: Your reversed string should not contain leading or trailing spaces.\n
\n\n

Example 3:

\n\n
\nInput: s = "a good   example"\nOutput: "example good a"\nExplanation: You need to reduce multiple spaces between two words to a single space in the reversed string.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s contains English letters (upper-case and lower-case), digits, and spaces ' '.
  • \n\t
  • There is at least one word in s.
  • \n
\n\n

 

\n

Follow-up: If the string data type is mutable in your language, can you solve it in-place with O(1) extra space?

\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=\"the sky is blue\"", - "--arg1=\" hello world \"", - "--arg1=\"a good example\"" - ], - "sample_test_results": [ - "'blue is sky the'", - "'world hello'", - "'example good a'" - ], - "hidden_test_cases": [ - "--arg1=\"hello\"", - "--arg1=\" spaces \"", - "--arg1=\"first second third\"", - "--arg1=\" multiple spaces here \"", - "--arg1=\"1 2 3 4 5\"", - "--arg1=\"a\"", - "--arg1=\" start end \"", - "--arg1=\"comma --arg2=no space\"", - "--arg1=\"mixed Case woRDs\"", - "--arg1=\" lots of spaces \"" - ], - "hidden_test_results": [ - "'hello'", - "'spaces'", - "'third second first'", - "'here spaces multiple'", - "'5 4 3 2 1'", - "'a'", - "'end start'", - "'space comma,no'", - "'woRDs Case mixed'", - "'spaces of lots'" - ], - "boilerplate": { - "python": "class Solution:\n def reverseWords(self, s: str) -> str:\n ", - "java": "class Solution {\n public String reverseWords(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string reverseWords(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=7kUEwiwwnlA&pp=ygUiTmVldENvZGUgUmV2ZXJzZSBXb3JkcyBpbiBhIFN0cmluZw%3D%3D" + "title": "Reverse Words in a String", + "source": "https://leetcode.com/problems/reverse-words-in-a-string/", + "description": "

Given an input string s, reverse the order of the words.

\n\n

A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space.

\n\n

Return a string of the words in reverse order concatenated by a single space.

\n\n

Note that s may contain leading or trailing spaces or multiple spaces between two words. The returned string should only have a single space separating the words. Do not include any extra spaces.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "the sky is blue"\nOutput: "blue is sky the"\n
\n\n

Example 2:

\n\n
\nInput: s = "  hello world  "\nOutput: "world hello"\nExplanation: Your reversed string should not contain leading or trailing spaces.\n
\n\n

Example 3:

\n\n
\nInput: s = "a good   example"\nOutput: "example good a"\nExplanation: You need to reduce multiple spaces between two words to a single space in the reversed string.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s contains English letters (upper-case and lower-case), digits, and spaces ' '.
  • \n\t
  • There is at least one word in s.
  • \n
\n\n

 

\n

Follow-up: If the string data type is mutable in your language, can you solve it in-place with O(1) extra space?

\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=\"the sky is blue\"", + "--arg1=\" hello world \"", + "--arg1=\"a good example\"" + ], + "sample_test_results": [ + "'blue is sky the'", + "'world hello'", + "'example good a'" + ], + "hidden_test_cases": [ + "--arg1=\"hello\"", + "--arg1=\" spaces \"", + "--arg1=\"first second third\"", + "--arg1=\" multiple spaces here \"", + "--arg1=\"1 2 3 4 5\"", + "--arg1=\"a\"", + "--arg1=\" start end \"", + "--arg1=\"comma, no space\"", + "--arg1=\"mixed Case woRDs\"", + "--arg1=\" lots of spaces \"" + ], + "hidden_test_results": [ + "'hello'", + "'spaces'", + "'third second first'", + "'here spaces multiple'", + "'5 4 3 2 1'", + "'a'", + "'end start'", + "'space comma,no'", + "'woRDs Case mixed'", + "'spaces of lots'" + ], + "boilerplate": { + "python": "class Solution:\n def reverseWords(self, s: str) -> str:\n ", + "java": "class Solution {\n public String reverseWords(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string reverseWords(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=7kUEwiwwnlA&pp=ygUiTmVldENvZGUgUmV2ZXJzZSBXb3JkcyBpbiBhIFN0cmluZw%3D%3D", + "method_name": "reverseWords" }, { - "title": "Find Minimum in Rotated Sorted Array", - "source": "https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/", - "description": "

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:

\n\n
    \n\t
  • [4,5,6,7,0,1,2] if it was rotated 4 times.
  • \n\t
  • [0,1,2,4,5,6,7] if it was rotated 7 times.
  • \n
\n\n

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

\n\n

Given the sorted rotated array nums of unique elements, return the minimum element of this array.

\n\n

You must write an algorithm that runs in O(log n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [3,4,5,1,2]\nOutput: 1\nExplanation: The original array was [1,2,3,4,5] rotated 3 times.\n
\n\n

Example 2:

\n\n
\nInput: nums = [4,5,6,7,0,1,2]\nOutput: 0\nExplanation: The original array was [0,1,2,4,5,6,7] and it was rotated 4 times.\n
\n\n

Example 3:

\n\n
\nInput: nums = [11,13,15,17]\nOutput: 11\nExplanation: The original array was [11,13,15,17] and it was rotated 4 times. \n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == nums.length
  • \n\t
  • 1 <= n <= 5000
  • \n\t
  • -5000 <= nums[i] <= 5000
  • \n\t
  • All the integers of nums are unique.
  • \n\t
  • nums is sorted and rotated between 1 and n times.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=3,4,5,1,2", - "--arg1=4,5,6,7,0,1,2", - "--arg1=11,13,15,17" - ], - "sample_test_results": [ - "1", - "0", - "11" - ], - "hidden_test_cases": [ - "--arg1=45,19,22,27,32,36,41", - "--arg1=-29", - "--arg1=29,30,35,38,41,46,50,54,59,61,63,68,20,22,26", - "--arg1=56,16,19,23,26,31,34,35,36,37,41,44,46,49,51", - "--arg1=11,16,19,21,26,30,35,37,41,-3,-2,0,5,6,7", - "--arg1=43,47,29,30,35,40,41", - "--arg1=14,19,20,25,28,29,-1,2,6,9", - "--arg1=14,19,20,25,28,29,-1,2,6,9", - "--arg1=31,33,29,30", - "--arg1=47,48,52,14,18,23,26,29,34,39,44" - ], - "hidden_test_results": [ - "19", - "-29", - "20", - "16", - "-3", - "29", - "-1", - "-1", - "29", - "14" - ], - "boilerplate": { - "python": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int findMin(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int findMin(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=nIVW4P8b1VA&pp=ygUtTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5" + "title": "Find Minimum in Rotated Sorted Array", + "source": "https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/", + "description": "

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:

\n\n
    \n\t
  • [4,5,6,7,0,1,2] if it was rotated 4 times.
  • \n\t
  • [0,1,2,4,5,6,7] if it was rotated 7 times.
  • \n
\n\n

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

\n\n

Given the sorted rotated array nums of unique elements, return the minimum element of this array.

\n\n

You must write an algorithm that runs in O(log n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [3,4,5,1,2]\nOutput: 1\nExplanation: The original array was [1,2,3,4,5] rotated 3 times.\n
\n\n

Example 2:

\n\n
\nInput: nums = [4,5,6,7,0,1,2]\nOutput: 0\nExplanation: The original array was [0,1,2,4,5,6,7] and it was rotated 4 times.\n
\n\n

Example 3:

\n\n
\nInput: nums = [11,13,15,17]\nOutput: 11\nExplanation: The original array was [11,13,15,17] and it was rotated 4 times. \n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == nums.length
  • \n\t
  • 1 <= n <= 5000
  • \n\t
  • -5000 <= nums[i] <= 5000
  • \n\t
  • All the integers of nums are unique.
  • \n\t
  • nums is sorted and rotated between 1 and n times.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[3,4,5,1,2]", + "--arg1=[4,5,6,7,0,1,2]", + "--arg1=[11,13,15,17]" + ], + "sample_test_results": [ + "1", + "0", + "11" + ], + "hidden_test_cases": [ + "--arg1=[45,19,22,27,32,36,41]", + "--arg1=[-29]", + "--arg1=[29,30,35,38,41,46,50,54,59,61,63,68,20,22,26]", + "--arg1=[56,16,19,23,26,31,34,35,36,37,41,44,46,49,51]", + "--arg1=[11,16,19,21,26,30,35,37,41,-3,-2,0,5,6,7]", + "--arg1=[43,47,29,30,35,40,41]", + "--arg1=[14,19,20,25,28,29,-1,2,6,9]", + "--arg1=[14,19,20,25,28,29,-1,2,6,9]", + "--arg1=[31,33,29,30]", + "--arg1=[47,48,52,14,18,23,26,29,34,39,44]" + ], + "hidden_test_results": [ + "19", + "-29", + "20", + "16", + "-3", + "29", + "-1", + "-1", + "29", + "14" + ], + "boilerplate": { + "python": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int findMin(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findMin(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=nIVW4P8b1VA&pp=ygUtTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5", + "method_name": "findMin" }, { - "title": "Find Peak Element", - "source": "https://leetcode.com/problems/find-peak-element/", - "description": "

A peak element is an element that is strictly greater than its neighbors.

\n\n

Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks.

\n\n

You may imagine that nums[-1] = nums[n] = -∞. In other words, an element is always considered to be strictly greater than a neighbor that is outside the array.

\n\n

You must write an algorithm that runs in O(log n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,3,1]\nOutput: 2\nExplanation: 3 is a peak element and your function should return the index number 2.
\n\n

Example 2:

\n\n
\nInput: nums = [1,2,1,3,5,6,4]\nOutput: 5\nExplanation: Your function can return either index number 1 where the peak element is 2, or index number 5 where the peak element is 6.
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 1000
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n\t
  • nums[i] != nums[i + 1] for all valid i.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=1,2,3,1", - "--arg1=1,2,1,3,5,6,4" - ], - "sample_test_results": [ - "2", - "5" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=1,2", - "--arg1=2,1", - "--arg1=1,2,3", - "--arg1=3,2,1", - "--arg1=1,3,2,4,5", - "--arg1=5,4,3,2,1", - "--arg1=1,5,3,7,4", - "--arg1=1,2,3,4,3", - "--arg1=3,1,4,5,2" - ], - "hidden_test_results": [ - "0", - "1", - "0", - "2", - "0", - "4", - "0", - "3", - "3", - "3" - ], - "boilerplate": { - "python": "class Solution:\n def findPeakElement(self, nums: List[int]) -> int:\n ", - "java": "class Solution {\n public int findPeakElement(int[] nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int findPeakElement(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "import java.util.function.Function;\n\npublic class Solution {\n public static boolean compareFunction(String result, Function evalFunction, String expected) {\n try {\n return result.equals(evalFunction.apply(expected).toString());\n } catch (Exception e) {\n e.printStackTrace();\n return false;\n }\n }\n}", - "cpp": "return result == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=kMzJy9es7Hc&pp=ygUaTmVldENvZGUgRmluZCBQZWFrIEVsZW1lbnQ%3D" + "title": "Find Peak Element", + "source": "https://leetcode.com/problems/find-peak-element/", + "description": "

A peak element is an element that is strictly greater than its neighbors.

\n\n

Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks.

\n\n

You may imagine that nums[-1] = nums[n] = -∞. In other words, an element is always considered to be strictly greater than a neighbor that is outside the array.

\n\n

You must write an algorithm that runs in O(log n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,3,1]\nOutput: 2\nExplanation: 3 is a peak element and your function should return the index number 2.
\n\n

Example 2:

\n\n
\nInput: nums = [1,2,1,3,5,6,4]\nOutput: 5\nExplanation: Your function can return either index number 1 where the peak element is 2, or index number 5 where the peak element is 6.
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 1000
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n\t
  • nums[i] != nums[i + 1] for all valid i.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[1,2,3,1]", + "--arg1=[1,2,1,3,5,6,4]" + ], + "sample_test_results": [ + "2", + "5" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,2]", + "--arg1=[2,1]", + "--arg1=[1,2,3]", + "--arg1=[3,2,1]", + "--arg1=[1,3,2,4,5]", + "--arg1=[5,4,3,2,1]", + "--arg1=[1,5,3,7,4]", + "--arg1=[1,2,3,4,3]", + "--arg1=[3,1,4,5,2]" + ], + "hidden_test_results": [ + "0", + "1", + "0", + "2", + "0", + "4", + "0", + "3", + "3", + "3" + ], + "boilerplate": { + "python": "class Solution:\n def findPeakElement(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int findPeakElement(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findPeakElement(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "import java.util.function.Function;\n\npublic class Solution {\n public static boolean compareFunction(String result, Function evalFunction, String expected) {\n try {\n return result.equals(evalFunction.apply(expected).toString());\n } catch (Exception e) {\n e.printStackTrace();\n return false;\n }\n }\n}", + "cpp": "return result == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=kMzJy9es7Hc&pp=ygUaTmVldENvZGUgRmluZCBQZWFrIEVsZW1lbnQ%3D", + "method_name": "findPeakElement" }, { - "title": "Maximum Gap", - "source": "https://leetcode.com/problems/maximum-gap/", - "description": "

Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the array contains less than two elements, return 0.

\n\n

You must write an algorithm that runs in linear time and uses linear extra space.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [3,6,9,1]\nOutput: 3\nExplanation: The sorted form of the array is [1,3,6,9], either (3,6) or (6,9) has the maximum difference 3.\n
\n\n

Example 2:

\n\n
\nInput: nums = [10]\nOutput: 0\nExplanation: The array contains less than 2 elements, therefore return 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • 0 <= nums[i] <= 109
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=3,6,9,1", - "--arg1=10" - ], - "sample_test_results": [ - "3", - "0" - ], - "hidden_test_cases": [ - "--arg1=1,2,3,4", - "--arg1=1,10", - "--arg1=1,1,1,1", - "--arg1=1,3,100", - "--arg1=1", - "--arg1=1,5,2,8,3", - "--arg1=87,53,100,1", - "--arg1=1000,1,500,2", - "--arg1=1,10000,1,10000", - "--arg1=1,2,3,5,6,7,8,9,10,100" - ], - "hidden_test_results": [ - "1", - "9", - "0", - "97", - "0", - "3", - "52", - "500", - "9999", - "90" - ], - "boilerplate": { - "python": "class Solution:\n def maximumGap(self, nums: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int maximumGap(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maximumGap(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=imCKT3T2Oao&pp=ygUUTmVldENvZGUgTWF4aW11bSBHYXA%3D" + "title": "Maximum Gap", + "source": "https://leetcode.com/problems/maximum-gap/", + "description": "

Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the array contains less than two elements, return 0.

\n\n

You must write an algorithm that runs in linear time and uses linear extra space.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [3,6,9,1]\nOutput: 3\nExplanation: The sorted form of the array is [1,3,6,9], either (3,6) or (6,9) has the maximum difference 3.\n
\n\n

Example 2:

\n\n
\nInput: nums = [10]\nOutput: 0\nExplanation: The array contains less than 2 elements, therefore return 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • 0 <= nums[i] <= 109
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[3,6,9,1]", + "--arg1=[10]" + ], + "sample_test_results": [ + "3", + "0" + ], + "hidden_test_cases": [ + "--arg1=[1,2,3,4]", + "--arg1=[1,10]", + "--arg1=[1,1,1,1]", + "--arg1=[1,3,100]", + "--arg1=[1]", + "--arg1=[1,5,2,8,3]", + "--arg1=[87,53,100,1]", + "--arg1=[1000,1,500,2]", + "--arg1=[1,10000,1,10000]", + "--arg1=[1,2,3,5,6,7,8,9,10,100]" + ], + "hidden_test_results": [ + "1", + "9", + "0", + "97", + "0", + "3", + "52", + "500", + "9999", + "90" + ], + "boilerplate": { + "python": "class Solution:\n def maximumGap(self, nums: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int maximumGap(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maximumGap(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=imCKT3T2Oao&pp=ygUUTmVldENvZGUgTWF4aW11bSBHYXA%3D", + "method_name": "maximumGap" }, { - "title": "Median of Two Sorted Arrays", - "source": "https://leetcode.com/problems/median-of-two-sorted-arrays/", - "description": "

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

\n\n

The overall run time complexity should be O(log (m+n)).

\n\n

 

\n

Example 1:

\n\n
\nInput: nums1 = [1,3], nums2 = [2]\nOutput: 2.00000\nExplanation: merged array = [1,2,3] and median is 2.\n
\n\n

Example 2:

\n\n
\nInput: nums1 = [1,2], nums2 = [3,4]\nOutput: 2.50000\nExplanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • nums1.length == m
  • \n\t
  • nums2.length == n
  • \n\t
  • 0 <= m <= 1000
  • \n\t
  • 0 <= n <= 1000
  • \n\t
  • 1 <= m + n <= 2000
  • \n\t
  • -106 <= nums1[i], nums2[i] <= 106
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=1,3 --arg2=2", - "--arg1=1,2 --arg2=[3 --arg3=4]", - "--arg1= --arg2=1" - ], - "sample_test_results": [ - "2", - "2.5", - "1" - ], - "hidden_test_cases": [ - "--arg1=1 --arg2=1", - "--arg1=1,2,3,4,5 --arg2=", - "--arg1= --arg2=[1 --arg3=2 --arg4=3 --arg5=4 --arg6=5]", - "--arg1=1 --arg2=[2 --arg3=3 --arg4=4 --arg5=5 --arg6=6]", - "--arg1=1,2,3,4,5 --arg2=6", - "--arg1=1,3,5,7 --arg2=[2 --arg3=4 --arg4=6 --arg5=8]", - "--arg1=1,1,1,1 --arg2=[1 --arg3=1 --arg4=1 --arg5=1]", - "--arg1=-1,0,1 --arg2=[-2 --arg3=2]", - "--arg1=10000 --arg2=-10000", - "--arg1=1,2 --arg2=[1 --arg3=2 --arg4=3]" - ], - "hidden_test_results": [ - "1.0", - "3", - "3", - "3.5", - "3.5", - "4.5", - "1.0", - "0", - "0.0", - "2" - ], - "boilerplate": { - "python": "class Solution:\n def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:\n ", - "java": "class Solution {\n public double findMedianSortedArrays(int[] nums1, int[] nums2) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n double findMedianSortedArrays(vector& nums1, vector& nums2) {\n \n }\n};" - }, - "compare_func": { - "python": "return abs(float(result) - float(expected)) < 0.00001", - "java": "return Math.abs(Double.parseDouble(result) - Double.parseDouble(expected)) < 0.00001;", - "cpp": "return std::fabs(static_cast(result) - static_cast(expected)) < 0.00001;" - }, - "explanation": "https://www.youtube.com/watch?v=q6IEA26hvXc&pp=ygUkTmVldENvZGUgTWVkaWFuIG9mIFR3byBTb3J0ZWQgQXJyYXlz" + "title": "Median of Two Sorted Arrays", + "source": "https://leetcode.com/problems/median-of-two-sorted-arrays/", + "description": "

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

\n\n

The overall run time complexity should be O(log (m+n)).

\n\n

 

\n

Example 1:

\n\n
\nInput: nums1 = [1,3], nums2 = [2]\nOutput: 2.00000\nExplanation: merged array = [1,2,3] and median is 2.\n
\n\n

Example 2:

\n\n
\nInput: nums1 = [1,2], nums2 = [3,4]\nOutput: 2.50000\nExplanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • nums1.length == m
  • \n\t
  • nums2.length == n
  • \n\t
  • 0 <= m <= 1000
  • \n\t
  • 0 <= n <= 1000
  • \n\t
  • 1 <= m + n <= 2000
  • \n\t
  • -106 <= nums1[i], nums2[i] <= 106
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[1,3] --arg2=[2]", + "--arg1=[1,2] --arg2=[3,4]", + "--arg1=[] --arg2=[1]" + ], + "sample_test_results": [ + "2", + "2.5", + "1" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=[1]", + "--arg1=[1,2,3,4,5] --arg2=[]", + "--arg1=[] --arg2=[1,2,3,4,5]", + "--arg1=[1] --arg2=[2,3,4,5,6]", + "--arg1=[1,2,3,4,5] --arg2=[6]", + "--arg1=[1,3,5,7] --arg2=[2,4,6,8]", + "--arg1=[1,1,1,1] --arg2=[1,1,1,1]", + "--arg1=[-1,0,1] --arg2=[-2,2]", + "--arg1=[10000] --arg2=[-10000]", + "--arg1=[1,2] --arg2=[1,2,3]" + ], + "hidden_test_results": [ + "1.0", + "3", + "3", + "3.5", + "3.5", + "4.5", + "1.0", + "0", + "0.0", + "2" + ], + "boilerplate": { + "python": "class Solution:\n def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:\n ", + "java": "class Solution {\n public double findMedianSortedArrays(int[] nums1, int[] nums2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n double findMedianSortedArrays(vector& nums1, vector& nums2) {\n \n }\n};" + }, + "compare_func": { + "python": "return abs(float(result) - float(expected)) < 0.00001", + "java": "return Math.abs(Double.parseDouble(result) - Double.parseDouble(expected)) < 0.00001;", + "cpp": "return std::fabs(static_cast(result) - static_cast(expected)) < 0.00001;" + }, + "explanation": "https://www.youtube.com/watch?v=q6IEA26hvXc&pp=ygUkTmVldENvZGUgTWVkaWFuIG9mIFR3byBTb3J0ZWQgQXJyYXlz", + "method_name": "findMedianSortedArrays" }, { - "title": "First Missing Positive", - "source": "https://leetcode.com/problems/first-missing-positive/", - "description": "

Given an unsorted integer array nums. Return the smallest positive integer that is not present in nums.

\n\n

You must implement an algorithm that runs in O(n) time and uses O(1) auxiliary space.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,0]\nOutput: 3\nExplanation: The numbers in the range [1,2] are all in the array.\n
\n\n

Example 2:

\n\n
\nInput: nums = [3,4,-1,1]\nOutput: 2\nExplanation: 1 is in the array but 2 is missing.\n
\n\n

Example 3:

\n\n
\nInput: nums = [7,8,9,11,12]\nOutput: 1\nExplanation: The smallest positive integer 1 is missing.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=1,2,0", - "--arg1=3,4,-1,1", - "--arg1=7,8,9,11,12" - ], - "sample_test_results": [ - "3", - "2", - "1" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=1,1", - "--arg1=-1,-2,-3", - "--arg1=1,2,3,4,5", - "--arg1=2", - "--arg1=1,2,4", - "--arg1=1,1,1,1,1", - "--arg1=2147483647", - "--arg1=-2147483648", - "--arg1=1,2,3,3,3" - ], - "hidden_test_results": [ - "2", - "2", - "1", - "6", - "1", - "3", - "2", - "1", - "1", - "4" - ], - "boilerplate": { - "python": "class Solution:\n def firstMissingPositive(self, nums: List[int]) -> int:\n ", - "java": "class Solution {\n public int firstMissingPositive(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int firstMissingPositive(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=8g78yfzMlao&pp=ygUfTmVldENvZGUgRmlyc3QgTWlzc2luZyBQb3NpdGl2ZQ%3D%3D" + "title": "First Missing Positive", + "source": "https://leetcode.com/problems/first-missing-positive/", + "description": "

Given an unsorted integer array nums. Return the smallest positive integer that is not present in nums.

\n\n

You must implement an algorithm that runs in O(n) time and uses O(1) auxiliary space.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,0]\nOutput: 3\nExplanation: The numbers in the range [1,2] are all in the array.\n
\n\n

Example 2:

\n\n
\nInput: nums = [3,4,-1,1]\nOutput: 2\nExplanation: 1 is in the array but 2 is missing.\n
\n\n

Example 3:

\n\n
\nInput: nums = [7,8,9,11,12]\nOutput: 1\nExplanation: The smallest positive integer 1 is missing.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[1,2,0]", + "--arg1=[3,4,-1,1]", + "--arg1=[7,8,9,11,12]" + ], + "sample_test_results": [ + "3", + "2", + "1" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,1]", + "--arg1=[-1,-2,-3]", + "--arg1=[1,2,3,4,5]", + "--arg1=[2]", + "--arg1=[1,2,4]", + "--arg1=[1,1,1,1,1]", + "--arg1=[2147483647]", + "--arg1=[-2147483648]", + "--arg1=[1,2,3,3,3]" + ], + "hidden_test_results": [ + "2", + "2", + "1", + "6", + "1", + "3", + "2", + "1", + "1", + "4" + ], + "boilerplate": { + "python": "class Solution:\n def firstMissingPositive(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int firstMissingPositive(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int firstMissingPositive(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=8g78yfzMlao&pp=ygUfTmVldENvZGUgRmlyc3QgTWlzc2luZyBQb3NpdGl2ZQ%3D%3D", + "method_name": "firstMissingPositive" }, { - "title": "Permutation Sequence", - "source": "https://leetcode.com/problems/permutation-sequence/", - "description": "

The set [1, 2, 3, ..., n] contains a total of n! unique permutations.

\n\n

By listing and labeling all of the permutations in order, we get the following sequence for n = 3:

\n\n
    \n\t
  1. "123"
  2. \n\t
  3. "132"
  4. \n\t
  5. "213"
  6. \n\t
  7. "231"
  8. \n\t
  9. "312"
  10. \n\t
  11. "321"
  12. \n
\n\n

Given n and k, return the kth permutation sequence.

\n\n

 

\n

Example 1:

\n
Input: n = 3, k = 3\nOutput: \"213\"\n

Example 2:

\n
Input: n = 4, k = 9\nOutput: \"2314\"\n

Example 3:

\n
Input: n = 3, k = 1\nOutput: \"123\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 9
  • \n\t
  • 1 <= k <= n!
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=3 --arg2=3", - "--arg1=4 --arg2=9", - "--arg1=3 --arg2=1" - ], - "sample_test_results": [ - "'213'", - "'2314'", - "'123'" - ], - "hidden_test_cases": [ - "--arg1=1 --arg2=1", - "--arg1=2 --arg2=1", - "--arg1=2 --arg2=2", - "--arg1=3 --arg2=6", - "--arg1=4 --arg2=1", - "--arg1=4 --arg2=24", - "--arg1=5 --arg2=5", - "--arg1=6 --arg2=720", - "--arg1=7 --arg2=1", - "--arg1=8 --arg2=40320" - ], - "hidden_test_results": [ - "'1'", - "'12'", - "'21'", - "'321'", - "'1234'", - "'4321'", - "'12534'", - "'654321'", - "'1234567'", - "'87654321'" - ], - "boilerplate": { - "python": "class Solution:\n def getPermutation(self, n: int, k: int) -> str:\n ", - "java": "class Solution {\n public String getPermutation(int n, int k) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::string getPermutation(int n, int k) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "#include \n#include \n#include // For numeric comparisons, if required\n\nbool compareFunction(const std::string& result, const std::string& expected) {\n std::istringstream resultStream(result);\n std::istringstream expectedStream(expected);\n \n // Assuming the result and expected values are of the same type (e.g., integers, doubles, etc.)\n double resultValue, expectedValue;\n resultStream >> resultValue;\n expectedStream >> expectedValue;\n \n // For numerical comparisons considering the floating-point precision\n return std::abs(resultValue - expectedValue) < 1e-9;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=W9SIlE2jhBQ&pp=ygUdTmVldENvZGUgUGVybXV0YXRpb24gU2VxdWVuY2U%3D" + "title": "Permutation Sequence", + "source": "https://leetcode.com/problems/permutation-sequence/", + "description": "

The set [1, 2, 3, ..., n] contains a total of n! unique permutations.

\n\n

By listing and labeling all of the permutations in order, we get the following sequence for n = 3:

\n\n
    \n\t
  1. "123"
  2. \n\t
  3. "132"
  4. \n\t
  5. "213"
  6. \n\t
  7. "231"
  8. \n\t
  9. "312"
  10. \n\t
  11. "321"
  12. \n
\n\n

Given n and k, return the kth permutation sequence.

\n\n

 

\n

Example 1:

\n
Input: n = 3, k = 3\nOutput: \"213\"\n

Example 2:

\n
Input: n = 4, k = 9\nOutput: \"2314\"\n

Example 3:

\n
Input: n = 3, k = 1\nOutput: \"123\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 9
  • \n\t
  • 1 <= k <= n!
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=3 --arg2=3", + "--arg1=4 --arg2=9", + "--arg1=3 --arg2=1" + ], + "sample_test_results": [ + "'213'", + "'2314'", + "'123'" + ], + "hidden_test_cases": [ + "--arg1=1 --arg2=1", + "--arg1=2 --arg2=1", + "--arg1=2 --arg2=2", + "--arg1=3 --arg2=6", + "--arg1=4 --arg2=1", + "--arg1=4 --arg2=24", + "--arg1=5 --arg2=5", + "--arg1=6 --arg2=720", + "--arg1=7 --arg2=1", + "--arg1=8 --arg2=40320" + ], + "hidden_test_results": [ + "'1'", + "'12'", + "'21'", + "'321'", + "'1234'", + "'4321'", + "'12534'", + "'654321'", + "'1234567'", + "'87654321'" + ], + "boilerplate": { + "python": "class Solution:\n def getPermutation(self, n: int, k: int) -> str:\n ", + "java": "class Solution {\n public String getPermutation(int n, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::string getPermutation(int n, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "#include \n#include \n#include // For numeric comparisons, if required\n\nbool compareFunction(const std::string& result, const std::string& expected) {\n std::istringstream resultStream(result);\n std::istringstream expectedStream(expected);\n \n // Assuming the result and expected values are of the same type (e.g., integers, doubles, etc.)\n double resultValue, expectedValue;\n resultStream >> resultValue;\n expectedStream >> expectedValue;\n \n // For numerical comparisons considering the floating-point precision\n return std::abs(resultValue - expectedValue) < 1e-9;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=W9SIlE2jhBQ&pp=ygUdTmVldENvZGUgUGVybXV0YXRpb24gU2VxdWVuY2U%3D", + "method_name": "getPermutation" }, { - "title": "Text Justification", - "source": "https://leetcode.com/problems/text-justification/", - "description": "

Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified.

\n\n

You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces ' ' when necessary so that each line has exactly maxWidth characters.

\n\n

Extra spaces between words should be distributed as evenly as possible. If the number of spaces on a line does not divide evenly between words, the empty slots on the left will be assigned more spaces than the slots on the right.

\n\n

For the last line of text, it should be left-justified, and no extra space is inserted between words.

\n\n

Note:

\n\n
    \n\t
  • A word is defined as a character sequence consisting of non-space characters only.
  • \n\t
  • Each word's length is guaranteed to be greater than 0 and not exceed maxWidth.
  • \n\t
  • The input array words contains at least one word.
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: words = ["This", "is", "an", "example", "of", "text", "justification."], maxWidth = 16\nOutput:\n[\n   "This    is    an",\n   "example  of text",\n   "justification.  "\n]
\n\n

Example 2:

\n\n
\nInput: words = ["What","must","be","acknowledgment","shall","be"], maxWidth = 16\nOutput:\n[\n  "What   must   be",\n  "acknowledgment  ",\n  "shall be        "\n]\nExplanation: Note that the last line is "shall be    " instead of "shall     be", because the last line must be left-justified instead of fully-justified.\nNote that the second line is also left-justified because it contains only one word.
\n\n

Example 3:

\n\n
\nInput: words = ["Science","is","what","we","understand","well","enough","to","explain","to","a","computer.","Art","is","everything","else","we","do"], maxWidth = 20\nOutput:\n[\n  "Science  is  what we",\n  "understand      well",\n  "enough to explain to",\n  "a  computer.  Art is",\n  "everything  else  we",\n  "do                  "\n]
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= words.length <= 300
  • \n\t
  • 1 <= words[i].length <= 20
  • \n\t
  • words[i] consists of only English letters and symbols.
  • \n\t
  • 1 <= maxWidth <= 100
  • \n\t
  • words[i].length <= maxWidth
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1='This','is','an','example','of','text','justification.' --arg2=16", - "--arg1='What','must','be','acknowledgment','shall','be' --arg2=16", - "--arg1='Science','is','what','we','understand','well','enough','to','explain','to','a','computer.','Art','is','everything','else','we','do' --arg2=20" - ], - "sample_test_results": [ - "'This is an', 'example of text', 'justification. '", - "'What must be', 'acknowledgment ', 'shall be '", - "'Science is what we', 'understand well', 'enough to explain to', 'a computer. Art is', 'everything else we', 'do '" - ], - "hidden_test_cases": [ - "--arg1='a' --arg2=1", - "--arg1='a','b','c' --arg2=1", - "--arg1='hello' --arg2=10", - "--arg1='a','b','c','d' --arg2=3", - "--arg1='This','is','a','test' --arg2=4", - "--arg1='ab','cd','ef' --arg2=10", - "--arg1='a','b' --arg2=4", - "--arg1='word' --arg2=5", - "--arg1='a','b','c','d','e' --arg2=3", - "--arg1='Hello','World' --arg2=12" - ], - "hidden_test_results": [ - "'a'", - "'a', 'b', 'c'", - "'hello '", - "'a b', 'c d'", - "'This', 'is a', 'test'", - "'ab cd ef '", - "'a b '", - "'word '", - "'a b', 'c d', 'e '", - "'Hello World '" - ], - "boilerplate": { - "python": "class Solution:\n def fullJustify(self, words: List[str], maxWidth: int) -> List[str]:\n ", - "java": "class Solution {\n public List fullJustify(List words, int maxWidth) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n vector fullJustify(vector& words, int maxWidth) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoll(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=TzMl4Z7pVh8&pp=ygUbTmVldENvZGUgVGV4dCBKdXN0aWZpY2F0aW9u" + "title": "Text Justification", + "source": "https://leetcode.com/problems/text-justification/", + "description": "

Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified.

\n\n

You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces ' ' when necessary so that each line has exactly maxWidth characters.

\n\n

Extra spaces between words should be distributed as evenly as possible. If the number of spaces on a line does not divide evenly between words, the empty slots on the left will be assigned more spaces than the slots on the right.

\n\n

For the last line of text, it should be left-justified, and no extra space is inserted between words.

\n\n

Note:

\n\n
    \n\t
  • A word is defined as a character sequence consisting of non-space characters only.
  • \n\t
  • Each word's length is guaranteed to be greater than 0 and not exceed maxWidth.
  • \n\t
  • The input array words contains at least one word.
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: words = ["This", "is", "an", "example", "of", "text", "justification."], maxWidth = 16\nOutput:\n[\n   "This    is    an",\n   "example  of text",\n   "justification.  "\n]
\n\n

Example 2:

\n\n
\nInput: words = ["What","must","be","acknowledgment","shall","be"], maxWidth = 16\nOutput:\n[\n  "What   must   be",\n  "acknowledgment  ",\n  "shall be        "\n]\nExplanation: Note that the last line is "shall be    " instead of "shall     be", because the last line must be left-justified instead of fully-justified.\nNote that the second line is also left-justified because it contains only one word.
\n\n

Example 3:

\n\n
\nInput: words = ["Science","is","what","we","understand","well","enough","to","explain","to","a","computer.","Art","is","everything","else","we","do"], maxWidth = 20\nOutput:\n[\n  "Science  is  what we",\n  "understand      well",\n  "enough to explain to",\n  "a  computer.  Art is",\n  "everything  else  we",\n  "do                  "\n]
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= words.length <= 300
  • \n\t
  • 1 <= words[i].length <= 20
  • \n\t
  • words[i] consists of only English letters and symbols.
  • \n\t
  • 1 <= maxWidth <= 100
  • \n\t
  • words[i].length <= maxWidth
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=['This','is','an','example','of','text','justification.'] --arg2=16", + "--arg1=['What','must','be','acknowledgment','shall','be'] --arg2=16", + "--arg1=['Science','is','what','we','understand','well','enough','to','explain','to','a','computer.','Art','is','everything','else','we','do'] --arg2=20" + ], + "sample_test_results": [ + "['This is an','example of text','justification. ']", + "['What must be','acknowledgment ','shall be ']", + "['Science is what we','understand well','enough to explain to','a computer. Art is','everything else we','do ']" + ], + "hidden_test_cases": [ + "--arg1=['a'] --arg2=1", + "--arg1=['a','b','c'] --arg2=1", + "--arg1=['hello'] --arg2=10", + "--arg1=['a','b','c','d'] --arg2=3", + "--arg1=['This','is','a','test'] --arg2=4", + "--arg1=['ab','cd','ef'] --arg2=10", + "--arg1=['a','b'] --arg2=4", + "--arg1=['word'] --arg2=5", + "--arg1=['a','b','c','d','e'] --arg2=3", + "--arg1=['Hello','World'] --arg2=12" + ], + "hidden_test_results": [ + "['a']", + "['a','b','c']", + "['hello ']", + "['a b','c d']", + "['This','is a','test']", + "['ab cd ef ']", + "['a b ']", + "['word ']", + "['a b','c d','e ']", + "['Hello World ']" + ], + "boilerplate": { + "python": "class Solution:\n def fullJustify(self, words: List[str], maxWidth: int) -> List[str]:\n ", + "java": "class Solution {\n public List fullJustify(List words, int maxWidth) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector fullJustify(vector& words, int maxWidth) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoll(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=TzMl4Z7pVh8&pp=ygUbTmVldENvZGUgVGV4dCBKdXN0aWZpY2F0aW9u", + "method_name": "fullJustify" }, { - "title": "Minimum Window Substring", - "source": "https://leetcode.com/problems/minimum-window-substring/", - "description": "

Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string "".

\n\n

The testcases will be generated such that the answer is unique.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "ADOBECODEBANC", t = "ABC"\nOutput: "BANC"\nExplanation: The minimum window substring "BANC" includes 'A', 'B', and 'C' from string t.\n
\n\n

Example 2:

\n\n
\nInput: s = "a", t = "a"\nOutput: "a"\nExplanation: The entire string s is the minimum window.\n
\n\n

Example 3:

\n\n
\nInput: s = "a", t = "aa"\nOutput: ""\nExplanation: Both 'a's from t must be included in the window.\nSince the largest window of s only has one 'a', return empty string.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == s.length
  • \n\t
  • n == t.length
  • \n\t
  • 1 <= m, n <= 105
  • \n\t
  • s and t consist of uppercase and lowercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you find an algorithm that runs in O(m + n) time?

\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1='ADOBECODEBANC' --arg2='ABC'", - "--arg1='a' --arg2='a'", - "--arg1='a' --arg2='aa'" - ], - "sample_test_results": [ - "'BANC'", - "'a'", - "''" - ], - "hidden_test_cases": [ - "--arg1='a' --arg2='b'", - "--arg1='ab' --arg2='a'", - "--arg1='ABCDEFG' --arg2='AC'", - "--arg1='aaaaaaa' --arg2='a'", - "--arg1='ADOBECODEBANC' --arg2='ABBC'", - "--arg1='this is a test string' --arg2='tist'", - "--arg1='ADOBECODEBANC' --arg2='ABCDE'", - "--arg1='aaabbaaba' --arg2='abb'", - "--arg1='abc' --arg2='cba'", - "--arg1='bba' --arg2='ab'" - ], - "hidden_test_results": [ - "''", - "'a'", - "'ABC'", - "'a'", - "'BECODEBA'", - "'t stri'", - "'ADOBEC'", - "'abb'", - "'abc'", - "'ba'" - ], - "boilerplate": { - "python": "class Solution:\n def minWindow(self, s: str, t: str) -> str:\n ", - "java": "class Solution {\n public String minWindow(String s, String t) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::string minWindow(std::string s, std::string t) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=jSto0O4AJbM&pp=ygUhTmVldENvZGUgTWluaW11bSBXaW5kb3cgU3Vic3RyaW5n" + "title": "Minimum Window Substring", + "source": "https://leetcode.com/problems/minimum-window-substring/", + "description": "

Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string "".

\n\n

The testcases will be generated such that the answer is unique.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "ADOBECODEBANC", t = "ABC"\nOutput: "BANC"\nExplanation: The minimum window substring "BANC" includes 'A', 'B', and 'C' from string t.\n
\n\n

Example 2:

\n\n
\nInput: s = "a", t = "a"\nOutput: "a"\nExplanation: The entire string s is the minimum window.\n
\n\n

Example 3:

\n\n
\nInput: s = "a", t = "aa"\nOutput: ""\nExplanation: Both 'a's from t must be included in the window.\nSince the largest window of s only has one 'a', return empty string.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == s.length
  • \n\t
  • n == t.length
  • \n\t
  • 1 <= m, n <= 105
  • \n\t
  • s and t consist of uppercase and lowercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you find an algorithm that runs in O(m + n) time?

\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1='ADOBECODEBANC' --arg2='ABC'", + "--arg1='a' --arg2='a'", + "--arg1='a' --arg2='aa'" + ], + "sample_test_results": [ + "'BANC'", + "'a'", + "''" + ], + "hidden_test_cases": [ + "--arg1='a' --arg2='b'", + "--arg1='ab' --arg2='a'", + "--arg1='ABCDEFG' --arg2='AC'", + "--arg1='aaaaaaa' --arg2='a'", + "--arg1='ADOBECODEBANC' --arg2='ABBC'", + "--arg1='this is a test string' --arg2='tist'", + "--arg1='ADOBECODEBANC' --arg2='ABCDE'", + "--arg1='aaabbaaba' --arg2='abb'", + "--arg1='abc' --arg2='cba'", + "--arg1='bba' --arg2='ab'" + ], + "hidden_test_results": [ + "''", + "'a'", + "'ABC'", + "'a'", + "'BECODEBA'", + "'t stri'", + "'ADOBEC'", + "'abb'", + "'abc'", + "'ba'" + ], + "boilerplate": { + "python": "class Solution:\n def minWindow(self, s: str, t: str) -> str:\n ", + "java": "class Solution {\n public String minWindow(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::string minWindow(std::string s, std::string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=jSto0O4AJbM&pp=ygUhTmVldENvZGUgTWluaW11bSBXaW5kb3cgU3Vic3RyaW5n", + "method_name": "minWindow" }, { - "title": "Largest Rectangle in Histogram", - "source": "https://leetcode.com/problems/largest-rectangle-in-histogram/", - "description": "

Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: heights = [2,1,5,6,2,3]\nOutput: 10\nExplanation: The above is a histogram where width of each bar is 1.\nThe largest rectangle is shown in the red area, which has an area = 10 units.\n
\n\n

Example 2:

\n\"\"\n
\nInput: heights = [2,4]\nOutput: 4\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= heights.length <= 105
  • \n\t
  • 0 <= heights[i] <= 104
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=2,1,5,6,2,3", - "--arg1=2,4" - ], - "sample_test_results": [ - "10", - "4" - ], - "hidden_test_cases": [ - "--arg1=2,1,2", - "--arg1=1", - "--arg1=0", - "--arg1=1,1,1,1", - "--arg1=2,1,2,3,1", - "--arg1=5,4,3,2,1", - "--arg1=1,2,3,4,5", - "--arg1=2,2,2,2", - "--arg1=1,2,3,4,5,4,3,2,1", - "--arg1=0,0,0" - ], - "hidden_test_results": [ - "3", - "1", - "0", - "4", - "5", - "9", - "9", - "8", - "15", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def largestRectangleArea(self, heights: List[int]) -> int:\n ", - "java": "class Solution {\n public int largestRectangleArea(int[] heights) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int largestRectangleArea(vector& heights) {\n // \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=zx5Sw9130L0&pp=ygUnTmVldENvZGUgTGFyZ2VzdCBSZWN0YW5nbGUgaW4gSGlzdG9ncmFt" + "title": "Largest Rectangle in Histogram", + "source": "https://leetcode.com/problems/largest-rectangle-in-histogram/", + "description": "

Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: heights = [2,1,5,6,2,3]\nOutput: 10\nExplanation: The above is a histogram where width of each bar is 1.\nThe largest rectangle is shown in the red area, which has an area = 10 units.\n
\n\n

Example 2:

\n\"\"\n
\nInput: heights = [2,4]\nOutput: 4\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= heights.length <= 105
  • \n\t
  • 0 <= heights[i] <= 104
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[2,1,5,6,2,3]", + "--arg1=[2,4]" + ], + "sample_test_results": [ + "10", + "4" + ], + "hidden_test_cases": [ + "--arg1=[2,1,2]", + "--arg1=[1]", + "--arg1=[0]", + "--arg1=[1,1,1,1]", + "--arg1=[2,1,2,3,1]", + "--arg1=[5,4,3,2,1]", + "--arg1=[1,2,3,4,5]", + "--arg1=[2,2,2,2]", + "--arg1=[1,2,3,4,5,4,3,2,1]", + "--arg1=[0,0,0]" + ], + "hidden_test_results": [ + "3", + "1", + "0", + "4", + "5", + "9", + "9", + "8", + "15", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def largestRectangleArea(self, heights: List[int]) -> int:\n ", + "java": "class Solution {\n public int largestRectangleArea(int[] heights) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int largestRectangleArea(vector& heights) {\n // \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=zx5Sw9130L0&pp=ygUnTmVldENvZGUgTGFyZ2VzdCBSZWN0YW5nbGUgaW4gSGlzdG9ncmFt", + "method_name": "largestRectangleArea" }, { - "title": "Maximal Rectangle", - "source": "https://leetcode.com/problems/maximal-rectangle/", - "description": "

Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]\nOutput: 6\nExplanation: The maximal rectangle is shown in the above picture.\n
\n\n

Example 2:

\n\n
\nInput: matrix = [["0"]]\nOutput: 0\n
\n\n

Example 3:

\n\n
\nInput: matrix = [["1"]]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • rows == matrix.length
  • \n\t
  • cols == matrix[i].length
  • \n\t
  • 1 <= row, cols <= 200
  • \n\t
  • matrix[i][j] is '0' or '1'.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=[\"1\",\"0\",\"1\",\"0\",\"0\" --arg2=\"1\",\"0\",\"1\",\"1\",\"1\" --arg3=\"1\",\"1\",\"1\",\"1\",\"1\" --arg4=\"1\",\"0\",\"0\",\"1\",\"0\" --arg5=]", - "--arg1=[\"0\" --arg2=]", - "--arg1=[\"1\" --arg2=]" - ], - "sample_test_results": [ - "6", - "0", - "1" - ], - "hidden_test_cases": [ - "--arg1=[\"1\",\"1\" --arg2=\"1\",\"1\" --arg3=]", - "--arg1=[\"0\",\"0\" --arg2=\"0\",\"0\" --arg3=]", - "--arg1=[\"1\" --arg2=\"1\" --arg3=]", - "--arg1=[\"1\",\"0\" --arg2=\"1\",\"0\" --arg3=]", - "--arg1=[\"1\",\"1\",\"1\" --arg2=\"1\",\"1\",\"1\" --arg3=\"1\",\"1\",\"1\" --arg4=]", - "--arg1=[\"1\",\"0\",\"1\" --arg2=\"0\",\"1\",\"0\" --arg3=\"1\",\"0\",\"1\" --arg4=]", - "--arg1=[\"0\",\"1\" --arg2=\"1\",\"0\" --arg3=]", - "--arg1=[\"1\",\"1\",\"1\" --arg2=\"1\",\"0\",\"1\" --arg3=\"1\",\"1\",\"1\" --arg4=]", - "--arg1=[\"1\" --arg2=\"1\" --arg3=\"1\" --arg4=]", - "--arg1=[\"0\",\"0\",\"0\" --arg2=\"0\",\"0\",\"0\" --arg3=]" - ], - "hidden_test_results": [ - "4", - "0", - "2", - "2", - "9", - "1", - "1", - "3", - "3", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def maximalRectangle(self, matrix: List[List[str]]) -> int:\n ", - "java": "class Solution {\n public int maximalRectangle(char[][] matrix) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maximalRectangle(vector>& matrix) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=tOylVCugy9k&pp=ygUaTmVldENvZGUgTWF4aW1hbCBSZWN0YW5nbGU%3D" + "title": "Maximal Rectangle", + "source": "https://leetcode.com/problems/maximal-rectangle/", + "description": "

Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]\nOutput: 6\nExplanation: The maximal rectangle is shown in the above picture.\n
\n\n

Example 2:

\n\n
\nInput: matrix = [["0"]]\nOutput: 0\n
\n\n

Example 3:

\n\n
\nInput: matrix = [["1"]]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • rows == matrix.length
  • \n\t
  • cols == matrix[i].length
  • \n\t
  • 1 <= row, cols <= 200
  • \n\t
  • matrix[i][j] is '0' or '1'.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[[\"1\",\"0\",\"1\",\"0\",\"0\"],[\"1\",\"0\",\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\",\"1\",\"1\"],[\"1\",\"0\",\"0\",\"1\",\"0\"]]", + "--arg1=[[\"0\"]]", + "--arg1=[[\"1\"]]" + ], + "sample_test_results": [ + "6", + "0", + "1" + ], + "hidden_test_cases": [ + "--arg1=[[\"1\",\"1\"],[\"1\",\"1\"]]", + "--arg1=[[\"0\",\"0\"],[\"0\",\"0\"]]", + "--arg1=[[\"1\"],[\"1\"]]", + "--arg1=[[\"1\",\"0\"],[\"1\",\"0\"]]", + "--arg1=[[\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\"]]", + "--arg1=[[\"1\",\"0\",\"1\"],[\"0\",\"1\",\"0\"],[\"1\",\"0\",\"1\"]]", + "--arg1=[[\"0\",\"1\"],[\"1\",\"0\"]]", + "--arg1=[[\"1\",\"1\",\"1\"],[\"1\",\"0\",\"1\"],[\"1\",\"1\",\"1\"]]", + "--arg1=[[\"1\"],[\"1\"],[\"1\"]]", + "--arg1=[[\"0\",\"0\",\"0\"],[\"0\",\"0\",\"0\"]]" + ], + "hidden_test_results": [ + "4", + "0", + "2", + "2", + "9", + "1", + "1", + "3", + "3", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def maximalRectangle(self, matrix: List[List[str]]) -> int:\n ", + "java": "class Solution {\n public int maximalRectangle(char[][] matrix) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maximalRectangle(vector>& matrix) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=tOylVCugy9k&pp=ygUaTmVldENvZGUgTWF4aW1hbCBSZWN0YW5nbGU%3D", + "method_name": "maximalRectangle" }, { - "title": "Scramble String", - "source": "https://leetcode.com/problems/scramble-string/", - "description": "

We can scramble a string s to get a string t using the following algorithm:

\n\n
    \n\t
  1. If the length of the string is 1, stop.
  2. \n\t
  3. If the length of the string is > 1, do the following:\n\t
      \n\t\t
    • Split the string into two non-empty substrings at a random index, i.e., if the string is s, divide it to x and y where s = x + y.
    • \n\t\t
    • Randomly decide to swap the two substrings or to keep them in the same order. i.e., after this step, s may become s = x + y or s = y + x.
    • \n\t\t
    • Apply step 1 recursively on each of the two substrings x and y.
    • \n\t
    \n\t
  4. \n
\n\n

Given two strings s1 and s2 of the same length, return true if s2 is a scrambled string of s1, otherwise, return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: s1 = "great", s2 = "rgeat"\nOutput: true\nExplanation: One possible scenario applied on s1 is:\n"great" --> "gr/eat" // divide at random index.\n"gr/eat" --> "gr/eat" // random decision is not to swap the two substrings and keep them in order.\n"gr/eat" --> "g/r / e/at" // apply the same algorithm recursively on both substrings. divide at random index each of them.\n"g/r / e/at" --> "r/g / e/at" // random decision was to swap the first substring and to keep the second substring in the same order.\n"r/g / e/at" --> "r/g / e/ a/t" // again apply the algorithm recursively, divide "at" to "a/t".\n"r/g / e/ a/t" --> "r/g / e/ a/t" // random decision is to keep both substrings in the same order.\nThe algorithm stops now, and the result string is "rgeat" which is s2.\nAs one possible scenario led s1 to be scrambled to s2, we return true.\n
\n\n

Example 2:

\n\n
\nInput: s1 = "abcde", s2 = "caebd"\nOutput: false\n
\n\n

Example 3:

\n\n
\nInput: s1 = "a", s2 = "a"\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • s1.length == s2.length
  • \n\t
  • 1 <= s1.length <= 30
  • \n\t
  • s1 and s2 consist of lowercase English letters.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=\"great\" --arg2=\"rgeat\"", - "--arg1=\"abcde\" --arg2=\"caebd\"", - "--arg1=\"a\" --arg2=\"a\"" - ], - "sample_test_results": [ - "True", - "False", - "True" - ], - "hidden_test_cases": [ - "--arg1=\"ab\" --arg2=\"ba\"", - "--arg1=\"abc\" --arg2=\"bac\"", - "--arg1=\"abc\" --arg2=\"cab\"", - "--arg1=\"abb\" --arg2=\"bba\"", - "--arg1=\"aaab\" --arg2=\"abaa\"", - "--arg1=\"abcd\" --arg2=\"bdac\"", - "--arg1=\"abcde\" --arg2=\"badce\"", - "--arg1=\"abc\" --arg2=\"acb\"", - "--arg1=\"abcdbdacbdac\" --arg2=\"bdacabcdbdac\"", - "--arg1=\"xstjzkfpkggnhjzkpfjoguxvkbuopi\" --arg2=\"xbouipkvxugojfpkzjhnggkpfzjts\"" - ], - "hidden_test_results": [ - "True", - "True", - "True", - "True", - "True", - "False", - "True", - "True", - "True", - "False" - ], - "boilerplate": { - "python": "class Solution:\n def isScramble(self, s1: str, s2: str) -> bool:\n ", - "java": "class Solution {\n public boolean isScramble(String s1, String s2) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isScramble(string s1, string s2) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=MDmZm_aVDF8&pp=ygUYTmVldENvZGUgU2NyYW1ibGUgU3RyaW5n" + "title": "Scramble String", + "source": "https://leetcode.com/problems/scramble-string/", + "description": "

We can scramble a string s to get a string t using the following algorithm:

\n\n
    \n\t
  1. If the length of the string is 1, stop.
  2. \n\t
  3. If the length of the string is > 1, do the following:\n\t
      \n\t\t
    • Split the string into two non-empty substrings at a random index, i.e., if the string is s, divide it to x and y where s = x + y.
    • \n\t\t
    • Randomly decide to swap the two substrings or to keep them in the same order. i.e., after this step, s may become s = x + y or s = y + x.
    • \n\t\t
    • Apply step 1 recursively on each of the two substrings x and y.
    • \n\t
    \n\t
  4. \n
\n\n

Given two strings s1 and s2 of the same length, return true if s2 is a scrambled string of s1, otherwise, return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: s1 = "great", s2 = "rgeat"\nOutput: true\nExplanation: One possible scenario applied on s1 is:\n"great" --> "gr/eat" // divide at random index.\n"gr/eat" --> "gr/eat" // random decision is not to swap the two substrings and keep them in order.\n"gr/eat" --> "g/r / e/at" // apply the same algorithm recursively on both substrings. divide at random index each of them.\n"g/r / e/at" --> "r/g / e/at" // random decision was to swap the first substring and to keep the second substring in the same order.\n"r/g / e/at" --> "r/g / e/ a/t" // again apply the algorithm recursively, divide "at" to "a/t".\n"r/g / e/ a/t" --> "r/g / e/ a/t" // random decision is to keep both substrings in the same order.\nThe algorithm stops now, and the result string is "rgeat" which is s2.\nAs one possible scenario led s1 to be scrambled to s2, we return true.\n
\n\n

Example 2:

\n\n
\nInput: s1 = "abcde", s2 = "caebd"\nOutput: false\n
\n\n

Example 3:

\n\n
\nInput: s1 = "a", s2 = "a"\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • s1.length == s2.length
  • \n\t
  • 1 <= s1.length <= 30
  • \n\t
  • s1 and s2 consist of lowercase English letters.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=\"great\" --arg2=\"rgeat\"", + "--arg1=\"abcde\" --arg2=\"caebd\"", + "--arg1=\"a\" --arg2=\"a\"" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=\"ab\" --arg2=\"ba\"", + "--arg1=\"abc\" --arg2=\"bac\"", + "--arg1=\"abc\" --arg2=\"cab\"", + "--arg1=\"abb\" --arg2=\"bba\"", + "--arg1=\"aaab\" --arg2=\"abaa\"", + "--arg1=\"abcd\" --arg2=\"bdac\"", + "--arg1=\"abcde\" --arg2=\"badce\"", + "--arg1=\"abc\" --arg2=\"acb\"", + "--arg1=\"abcdbdacbdac\" --arg2=\"bdacabcdbdac\"", + "--arg1=\"xstjzkfpkggnhjzkpfjoguxvkbuopi\" --arg2=\"xbouipkvxugojfpkzjhnggkpfzjts\"" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "true", + "false", + "true", + "true", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isScramble(self, s1: str, s2: str) -> bool:\n ", + "java": "class Solution {\n public boolean isScramble(String s1, String s2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isScramble(string s1, string s2) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=MDmZm_aVDF8&pp=ygUYTmVldENvZGUgU2NyYW1ibGUgU3RyaW5n", + "method_name": "isScramble" }, { - "title": "Distinct Subsequences", - "source": "https://leetcode.com/problems/distinct-subsequences/", - "description": "

Given two strings s and t, return the number of distinct subsequences of s which equals t.

\n\n

The test cases are generated so that the answer fits on a 32-bit signed integer.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "rabbbit", t = "rabbit"\nOutput: 3\nExplanation:\nAs shown below, there are 3 ways you can generate "rabbit" from s.\nrabbbit\nrabbbit\nrabbbit\n
\n\n

Example 2:

\n\n
\nInput: s = "babgbag", t = "bag"\nOutput: 5\nExplanation:\nAs shown below, there are 5 ways you can generate "bag" from s.\nbabgbag\nbabgbag\nbabgbag\nbabgbag\nbabgbag
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length, t.length <= 1000
  • \n\t
  • s and t consist of English letters.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=\"rabbbit\" --arg2=\"rabbit\"", - "--arg1=\"babgbag\" --arg2=\"bag\"" - ], - "sample_test_results": [ - "3", - "5" - ], - "hidden_test_cases": [ - "--arg1=\"a\" --arg2=\"a\"", - "--arg1=\"aa\" --arg2=\"a\"", - "--arg1=\"aaa\" --arg2=\"aa\"", - "--arg1=\"abc\" --arg2=\"abc\"", - "--arg1=\"abcde\" --arg2=\"ace\"", - "--arg1=\"aabb\" --arg2=\"ab\"", - "--arg1=\"xslledayhxhadmctrliaxqpokyezcfhzaskeykchkmhpyjipxtsuljkwkovmvelvwxzwieeuqnjozrfwmzsylcwvsthnxujvrkszqwtglewkycikdaiocglwzukwovsghkhyidevhbgffoqkpabthmqihcfxxzdejletqjoxmwftlxfcxgxgvpperwbqvhxgsbbkmphyomtbjzdjhcrcsggleiczpbfjcgtpycpmrjnckslrwduqlccqmgrdhxolfjafmsrfdghnatexyanldrdpxvvgujsztuffoymrfteholgonuaqndinadtumnuhkboyzaqguwqijwxxszngextfcozpetyownmyneehdwqmtpjloztswmzzdzqhuoxrblppqvyvsqhnhryvqsqogpnlqfulurexdtovqpqkfxxnqykgscxaskmksivoazlducanrqxynxlgvwonalpsyddqmaemcrrwvrjmjjnygyebwtqxehrclwsxzylbqexnxjcgspeynlbmetlkacnnbhmaizbadynajpibepbuacggxrqavfnwpcwxbzxfymhjcslghmajrirqzjqxpgtgisfjreqrqabssobbadmtmdknmakdigjqyqcruujlwmfoagrckdwyiglviyyrekjealvvigiesnvuumxgsveadrxlpwetioxibtdjblowblqvzpbrmhupyrdophjxvhgzclidzybajuxllacyhyphssvhcffxonysahvzhzbttyeeyiefhunbokiqrpqfcoxdxvefugapeevdoakxwzykmhbdytjbhigffkmbqmqxsoaiomgmmgwapzdosorcxxhejvgajyzdmzlcntqbapbpofdjtulstuzdrffafedufqwsknumcxbschdybosxkrabyfdejgyozwillcxpcaiehlelczioskqtptzaczobvyojdlyflilvwqgyrqmjaeepydrcchfyftjighntqzoo\" --arg2=\"rwmimatmhydhbujebqehjprarwfkoebcxxqfktayaaeheys\"", - "--arg1=\"aaaaaaaaaa\" --arg2=\"aaaaaaa\"", - "--arg1=\"abcdef\" --arg2=\"xyz\"", - "--arg1=\"wbyhqihmwwux\" --arg2=\"byhwu\"" - ], - "hidden_test_results": [ - "1", - "2", - "3", - "1", - "1", - "4", - "1456742400", - "120", - "0", - "4" - ], - "boilerplate": { - "python": "class Solution:\n def numDistinct(self, s: str, t: str) -> int:\n ", - "java": "class Solution {\n public int numDistinct(String s, String t) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int numDistinct(std::string s, std::string t) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=-RDzMJ33nx8&pp=ygUeTmVldENvZGUgRGlzdGluY3QgU3Vic2VxdWVuY2Vz" + "title": "Distinct Subsequences", + "source": "https://leetcode.com/problems/distinct-subsequences/", + "description": "

Given two strings s and t, return the number of distinct subsequences of s which equals t.

\n\n

The test cases are generated so that the answer fits on a 32-bit signed integer.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "rabbbit", t = "rabbit"\nOutput: 3\nExplanation:\nAs shown below, there are 3 ways you can generate "rabbit" from s.\nrabbbit\nrabbbit\nrabbbit\n
\n\n

Example 2:

\n\n
\nInput: s = "babgbag", t = "bag"\nOutput: 5\nExplanation:\nAs shown below, there are 5 ways you can generate "bag" from s.\nbabgbag\nbabgbag\nbabgbag\nbabgbag\nbabgbag
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length, t.length <= 1000
  • \n\t
  • s and t consist of English letters.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=\"rabbbit\" --arg2=\"rabbit\"", + "--arg1=\"babgbag\" --arg2=\"bag\"" + ], + "sample_test_results": [ + "3", + "5" + ], + "hidden_test_cases": [ + "--arg1=\"a\" --arg2=\"a\"", + "--arg1=\"aa\" --arg2=\"a\"", + "--arg1=\"aaa\" --arg2=\"aa\"", + "--arg1=\"abc\" --arg2=\"abc\"", + "--arg1=\"abcde\" --arg2=\"ace\"", + "--arg1=\"aabb\" --arg2=\"ab\"", + "--arg1=\"xslledayhxhadmctrliaxqpokyezcfhzaskeykchkmhpyjipxtsuljkwkovmvelvwxzwieeuqnjozrfwmzsylcwvsthnxujvrkszqwtglewkycikdaiocglwzukwovsghkhyidevhbgffoqkpabthmqihcfxxzdejletqjoxmwftlxfcxgxgvpperwbqvhxgsbbkmphyomtbjzdjhcrcsggleiczpbfjcgtpycpmrjnckslrwduqlccqmgrdhxolfjafmsrfdghnatexyanldrdpxvvgujsztuffoymrfteholgonuaqndinadtumnuhkboyzaqguwqijwxxszngextfcozpetyownmyneehdwqmtpjloztswmzzdzqhuoxrblppqvyvsqhnhryvqsqogpnlqfulurexdtovqpqkfxxnqykgscxaskmksivoazlducanrqxynxlgvwonalpsyddqmaemcrrwvrjmjjnygyebwtqxehrclwsxzylbqexnxjcgspeynlbmetlkacnnbhmaizbadynajpibepbuacggxrqavfnwpcwxbzxfymhjcslghmajrirqzjqxpgtgisfjreqrqabssobbadmtmdknmakdigjqyqcruujlwmfoagrckdwyiglviyyrekjealvvigiesnvuumxgsveadrxlpwetioxibtdjblowblqvzpbrmhupyrdophjxvhgzclidzybajuxllacyhyphssvhcffxonysahvzhzbttyeeyiefhunbokiqrpqfcoxdxvefugapeevdoakxwzykmhbdytjbhigffkmbqmqxsoaiomgmmgwapzdosorcxxhejvgajyzdmzlcntqbapbpofdjtulstuzdrffafedufqwsknumcxbschdybosxkrabyfdejgyozwillcxpcaiehlelczioskqtptzaczobvyojdlyflilvwqgyrqmjaeepydrcchfyftjighntqzoo\" --arg2=\"rwmimatmhydhbujebqehjprarwfkoebcxxqfktayaaeheys\"", + "--arg1=\"aaaaaaaaaa\" --arg2=\"aaaaaaa\"", + "--arg1=\"abcdef\" --arg2=\"xyz\"", + "--arg1=\"wbyhqihmwwux\" --arg2=\"byhwu\"" + ], + "hidden_test_results": [ + "1", + "2", + "3", + "1", + "1", + "4", + "1456742400", + "120", + "0", + "4" + ], + "boilerplate": { + "python": "class Solution:\n def numDistinct(self, s: str, t: str) -> int:\n ", + "java": "class Solution {\n public int numDistinct(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int numDistinct(std::string s, std::string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=-RDzMJ33nx8&pp=ygUeTmVldENvZGUgRGlzdGluY3QgU3Vic2VxdWVuY2Vz", + "method_name": "numDistinct" }, { - "title": "Best Time to Buy and Sell Stock III", - "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/", - "description": "

You are given an array prices where prices[i] is the price of a given stock on the ith day.

\n\n

Find the maximum profit you can achieve. You may complete at most two transactions.

\n\n

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

\n\n

 

\n

Example 1:

\n\n
\nInput: prices = [3,3,5,0,0,3,1,4]\nOutput: 6\nExplanation: Buy on day 4 (price = 0) and sell on day 6 (price = 3), profit = 3-0 = 3.\nThen buy on day 7 (price = 1) and sell on day 8 (price = 4), profit = 4-1 = 3.
\n\n

Example 2:

\n\n
\nInput: prices = [1,2,3,4,5]\nOutput: 4\nExplanation: Buy on day 1 (price = 1) and sell on day 5 (price = 5), profit = 5-1 = 4.\nNote that you cannot buy on day 1, buy on day 2 and sell them later, as you are engaging multiple transactions at the same time. You must sell before buying again.\n
\n\n

Example 3:

\n\n
\nInput: prices = [7,6,4,3,1]\nOutput: 0\nExplanation: In this case, no transaction is done, i.e. max profit = 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= prices.length <= 105
  • \n\t
  • 0 <= prices[i] <= 105
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=3,3,5,0,0,3,1,4", - "--arg1=1,2,3,4,5", - "--arg1=7,6,4,3,1" - ], - "sample_test_results": [ - "6", - "4", - "0" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=1,2", - "--arg1=2,1", - "--arg1=1,2,4,2,5,7,2,4,9,0", - "--arg1=0,0,0,0", - "--arg1=1,2,3,4,5,4,3,2,1", - "--arg1=3,2,6,5,0,3", - "--arg1=1,4,5,7,6,3,2,9", - "--arg1=8,3,6,2,8,8,8,4,2,0,7,2,9,4,9", - "--arg1=1,2,4,2,5,7,2,4,9,0,9" - ], - "hidden_test_results": [ - "0", - "1", - "0", - "13", - "0", - "4", - "7", - "13", - "15", - "17" - ], - "boilerplate": { - "python": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", - "java": "class Solution {\n public int maxProfit(List prices) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maxProfit(vector& prices) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=37s1_xBiqH0&pp=ygUsTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJSUk%3D" + "title": "Best Time to Buy and Sell Stock III", + "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/", + "description": "

You are given an array prices where prices[i] is the price of a given stock on the ith day.

\n\n

Find the maximum profit you can achieve. You may complete at most two transactions.

\n\n

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

\n\n

 

\n

Example 1:

\n\n
\nInput: prices = [3,3,5,0,0,3,1,4]\nOutput: 6\nExplanation: Buy on day 4 (price = 0) and sell on day 6 (price = 3), profit = 3-0 = 3.\nThen buy on day 7 (price = 1) and sell on day 8 (price = 4), profit = 4-1 = 3.
\n\n

Example 2:

\n\n
\nInput: prices = [1,2,3,4,5]\nOutput: 4\nExplanation: Buy on day 1 (price = 1) and sell on day 5 (price = 5), profit = 5-1 = 4.\nNote that you cannot buy on day 1, buy on day 2 and sell them later, as you are engaging multiple transactions at the same time. You must sell before buying again.\n
\n\n

Example 3:

\n\n
\nInput: prices = [7,6,4,3,1]\nOutput: 0\nExplanation: In this case, no transaction is done, i.e. max profit = 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= prices.length <= 105
  • \n\t
  • 0 <= prices[i] <= 105
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[3,3,5,0,0,3,1,4]", + "--arg1=[1,2,3,4,5]", + "--arg1=[7,6,4,3,1]" + ], + "sample_test_results": [ + "6", + "4", + "0" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,2]", + "--arg1=[2,1]", + "--arg1=[1,2,4,2,5,7,2,4,9,0]", + "--arg1=[0,0,0,0]", + "--arg1=[1,2,3,4,5,4,3,2,1]", + "--arg1=[3,2,6,5,0,3]", + "--arg1=[1,4,5,7,6,3,2,9]", + "--arg1=[8,3,6,2,8,8,8,4,2,0,7,2,9,4,9]", + "--arg1=[1,2,4,2,5,7,2,4,9,0,9]" + ], + "hidden_test_results": [ + "0", + "1", + "0", + "13", + "0", + "4", + "7", + "13", + "15", + "17" + ], + "boilerplate": { + "python": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", + "java": "class Solution {\n public int maxProfit(List prices) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxProfit(vector& prices) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=37s1_xBiqH0&pp=ygUsTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJSUk%3D", + "method_name": "maxProfit" }, { - "title": "Word Ladder", - "source": "https://leetcode.com/problems/word-ladder/", - "description": "

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that:

\n\n
    \n\t
  • Every adjacent pair of words differs by a single letter.
  • \n\t
  • Every si for 1 <= i <= k is in wordList. Note that beginWord does not need to be in wordList.
  • \n\t
  • sk == endWord
  • \n
\n\n

Given two words, beginWord and endWord, and a dictionary wordList, return the number of words in the shortest transformation sequence from beginWord to endWord, or 0 if no such sequence exists.

\n\n

 

\n

Example 1:

\n\n
\nInput: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]\nOutput: 5\nExplanation: One shortest transformation sequence is "hit" -> "hot" -> "dot" -> "dog" -> cog", which is 5 words long.\n
\n\n

Example 2:

\n\n
\nInput: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"]\nOutput: 0\nExplanation: The endWord "cog" is not in wordList, therefore there is no valid transformation sequence.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= beginWord.length <= 10
  • \n\t
  • endWord.length == beginWord.length
  • \n\t
  • 1 <= wordList.length <= 5000
  • \n\t
  • wordList[i].length == beginWord.length
  • \n\t
  • beginWord, endWord, and wordList[i] consist of lowercase English letters.
  • \n\t
  • beginWord != endWord
  • \n\t
  • All the words in wordList are unique.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1='hit' --arg2='cog' --arg3=['hot' --arg4='dot' --arg5='dog' --arg6='lot' --arg7='log' --arg8='cog']", - "--arg1='hit' --arg2='cog' --arg3=['hot' --arg4='dot' --arg5='dog' --arg6='lot' --arg7='log']", - "--arg1='lost' --arg2='cost' --arg3=['most' --arg4='cost' --arg5='lost']" - ], - "sample_test_results": [ - "5", - "0", - "2" - ], - "hidden_test_cases": [ - "--arg1='hit' --arg2='dog' --arg3=['hot' --arg4='dot' --arg5='dog']", - "--arg1='cat' --arg2='rat' --arg3=['hat' --arg4='rat' --arg5='cat']", - "--arg1='a' --arg2='c' --arg3=['a' --arg4='b' --arg5='c']", - "--arg1='red' --arg2='tax' --arg3=['ted' --arg4='tex' --arg5='red' --arg6='tax' --arg7='tad']", - "--arg1='log' --arg2='dog' --arg3=['fog' --arg4='fig' --arg5='dig' --arg6='dog' --arg7='log']", - "--arg1='abc' --arg2='def' --arg3=['abf' --arg4='acf' --arg5='aef' --arg6='def']", - "--arg1='hot' --arg2='dog' --arg3=['hot' --arg4='dog']", - "--arg1='hit' --arg2='cog' --arg3=", - "--arg1='cat' --arg2='cat' --arg3='cat'", - "--arg1='hit' --arg2='hat' --arg3=['hat' --arg4='hot']" - ], - "hidden_test_results": [ - "4", - "2", - "2", - "4", - "2", - "4", - "0", - "0", - "2", - "2" - ], - "boilerplate": { - "python": "class Solution:\n def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:\n ", - "java": "class Solution {\n public int ladderLength(String beginWord, String endWord, List wordList) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int ladderLength(string beginWord, string endWord, vector& wordList) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=h9iTnkgv05E&pp=ygUUTmVldENvZGUgV29yZCBMYWRkZXI%3D" + "title": "Word Ladder", + "source": "https://leetcode.com/problems/word-ladder/", + "description": "

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that:

\n\n
    \n\t
  • Every adjacent pair of words differs by a single letter.
  • \n\t
  • Every si for 1 <= i <= k is in wordList. Note that beginWord does not need to be in wordList.
  • \n\t
  • sk == endWord
  • \n
\n\n

Given two words, beginWord and endWord, and a dictionary wordList, return the number of words in the shortest transformation sequence from beginWord to endWord, or 0 if no such sequence exists.

\n\n

 

\n

Example 1:

\n\n
\nInput: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]\nOutput: 5\nExplanation: One shortest transformation sequence is "hit" -> "hot" -> "dot" -> "dog" -> cog", which is 5 words long.\n
\n\n

Example 2:

\n\n
\nInput: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"]\nOutput: 0\nExplanation: The endWord "cog" is not in wordList, therefore there is no valid transformation sequence.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= beginWord.length <= 10
  • \n\t
  • endWord.length == beginWord.length
  • \n\t
  • 1 <= wordList.length <= 5000
  • \n\t
  • wordList[i].length == beginWord.length
  • \n\t
  • beginWord, endWord, and wordList[i] consist of lowercase English letters.
  • \n\t
  • beginWord != endWord
  • \n\t
  • All the words in wordList are unique.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1='hit' --arg2='cog' --arg3=['hot','dot','dog','lot','log','cog']", + "--arg1='hit' --arg2='cog' --arg3=['hot','dot','dog','lot','log']", + "--arg1='lost' --arg2='cost' --arg3=['most','cost','lost']" + ], + "sample_test_results": [ + "5", + "0", + "2" + ], + "hidden_test_cases": [ + "--arg1='hit' --arg2='dog' --arg3=['hot','dot','dog']", + "--arg1='cat' --arg2='rat' --arg3=['hat','rat','cat']", + "--arg1='a' --arg2='c' --arg3=['a','b','c']", + "--arg1='red' --arg2='tax' --arg3=['ted','tex','red','tax','tad']", + "--arg1='log' --arg2='dog' --arg3=['fog','fig','dig','dog','log']", + "--arg1='abc' --arg2='def' --arg3=['abf','acf','aef','def']", + "--arg1='hot' --arg2='dog' --arg3=['hot','dog']", + "--arg1='hit' --arg2='cog' --arg3=[]", + "--arg1='cat' --arg2='cat' --arg3=['cat']", + "--arg1='hit' --arg2='hat' --arg3=['hat','hot']" + ], + "hidden_test_results": [ + "4", + "2", + "2", + "4", + "2", + "4", + "0", + "0", + "2", + "2" + ], + "boilerplate": { + "python": "class Solution:\n def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:\n ", + "java": "class Solution {\n public int ladderLength(String beginWord, String endWord, List wordList) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int ladderLength(string beginWord, string endWord, vector& wordList) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=h9iTnkgv05E&pp=ygUUTmVldENvZGUgV29yZCBMYWRkZXI%3D", + "method_name": "ladderLength" }, { - "title": "Candy", - "source": "https://leetcode.com/problems/candy/", - "description": "

There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings.

\n\n

You are giving candies to these children subjected to the following requirements:

\n\n
    \n\t
  • Each child must have at least one candy.
  • \n\t
  • Children with a higher rating get more candies than their neighbors.
  • \n
\n\n

Return the minimum number of candies you need to have to distribute the candies to the children.

\n\n

 

\n

Example 1:

\n\n
\nInput: ratings = [1,0,2]\nOutput: 5\nExplanation: You can allocate to the first, second and third child with 2, 1, 2 candies respectively.\n
\n\n

Example 2:

\n\n
\nInput: ratings = [1,2,2]\nOutput: 4\nExplanation: You can allocate to the first, second and third child with 1, 2, 1 candies respectively.\nThe third child gets 1 candy because it satisfies the above two conditions.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == ratings.length
  • \n\t
  • 1 <= n <= 2 * 104
  • \n\t
  • 0 <= ratings[i] <= 2 * 104
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=1,0,2", - "--arg1=1,2,2", - "--arg1=1,3,2,2,1" - ], - "sample_test_results": [ - "5", - "4", - "7" - ], - "hidden_test_cases": [ - "--arg1=1,2,3,4,5", - "--arg1=5,4,3,2,1", - "--arg1=1,1,1,1,1", - "--arg1=1,3,4,5,2", - "--arg1=1,2,87,87,87,2,1", - "--arg1=1,2,2,3,1,2", - "--arg1=0", - "--arg1=1,0,1,0,1", - "--arg1=2,0,1,0,2", - "--arg1=1,6,10,8,7,3,2" - ], - "hidden_test_results": [ - "15", - "15", - "5", - "11", - "13", - "9", - "1", - "8", - "8", - "18" - ], - "boilerplate": { - "python": "class Solution:\n def candy(self, ratings: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int candy(List ratings) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int candy(vector& ratings) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=1IzCRCcK17A&pp=ygUOTmVldENvZGUgQ2FuZHk%3D" + "title": "Candy", + "source": "https://leetcode.com/problems/candy/", + "description": "

There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings.

\n\n

You are giving candies to these children subjected to the following requirements:

\n\n
    \n\t
  • Each child must have at least one candy.
  • \n\t
  • Children with a higher rating get more candies than their neighbors.
  • \n
\n\n

Return the minimum number of candies you need to have to distribute the candies to the children.

\n\n

 

\n

Example 1:

\n\n
\nInput: ratings = [1,0,2]\nOutput: 5\nExplanation: You can allocate to the first, second and third child with 2, 1, 2 candies respectively.\n
\n\n

Example 2:

\n\n
\nInput: ratings = [1,2,2]\nOutput: 4\nExplanation: You can allocate to the first, second and third child with 1, 2, 1 candies respectively.\nThe third child gets 1 candy because it satisfies the above two conditions.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == ratings.length
  • \n\t
  • 1 <= n <= 2 * 104
  • \n\t
  • 0 <= ratings[i] <= 2 * 104
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[1,0,2]", + "--arg1=[1,2,2]", + "--arg1=[1,3,2,2,1]" + ], + "sample_test_results": [ + "5", + "4", + "7" + ], + "hidden_test_cases": [ + "--arg1=[1,2,3,4,5]", + "--arg1=[5,4,3,2,1]", + "--arg1=[1,1,1,1,1]", + "--arg1=[1,3,4,5,2]", + "--arg1=[1,2,87,87,87,2,1]", + "--arg1=[1,2,2,3,1,2]", + "--arg1=[0]", + "--arg1=[1,0,1,0,1]", + "--arg1=[2,0,1,0,2]", + "--arg1=[1,6,10,8,7,3,2]" + ], + "hidden_test_results": [ + "15", + "15", + "5", + "11", + "13", + "9", + "1", + "8", + "8", + "18" + ], + "boilerplate": { + "python": "class Solution:\n def candy(self, ratings: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int candy(List ratings) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int candy(vector& ratings) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=1IzCRCcK17A&pp=ygUOTmVldENvZGUgQ2FuZHk%3D", + "method_name": "candy" }, { - "title": "Word Break II", - "source": "https://leetcode.com/problems/word-break-ii/", - "description": "

Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order.

\n\n

Note that the same word in the dictionary may be reused multiple times in the segmentation.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "catsanddog", wordDict = ["cat","cats","and","sand","dog"]\nOutput: ["cats and dog","cat sand dog"]\n
\n\n

Example 2:

\n\n
\nInput: s = "pineapplepenapple", wordDict = ["apple","pen","applepen","pine","pineapple"]\nOutput: ["pine apple pen apple","pineapple pen apple","pine applepen apple"]\nExplanation: Note that you are allowed to reuse a dictionary word.\n
\n\n

Example 3:

\n\n
\nInput: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"]\nOutput: []\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 20
  • \n\t
  • 1 <= wordDict.length <= 1000
  • \n\t
  • 1 <= wordDict[i].length <= 10
  • \n\t
  • s and wordDict[i] consist of only lowercase English letters.
  • \n\t
  • All the strings of wordDict are unique.
  • \n\t
  • Input is generated in a way that the length of the answer doesn't exceed 105.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1='catsanddog' --arg2=['cat' --arg3='cats' --arg4='and' --arg5='sand' --arg6='dog']", - "--arg1='pineapplepenapple' --arg2=['apple' --arg3='pen' --arg4='applepen' --arg5='pine' --arg6='pineapple']", - "--arg1='catsandog' --arg2=['cats' --arg3='dog' --arg4='sand' --arg5='and' --arg6='cat']" - ], - "sample_test_results": [ - "'cat sand dog', 'cats and dog'", - "'pine apple pen apple', 'pine applepen apple', 'pineapple pen apple'", - "" - ], - "hidden_test_cases": [ - "--arg1='leetcode' --arg2=['leet' --arg3='code']", - "--arg1='applepenapple' --arg2=['apple' --arg3='pen']", - "--arg1='a' --arg2='a'", - "--arg1='aaaa' --arg2=['a' --arg3='aa' --arg4='aaa']", - "--arg1='cars' --arg2=['car' --arg3='ca' --arg4='rs']", - "--arg1='bb' --arg2=['a' --arg3='b' --arg4='bbb']", - "--arg1='catsanddogs' --arg2=['cats' --arg3='cat' --arg4='and' --arg5='sand' --arg6='dog' --arg7='dogs']", - "--arg1='ab' --arg2=['a' --arg3='b']", - "--arg1='impossible' --arg2=['imp' --arg3='possible']", - "--arg1='aaa' --arg2=['a' --arg3='aa']" - ], - "hidden_test_results": [ - "'leet code'", - "'apple pen apple'", - "'a'", - "'a a a a', 'a a aa', 'a aa a', 'a aaa', 'aa a a', 'aa aa', 'aaa a'", - "'ca rs'", - "'b b'", - "'cat sand dogs', 'cats and dogs'", - "'a b'", - "", - "'a a a', 'a aa', 'aa a'" - ], - "boilerplate": { - "python": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> List[str]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List wordBreak(String s, List wordDict) {\n // Your code here\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n std::vector wordBreak(std::string s, const std::vector& wordDict) {\n \n }\n};" - }, - "compare_func": { - "python": "def normalize(s): return sorted([x.strip() for x in eval(s)])\n return normalize(str(result)) == normalize(expected)", - "java": "import java.util.List;\nimport java.util.Arrays;\nimport java.util.stream.Collectors;\n\npublic class Solution {\n public boolean compareFunction(String result, String expected) {\n List normalize(String s) {\n return Arrays.stream(s.split(\",\"))\n .map(String::strip)\n .sorted()\n .collect(Collectors.toList());\n }\n\n return normalize(result).equals(normalize(expected));\n }\n}", - "cpp": "bool compareFunction(string result, string expected) {\n // Function to normalize and evaluate a string expression\n auto normalize = [](const string& s) -> vector {\n string trimmed;\n vector elements;\n stringstream ss(eval(s));\n while (getline(ss, trimmed, ',')) {\n trimmed.erase(trimmed.find_last_not_of(' ') + 1); // Trim right\n trimmed.erase(0, trimmed.find_first_not_of(' ')); // Trim left\n elements.push_back(trimmed);\n }\n sort(elements.begin(), elements.end());\n return elements;\n };\n return normalize(result) == normalize(expected);\n}" - }, - "explanation": "https://www.youtube.com/watch?v=QgLKdluDo08&pp=ygUWTmVldENvZGUgV29yZCBCcmVhayBJSQ%3D%3D" + "title": "Word Break II", + "source": "https://leetcode.com/problems/word-break-ii/", + "description": "

Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order.

\n\n

Note that the same word in the dictionary may be reused multiple times in the segmentation.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "catsanddog", wordDict = ["cat","cats","and","sand","dog"]\nOutput: ["cats and dog","cat sand dog"]\n
\n\n

Example 2:

\n\n
\nInput: s = "pineapplepenapple", wordDict = ["apple","pen","applepen","pine","pineapple"]\nOutput: ["pine apple pen apple","pineapple pen apple","pine applepen apple"]\nExplanation: Note that you are allowed to reuse a dictionary word.\n
\n\n

Example 3:

\n\n
\nInput: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"]\nOutput: []\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 20
  • \n\t
  • 1 <= wordDict.length <= 1000
  • \n\t
  • 1 <= wordDict[i].length <= 10
  • \n\t
  • s and wordDict[i] consist of only lowercase English letters.
  • \n\t
  • All the strings of wordDict are unique.
  • \n\t
  • Input is generated in a way that the length of the answer doesn't exceed 105.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1='catsanddog' --arg2=['cat','cats','and','sand','dog']", + "--arg1='pineapplepenapple' --arg2=['apple','pen','applepen','pine','pineapple']", + "--arg1='catsandog' --arg2=['cats','dog','sand','and','cat']" + ], + "sample_test_results": [ + "['cat sand dog','cats and dog']", + "['pine apple pen apple','pine applepen apple','pineapple pen apple']", + "[]" + ], + "hidden_test_cases": [ + "--arg1='leetcode' --arg2=['leet','code']", + "--arg1='applepenapple' --arg2=['apple','pen']", + "--arg1='a' --arg2=['a']", + "--arg1='aaaa' --arg2=['a','aa','aaa']", + "--arg1='cars' --arg2=['car','ca','rs']", + "--arg1='bb' --arg2=['a','b','bbb']", + "--arg1='catsanddogs' --arg2=['cats','cat','and','sand','dog','dogs']", + "--arg1='ab' --arg2=['a','b']", + "--arg1='impossible' --arg2=['imp','possible']", + "--arg1='aaa' --arg2=['a','aa']" + ], + "hidden_test_results": [ + "['leet code']", + "['apple pen apple']", + "['a']", + "['a a a a','a a aa','a aa a','a aaa','aa a a','aa aa','aaa a']", + "['ca rs']", + "['b b']", + "['cat sand dogs','cats and dogs']", + "['a b']", + "[]", + "['a a a','a aa','aa a']" + ], + "boilerplate": { + "python": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> List[str]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List wordBreak(String s, List wordDict) {\n // Your code here\n return new ArrayList<>();\n }\n}", + "cpp": "class Solution {\npublic:\n std::vector wordBreak(std::string s, const std::vector& wordDict) {\n \n }\n};" + }, + "compare_func": { + "python": "def normalize(s): return sorted([x.strip() for x in eval(s)])\n return normalize(str(result)) == normalize(expected)", + "java": "import java.util.List;\nimport java.util.Arrays;\nimport java.util.stream.Collectors;\n\npublic class Solution {\n public boolean compareFunction(String result, String expected) {\n List normalize(String s) {\n return Arrays.stream(s.split(\",\"))\n .map(String::strip)\n .sorted()\n .collect(Collectors.toList());\n }\n\n return normalize(result).equals(normalize(expected));\n }\n}", + "cpp": "bool compareFunction(string result, string expected) {\n // Function to normalize and evaluate a string expression\n auto normalize = [](const string& s) -> vector {\n string trimmed;\n vector elements;\n stringstream ss(eval(s));\n while (getline(ss, trimmed, ',')) {\n trimmed.erase(trimmed.find_last_not_of(' ') + 1); // Trim right\n trimmed.erase(0, trimmed.find_first_not_of(' ')); // Trim left\n elements.push_back(trimmed);\n }\n sort(elements.begin(), elements.end());\n return elements;\n };\n return normalize(result) == normalize(expected);\n}" + }, + "explanation": "https://www.youtube.com/watch?v=QgLKdluDo08&pp=ygUWTmVldENvZGUgV29yZCBCcmVhayBJSQ%3D%3D", + "method_name": "wordBreak" }, { - "title": "Find Minimum in Rotated Sorted Array II", - "source": "https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/", - "description": "

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become:

\n\n
    \n\t
  • [4,5,6,7,0,1,4] if it was rotated 4 times.
  • \n\t
  • [0,1,4,4,5,6,7] if it was rotated 7 times.
  • \n
\n\n

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

\n\n

Given the sorted rotated array nums that may contain duplicates, return the minimum element of this array.

\n\n

You must decrease the overall operation steps as much as possible.

\n\n

 

\n

Example 1:

\n
Input: nums = [1,3,5]\nOutput: 1\n

Example 2:

\n
Input: nums = [2,2,2,0,1]\nOutput: 0\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • n == nums.length
  • \n\t
  • 1 <= n <= 5000
  • \n\t
  • -5000 <= nums[i] <= 5000
  • \n\t
  • nums is sorted and rotated between 1 and n times.
  • \n
\n\n

 

\n

Follow up: This problem is similar to Find Minimum in Rotated Sorted Array, but nums may contain duplicates. Would this affect the runtime complexity? How and why?

\n\n

 

\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=1,3,5", - "--arg1=2,2,2,0,1", - "--arg1=3,1,3" - ], - "sample_test_results": [ - "1", - "0", - "1" - ], - "hidden_test_cases": [ - "--arg1=1,1,1,1,1", - "--arg1=3,3,1,3", - "--arg1=2,2,2,0,1,2", - "--arg1=4,5,6,7,0,1,2", - "--arg1=1,1,1,0,1", - "--arg1=3,4,5,1,2", - "--arg1=5,1,2,3,4", - "--arg1=2,2,2,2,2,2", - "--arg1=3,1,1,1,1", - "--arg1=4,4,5,5,6,6,7,0" - ], - "hidden_test_results": [ - "1", - "1", - "0", - "0", - "0", - "1", - "1", - "2", - "1", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", - "java": "class Solution {\n public int findMin(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int findMin(std::vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=oUnF7o88_Xc&pp=ygUwTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5IElJ" + "title": "Find Minimum in Rotated Sorted Array II", + "source": "https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/", + "description": "

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become:

\n\n
    \n\t
  • [4,5,6,7,0,1,4] if it was rotated 4 times.
  • \n\t
  • [0,1,4,4,5,6,7] if it was rotated 7 times.
  • \n
\n\n

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

\n\n

Given the sorted rotated array nums that may contain duplicates, return the minimum element of this array.

\n\n

You must decrease the overall operation steps as much as possible.

\n\n

 

\n

Example 1:

\n
Input: nums = [1,3,5]\nOutput: 1\n

Example 2:

\n
Input: nums = [2,2,2,0,1]\nOutput: 0\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • n == nums.length
  • \n\t
  • 1 <= n <= 5000
  • \n\t
  • -5000 <= nums[i] <= 5000
  • \n\t
  • nums is sorted and rotated between 1 and n times.
  • \n
\n\n

 

\n

Follow up: This problem is similar to Find Minimum in Rotated Sorted Array, but nums may contain duplicates. Would this affect the runtime complexity? How and why?

\n\n

 

\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[1,3,5]", + "--arg1=[2,2,2,0,1]", + "--arg1=[3,1,3]" + ], + "sample_test_results": [ + "1", + "0", + "1" + ], + "hidden_test_cases": [ + "--arg1=[1,1,1,1,1]", + "--arg1=[3,3,1,3]", + "--arg1=[2,2,2,0,1,2]", + "--arg1=[4,5,6,7,0,1,2]", + "--arg1=[1,1,1,0,1]", + "--arg1=[3,4,5,1,2]", + "--arg1=[5,1,2,3,4]", + "--arg1=[2,2,2,2,2,2]", + "--arg1=[3,1,1,1,1]", + "--arg1=[4,4,5,5,6,6,7,0]" + ], + "hidden_test_results": [ + "1", + "1", + "0", + "0", + "0", + "1", + "1", + "2", + "1", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int findMin(List nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findMin(std::vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=oUnF7o88_Xc&pp=ygUwTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5IElJ", + "method_name": "findMin" }, { - "title": "Best Time to Buy and Sell Stock IV", - "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/", - "description": "

You are given an integer array prices where prices[i] is the price of a given stock on the ith day, and an integer k.

\n\n

Find the maximum profit you can achieve. You may complete at most k transactions: i.e. you may buy at most k times and sell at most k times.

\n\n

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

\n\n

 

\n

Example 1:

\n\n
\nInput: k = 2, prices = [2,4,1]\nOutput: 2\nExplanation: Buy on day 1 (price = 2) and sell on day 2 (price = 4), profit = 4-2 = 2.\n
\n\n

Example 2:

\n\n
\nInput: k = 2, prices = [3,2,6,5,0,3]\nOutput: 7\nExplanation: Buy on day 2 (price = 2) and sell on day 3 (price = 6), profit = 6-2 = 4. Then buy on day 5 (price = 0) and sell on day 6 (price = 3), profit = 3-0 = 3.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= k <= 100
  • \n\t
  • 1 <= prices.length <= 1000
  • \n\t
  • 0 <= prices[i] <= 1000
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=2 --arg2=[2 --arg3=4 --arg4=1]", - "--arg1=2 --arg2=[3 --arg3=2 --arg4=6 --arg5=5 --arg6=0 --arg7=3]", - "--arg1=1 --arg2=[1 --arg3=2]" - ], - "sample_test_results": [ - "2", - "7", - "1" - ], - "hidden_test_cases": [ - "--arg1=2 --arg2=[1 --arg3=2 --arg4=4 --arg5=2 --arg6=5 --arg7=7 --arg8=2 --arg9=4 --arg10=9 --arg11=0]", - "--arg1=1 --arg2=[7 --arg3=1 --arg4=5 --arg5=3 --arg6=6 --arg7=4]", - "--arg1=3 --arg2=[3 --arg3=3 --arg4=5 --arg5=0 --arg6=0 --arg7=3 --arg8=1 --arg9=4]", - "--arg1=4 --arg2=[1 --arg3=2 --arg4=3 --arg5=4 --arg6=5]", - "--arg1=2 --arg2=[1 --arg3=4 --arg4=5 --arg5=7 --arg6=6 --arg7=3 --arg8=2 --arg9=1]", - "--arg1=3 --arg2=1", - "--arg1=1 --arg2=[7 --arg3=6 --arg4=5 --arg5=4 --arg6=3 --arg7=2]", - "--arg1=2 --arg2=[1 --arg3=2 --arg4=3 --arg5=4 --arg6=5 --arg7=6]", - "--arg1=5 --arg2=[3 --arg3=2 --arg4=6 --arg5=5 --arg6=0 --arg7=3 --arg8=1 --arg9=4]", - "--arg1=2 --arg2=[2 --arg3=1 --arg4=4 --arg5=5 --arg6=2 --arg7=9 --arg8=7]" - ], - "hidden_test_results": [ - "13", - "5", - "8", - "4", - "6", - "0", - "0", - "5", - "10", - "11" - ], - "boilerplate": { - "python": "class Solution:\n def maxProfit(self, k: int, prices: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int maxProfit(int k, List prices) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maxProfit(int k, vector& prices) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "std::to_string(result) == expected" - }, - "explanation": "https://www.youtube.com/watch?v=NshLjAWa03c&pp=ygUrTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJVg%3D%3D" + "title": "Best Time to Buy and Sell Stock IV", + "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/", + "description": "

You are given an integer array prices where prices[i] is the price of a given stock on the ith day, and an integer k.

\n\n

Find the maximum profit you can achieve. You may complete at most k transactions: i.e. you may buy at most k times and sell at most k times.

\n\n

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

\n\n

 

\n

Example 1:

\n\n
\nInput: k = 2, prices = [2,4,1]\nOutput: 2\nExplanation: Buy on day 1 (price = 2) and sell on day 2 (price = 4), profit = 4-2 = 2.\n
\n\n

Example 2:

\n\n
\nInput: k = 2, prices = [3,2,6,5,0,3]\nOutput: 7\nExplanation: Buy on day 2 (price = 2) and sell on day 3 (price = 6), profit = 6-2 = 4. Then buy on day 5 (price = 0) and sell on day 6 (price = 3), profit = 3-0 = 3.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= k <= 100
  • \n\t
  • 1 <= prices.length <= 1000
  • \n\t
  • 0 <= prices[i] <= 1000
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=2 --arg2=[2,4,1]", + "--arg1=2 --arg2=[3,2,6,5,0,3]", + "--arg1=1 --arg2=[1,2]" + ], + "sample_test_results": [ + "2", + "7", + "1" + ], + "hidden_test_cases": [ + "--arg1=2 --arg2=[1,2,4,2,5,7,2,4,9,0]", + "--arg1=1 --arg2=[7,1,5,3,6,4]", + "--arg1=3 --arg2=[3,3,5,0,0,3,1,4]", + "--arg1=4 --arg2=[1,2,3,4,5]", + "--arg1=2 --arg2=[1,4,5,7,6,3,2,1]", + "--arg1=3 --arg2=[1]", + "--arg1=1 --arg2=[7,6,5,4,3,2]", + "--arg1=2 --arg2=[1,2,3,4,5,6]", + "--arg1=5 --arg2=[3,2,6,5,0,3,1,4]", + "--arg1=2 --arg2=[2,1,4,5,2,9,7]" + ], + "hidden_test_results": [ + "13", + "5", + "8", + "4", + "6", + "0", + "0", + "5", + "10", + "11" + ], + "boilerplate": { + "python": "class Solution:\n def maxProfit(self, k: int, prices: List[int]) -> int:\n ", + "java": "import java.util.List;\n\nclass Solution {\n public int maxProfit(int k, List prices) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxProfit(int k, vector& prices) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "std::to_string(result) == expected" + }, + "explanation": "https://www.youtube.com/watch?v=NshLjAWa03c&pp=ygUrTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJVg%3D%3D", + "method_name": "maxProfit" }, { - "title": "The Skyline Problem", - "source": "https://leetcode.com/problems/the-skyline-problem/", - "description": "

A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of all the buildings, return the skyline formed by these buildings collectively.

\n\n

The geometric information of each building is given in the array buildings where buildings[i] = [lefti, righti, heighti]:

\n\n
    \n\t
  • lefti is the x coordinate of the left edge of the ith building.
  • \n\t
  • righti is the x coordinate of the right edge of the ith building.
  • \n\t
  • heighti is the height of the ith building.
  • \n
\n\n

You may assume all buildings are perfect rectangles grounded on an absolutely flat surface at height 0.

\n\n

The skyline should be represented as a list of "key points" sorted by their x-coordinate in the form [[x1,y1],[x2,y2],...]. Each key point is the left endpoint of some horizontal segment in the skyline except the last point in the list, which always has a y-coordinate 0 and is used to mark the skyline's termination where the rightmost building ends. Any ground between the leftmost and rightmost buildings should be part of the skyline's contour.

\n\n

Note: There must be no consecutive horizontal lines of equal height in the output skyline. For instance, [...,[2 3],[4 5],[7 5],[11 5],[12 7],...] is not acceptable; the three lines of height 5 should be merged into one in the final output as such: [...,[2 3],[4 5],[12 7],...]

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: buildings = [[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]\nOutput: [[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]\nExplanation:\nFigure A shows the buildings of the input.\nFigure B shows the skyline formed by those buildings. The red points in figure B represent the key points in the output list.\n
\n\n

Example 2:

\n\n
\nInput: buildings = [[0,2,3],[2,5,3]]\nOutput: [[0,3],[5,0]]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= buildings.length <= 104
  • \n\t
  • 0 <= lefti < righti <= 231 - 1
  • \n\t
  • 1 <= heighti <= 231 - 1
  • \n\t
  • buildings is sorted by lefti in non-decreasing order.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=[2,9,10 --arg2=3,7,15 --arg3=5,12,12 --arg4=15,20,10 --arg5=19,24,8 --arg6=]", - "--arg1=[0,2,3 --arg2=2,5,3 --arg3=]" - ], - "sample_test_results": [ - "[2, 10], [3, 15], [7, 12], [12, 0], [15, 10], [20, 8], [24, 0]", - "[0, 3], [5, 0]" - ], - "hidden_test_cases": [ - "--arg1=[1,5,11 --arg2=2,7,6 --arg3=3,9,13 --arg4=12,16,7 --arg5=14,25,3 --arg6=19,22,18 --arg7=23,29,13 --arg8=24,28,4 --arg9=]", - "--arg1=[1,2,1 --arg2=1,2,2 --arg3=1,2,3 --arg4=]", - "--arg1=[1,10,10 --arg2=]", - "--arg1=[1,5,3 --arg2=2,4,4 --arg3=]", - "--arg1=[1,5,11 --arg2=2,3,13 --arg3=]", - "--arg1=[0,3,3 --arg2=1,5,3 --arg3=2,4,3 --arg4=]", - "--arg1=[2,4,70 --arg2=3,8,30 --arg3=6,100,41 --arg4=7,15,70 --arg5=10,30,102 --arg6=15,25,76 --arg7=60,80,91 --arg8=70,90,72 --arg9=85,120,59 --arg10=]", - "--arg1=[1,20,1 --arg2=1,21,2 --arg3=1,22,3 --arg4=]", - "--arg1=[0,5,7 --arg2=5,10,7 --arg3=5,10,12 --arg4=10,15,7 --arg5=15,20,7 --arg6=15,20,12 --arg7=20,25,7 --arg8=]", - "--arg1=[1,2,1 --arg2=]" - ], - "hidden_test_results": [ - "[1, 11], [3, 13], [9, 0], [12, 7], [16, 3], [19, 18], [22, 3], [23, 13], [29, 0]", - "[1, 3], [2, 0]", - "[1, 10], [10, 0]", - "[1, 3], [2, 4], [4, 3], [5, 0]", - "[1, 11], [2, 13], [3, 11], [5, 0]", - "[0, 3], [5, 0]", - "[2, 70], [4, 30], [6, 41], [7, 70], [10, 102], [30, 41], [60, 91], [80, 72], [90, 59], [120, 0]", - "[1, 3], [22, 0]", - "[0, 7], [5, 12], [10, 7], [15, 12], [20, 7], [25, 0]", - "[1, 1], [2, 0]" - ], - "boilerplate": { - "python": "class Solution:\n def getSkyline(self, buildings: List[List[int]]) -> List[List[int]]:\n ", - "java": "class Solution {\n public List> getSkyline(List> buildings) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n vector> getSkyline(vector>& buildings) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=XhzHXj7wrwo&pp=ygUcTmVldENvZGUgVGhlIFNreWxpbmUgUHJvYmxlbQ%3D%3D" + "title": "The Skyline Problem", + "source": "https://leetcode.com/problems/the-skyline-problem/", + "description": "

A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of all the buildings, return the skyline formed by these buildings collectively.

\n\n

The geometric information of each building is given in the array buildings where buildings[i] = [lefti, righti, heighti]:

\n\n
    \n\t
  • lefti is the x coordinate of the left edge of the ith building.
  • \n\t
  • righti is the x coordinate of the right edge of the ith building.
  • \n\t
  • heighti is the height of the ith building.
  • \n
\n\n

You may assume all buildings are perfect rectangles grounded on an absolutely flat surface at height 0.

\n\n

The skyline should be represented as a list of "key points" sorted by their x-coordinate in the form [[x1,y1],[x2,y2],...]. Each key point is the left endpoint of some horizontal segment in the skyline except the last point in the list, which always has a y-coordinate 0 and is used to mark the skyline's termination where the rightmost building ends. Any ground between the leftmost and rightmost buildings should be part of the skyline's contour.

\n\n

Note: There must be no consecutive horizontal lines of equal height in the output skyline. For instance, [...,[2 3],[4 5],[7 5],[11 5],[12 7],...] is not acceptable; the three lines of height 5 should be merged into one in the final output as such: [...,[2 3],[4 5],[12 7],...]

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: buildings = [[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]\nOutput: [[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]\nExplanation:\nFigure A shows the buildings of the input.\nFigure B shows the skyline formed by those buildings. The red points in figure B represent the key points in the output list.\n
\n\n

Example 2:

\n\n
\nInput: buildings = [[0,2,3],[2,5,3]]\nOutput: [[0,3],[5,0]]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= buildings.length <= 104
  • \n\t
  • 0 <= lefti < righti <= 231 - 1
  • \n\t
  • 1 <= heighti <= 231 - 1
  • \n\t
  • buildings is sorted by lefti in non-decreasing order.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]", + "--arg1=[[0,2,3],[2,5,3]]" + ], + "sample_test_results": [ + "[[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]", + "[[0,3],[5,0]]" + ], + "hidden_test_cases": [ + "--arg1=[[1,5,11],[2,7,6],[3,9,13],[12,16,7],[14,25,3],[19,22,18],[23,29,13],[24,28,4]]", + "--arg1=[[1,2,1],[1,2,2],[1,2,3]]", + "--arg1=[[1,10,10]]", + "--arg1=[[1,5,3],[2,4,4]]", + "--arg1=[[1,5,11],[2,3,13]]", + "--arg1=[[0,3,3],[1,5,3],[2,4,3]]", + "--arg1=[[2,4,70],[3,8,30],[6,100,41],[7,15,70],[10,30,102],[15,25,76],[60,80,91],[70,90,72],[85,120,59]]", + "--arg1=[[1,20,1],[1,21,2],[1,22,3]]", + "--arg1=[[0,5,7],[5,10,7],[5,10,12],[10,15,7],[15,20,7],[15,20,12],[20,25,7]]", + "--arg1=[[1,2,1]]" + ], + "hidden_test_results": [ + "[[1,11],[3,13],[9,0],[12,7],[16,3],[19,18],[22,3],[23,13],[29,0]]", + "[[1,3],[2,0]]", + "[[1,10],[10,0]]", + "[[1,3],[2,4],[4,3],[5,0]]", + "[[1,11],[2,13],[3,11],[5,0]]", + "[[0,3],[5,0]]", + "[[2,70],[4,30],[6,41],[7,70],[10,102],[30,41],[60,91],[80,72],[90,59],[120,0]]", + "[[1,3],[22,0]]", + "[[0,7],[5,12],[10,7],[15,12],[20,7],[25,0]]", + "[[1,1],[2,0]]" + ], + "boilerplate": { + "python": "class Solution:\n def getSkyline(self, buildings: List[List[int]]) -> List[List[int]]:\n ", + "java": "class Solution {\n public List> getSkyline(List> buildings) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector> getSkyline(vector>& buildings) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=XhzHXj7wrwo&pp=ygUcTmVldENvZGUgVGhlIFNreWxpbmUgUHJvYmxlbQ%3D%3D", + "method_name": "getSkyline" }, { - "title": "Basic Calculator", - "source": "https://leetcode.com/problems/basic-calculator/", - "description": "

Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation.

\n\n

Note: You are not allowed to use any built-in function which evaluates strings as mathematical expressions, such as eval().

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "1 + 1"\nOutput: 2\n
\n\n

Example 2:

\n\n
\nInput: s = " 2-1 + 2 "\nOutput: 3\n
\n\n

Example 3:

\n\n
\nInput: s = "(1+(4+5+2)-3)+(6+8)"\nOutput: 23\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 3 * 105
  • \n\t
  • s consists of digits, '+', '-', '(', ')', and ' '.
  • \n\t
  • s represents a valid expression.
  • \n\t
  • '+' is not used as a unary operation (i.e., "+1" and "+(2 + 3)" is invalid).
  • \n\t
  • '-' could be used as a unary operation (i.e., "-1" and "-(2 + 3)" is valid).
  • \n\t
  • There will be no two consecutive operators in the input.
  • \n\t
  • Every number and running calculation will fit in a signed 32-bit integer.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=\"1 + 1\"", - "--arg1=\" 2-1 + 2 \"", - "--arg1=\"(1+(4+5+2)-3)+(6+8)\"" - ], - "sample_test_results": [ - "2", - "3", - "23" - ], - "hidden_test_cases": [ - "--arg1=\"2147483647\"", - "--arg1=\"1 + (2 + 3)\"", - "--arg1=\"-(2 + 3)\"", - "--arg1=\"(1+(4+5+2)-3)+(6+8)\"", - "--arg1=\"2-4-(8+2-6+(8+4-(1)+8-10))\"", - "--arg1=\"(5-(1+(5)))\"", - "--arg1=\"(-2)+3\"", - "--arg1=\"1-(-2)\"", - "--arg1=\"1+2-3+(4+5-6)\"", - "--arg1=\"(7)-(0)+(4)\"" - ], - "hidden_test_results": [ - "2147483647", - "6", - "-5", - "23", - "-15", - "-1", - "1", - "3", - "3", - "11" - ], - "boilerplate": { - "python": "class Solution:\n def calculate(self, s: str) -> int:\n ", - "java": "class Solution {\n public int calculate(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int calculate(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return stoi(result) == stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=zsJ-J08Qgdk&pp=ygUZTmVldENvZGUgQmFzaWMgQ2FsY3VsYXRvcg%3D%3D" + "title": "Basic Calculator", + "source": "https://leetcode.com/problems/basic-calculator/", + "description": "

Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation.

\n\n

Note: You are not allowed to use any built-in function which evaluates strings as mathematical expressions, such as eval().

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "1 + 1"\nOutput: 2\n
\n\n

Example 2:

\n\n
\nInput: s = " 2-1 + 2 "\nOutput: 3\n
\n\n

Example 3:

\n\n
\nInput: s = "(1+(4+5+2)-3)+(6+8)"\nOutput: 23\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 3 * 105
  • \n\t
  • s consists of digits, '+', '-', '(', ')', and ' '.
  • \n\t
  • s represents a valid expression.
  • \n\t
  • '+' is not used as a unary operation (i.e., "+1" and "+(2 + 3)" is invalid).
  • \n\t
  • '-' could be used as a unary operation (i.e., "-1" and "-(2 + 3)" is valid).
  • \n\t
  • There will be no two consecutive operators in the input.
  • \n\t
  • Every number and running calculation will fit in a signed 32-bit integer.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=\"1 + 1\"", + "--arg1=\" 2-1 + 2 \"", + "--arg1=\"(1+(4+5+2)-3)+(6+8)\"" + ], + "sample_test_results": [ + "2", + "3", + "23" + ], + "hidden_test_cases": [ + "--arg1=\"2147483647\"", + "--arg1=\"1 + (2 + 3)\"", + "--arg1=\"-(2 + 3)\"", + "--arg1=\"(1+(4+5+2)-3)+(6+8)\"", + "--arg1=\"2-4-(8+2-6+(8+4-(1)+8-10))\"", + "--arg1=\"(5-(1+(5)))\"", + "--arg1=\"(-2)+3\"", + "--arg1=\"1-(-2)\"", + "--arg1=\"1+2-3+(4+5-6)\"", + "--arg1=\"(7)-(0)+(4)\"" + ], + "hidden_test_results": [ + "2147483647", + "6", + "-5", + "23", + "-15", + "-1", + "1", + "3", + "3", + "11" + ], + "boilerplate": { + "python": "class Solution:\n def calculate(self, s: str) -> int:\n ", + "java": "class Solution {\n public int calculate(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int calculate(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return stoi(result) == stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=zsJ-J08Qgdk&pp=ygUZTmVldENvZGUgQmFzaWMgQ2FsY3VsYXRvcg%3D%3D", + "method_name": "calculate" }, { - "title": "Sliding Window Maximum", - "source": "https://leetcode.com/problems/sliding-window-maximum/", - "description": "

You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.

\n\n

Return the max sliding window.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,3,-1,-3,5,3,6,7], k = 3\nOutput: [3,3,5,5,6,7]\nExplanation: \nWindow position                Max\n---------------               -----\n[1  3  -1] -3  5  3  6  7       3\n 1 [3  -1  -3] 5  3  6  7       3\n 1  3 [-1  -3  5] 3  6  7       5\n 1  3  -1 [-3  5  3] 6  7       5\n 1  3  -1  -3 [5  3  6] 7       6\n 1  3  -1  -3  5 [3  6  7]      7\n
\n\n

Example 2:

\n\n
\nInput: nums = [1], k = 1\nOutput: [1]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • 1 <= k <= nums.length
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=1,3,-1,-3,5,3,6,7 --arg2=3", - "--arg1=1 --arg2=1" - ], - "sample_test_results": [ - "3, 3, 5, 5, 6, 7", - "1" - ], - "hidden_test_cases": [ - "--arg1=1,3,1,2,0,5 --arg2=3", - "--arg1=7,2,4 --arg2=2", - "--arg1=1,-1 --arg2=1", - "--arg1=1,2,3,4,5 --arg2=5", - "--arg1=1,2,3,4,5,6 --arg2=1", - "--arg1=-7,-8,7,5,7,1,6,0 --arg2=4", - "--arg1=1,1,1,1 --arg2=2", - "--arg1=4,2,0,-1,3,5 --arg2=3", - "--arg1=-1,-2,-3,-4 --arg2=2", - "--arg1=1,2,3,2,1 --arg2=3" - ], - "hidden_test_results": [ - "3, 3, 2, 5", - "7, 4", - "1, -1", - "5", - "1, 2, 3, 4, 5, 6", - "7, 7, 7, 7, 7", - "1, 1, 1", - "4, 2, 3, 5", - "-1, -2, -3", - "3, 3, 3" - ], - "boilerplate": { - "python": "class Solution:\n def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:\n ", - "java": "class Solution {\n public List maxSlidingWindow(List nums, int k) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::vector maxSlidingWindow(std::vector& nums, int k) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == eval(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=DfljaUwZsOk&pp=ygUfTmVldENvZGUgU2xpZGluZyBXaW5kb3cgTWF4aW11bQ%3D%3D" + "title": "Sliding Window Maximum", + "source": "https://leetcode.com/problems/sliding-window-maximum/", + "description": "

You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.

\n\n

Return the max sliding window.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,3,-1,-3,5,3,6,7], k = 3\nOutput: [3,3,5,5,6,7]\nExplanation: \nWindow position                Max\n---------------               -----\n[1  3  -1] -3  5  3  6  7       3\n 1 [3  -1  -3] 5  3  6  7       3\n 1  3 [-1  -3  5] 3  6  7       5\n 1  3  -1 [-3  5  3] 6  7       5\n 1  3  -1  -3 [5  3  6] 7       6\n 1  3  -1  -3  5 [3  6  7]      7\n
\n\n

Example 2:

\n\n
\nInput: nums = [1], k = 1\nOutput: [1]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • 1 <= k <= nums.length
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[1,3,-1,-3,5,3,6,7] --arg2=3", + "--arg1=[1] --arg2=1" + ], + "sample_test_results": [ + "[3,3,5,5,6,7]", + "[1]" + ], + "hidden_test_cases": [ + "--arg1=[1,3,1,2,0,5] --arg2=3", + "--arg1=[7,2,4] --arg2=2", + "--arg1=[1,-1] --arg2=1", + "--arg1=[1,2,3,4,5] --arg2=5", + "--arg1=[1,2,3,4,5,6] --arg2=1", + "--arg1=[-7,-8,7,5,7,1,6,0] --arg2=4", + "--arg1=[1,1,1,1] --arg2=2", + "--arg1=[4,2,0,-1,3,5] --arg2=3", + "--arg1=[-1,-2,-3,-4] --arg2=2", + "--arg1=[1,2,3,2,1] --arg2=3" + ], + "hidden_test_results": [ + "[3,3,2,5]", + "[7,4]", + "[1,-1]", + "[5]", + "[1,2,3,4,5,6]", + "[7,7,7,7,7]", + "[1,1,1]", + "[4,2,3,5]", + "[-1,-2,-3]", + "[3,3,3]" + ], + "boilerplate": { + "python": "class Solution:\n def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:\n ", + "java": "class Solution {\n public List maxSlidingWindow(List nums, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n std::vector maxSlidingWindow(std::vector& nums, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == eval(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=DfljaUwZsOk&pp=ygUfTmVldENvZGUgU2xpZGluZyBXaW5kb3cgTWF4aW11bQ%3D%3D", + "method_name": "maxSlidingWindow" }, { - "title": "Expression Add Operators", - "source": "https://leetcode.com/problems/expression-add-operators/", - "description": "

Given a string num that contains only digits and an integer target, return all possibilities to insert the binary operators '+', '-', and/or '*' between the digits of num so that the resultant expression evaluates to the target value.

\n\n

Note that operands in the returned expressions should not contain leading zeros.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = "123", target = 6\nOutput: ["1*2*3","1+2+3"]\nExplanation: Both "1*2*3" and "1+2+3" evaluate to 6.\n
\n\n

Example 2:

\n\n
\nInput: num = "232", target = 8\nOutput: ["2*3+2","2+3*2"]\nExplanation: Both "2*3+2" and "2+3*2" evaluate to 8.\n
\n\n

Example 3:

\n\n
\nInput: num = "3456237490", target = 9191\nOutput: []\nExplanation: There are no expressions that can be created from "3456237490" to evaluate to 9191.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num.length <= 10
  • \n\t
  • num consists of only digits.
  • \n\t
  • -231 <= target <= 231 - 1
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=\"123\" --arg2=6", - "--arg1=\"232\" --arg2=8", - "--arg1=\"3456237490\" --arg2=9191" - ], - "sample_test_results": [ - "'1+2+3', '1*2*3'", - "'2+3*2', '2*3+2'", - "" - ], - "hidden_test_cases": [ - "--arg1=\"123\" --arg2=6", - "--arg1=\"232\" --arg2=8", - "--arg1=\"105\" --arg2=5", - "--arg1=\"00\" --arg2=0", - "--arg1=\"3456237490\" --arg2=9191", - "--arg1=\"1000000009\" --arg2=9", - "--arg1=\"2147483648\" --arg2=-2147483648", - "--arg1=\"999999999\" --arg2=999999999", - "--arg1=\"01\" --arg2=1", - "--arg1=\"1234\" --arg2=11" - ], - "hidden_test_results": [ - "'1+2+3', '1*2*3'", - "'2+3*2', '2*3+2'", - "'1*0+5', '10-5'", - "'0+0', '0-0', '0*0'", - "", - "'1*0+0+0+0+0+0+0+0+9', '1*0+0+0+0+0+0+0-0+9', '1*0+0+0+0+0+0+0*0+9', '1*0+0+0+0+0+0-0+0+9', '1*0+0+0+0+0+0-0-0+9', '1*0+0+0+0+0+0-0*0+9', '1*0+0+0+0+0+0*0+0+9', '1*0+0+0+0+0+0*0-0+9', '1*0+0+0+0+0+0*0*0+9', '1*0+0+0+0+0-0+0+0+9', '1*0+0+0+0+0-0+0-0+9', '1*0+0+0+0+0-0+0*0+9', '1*0+0+0+0+0-0-0+0+9', '1*0+0+0+0+0-0-0-0+9', '1*0+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*0+9', '1*0*0*0*0*0+0+0+0+9', '1*0*0*0*0*0+0+0-0+9', '1*0*0*0*0*0+0+0*0+9', '1*0*0*0*0*0+0-0+0+9', '1*0*0*0*0*0+0-0-0+9', '1*0*0*0*0*0+0-0*0+9', '1*0*0*0*0*0+0*0+0+9', '1*0*0*0*0*0+0*0-0+9', '1*0*0*0*0*0+0*0*0+9', '1*0*0*0*0*0-0+0+0+9', '1*0*0*0*0*0-0+0-0+9', '1*0*0*0*0*0-0+0*0+9', '1*0*0*0*0*0-0-0+0+9', '1*0*0*0*0*0-0-0-0+9', '1*0*0*0*0*0-0-0*0+9', '1*0*0*0*0*0-0*0+0+9', '1*0*0*0*0*0-0*0-0+9', '1*0*0*0*0*0-0*0*0+9', '1*0*0*0*0*0*0+0+0+9', '1*0*0*0*0*0*0+0-0+9', '1*0*0*0*0*0*0+0*0+9', '1*0*0*0*0*0*0-0+0+9', '1*0*0*0*0*0*0-0-0+9', '1*0*0*0*0*0*0-0*0+9', '1*0*0*0*0*0*0*0+0+9', '1*0*0*0*0*0*0*0-0+9', '1*0*0*0*0*0*0*0*0+9', '10*0+0+0+0+0+0+0+9', '10*0+0+0+0+0+0-0+9', '10*0+0+0+0+0+0*0+9', '10*0+0+0+0+0-0+0+9', '10*0+0+0+0+0-0-0+9', '10*0+0+0+0+0-0*0+9', '10*0+0+0+0+0*0+0+9', '10*0+0+0+0+0*0-0+9', '10*0+0+0+0+0*0*0+9', '10*0+0+0+0-0+0+0+9', '10*0+0+0+0-0+0-0+9', '10*0+0+0+0-0+0*0+9', '10*0+0+0+0-0-0+0+9', '10*0+0+0+0-0-0-0+9', '10*0+0+0+0-0-0*0+9', '10*0+0+0+0-0*0+0+9', '10*0+0+0+0-0*0-0+9', '10*0+0+0+0-0*0*0+9', '10*0+0+0+0*0+0+0+9', '10*0+0+0+0*0+0-0+9', '10*0+0+0+0*0+0*0+9', '10*0+0+0+0*0-0+0+9', '10*0+0+0+0*0-0-0+9', '10*0+0+0+0*0-0*0+9', '10*0+0+0+0*0*0+0+9', '10*0+0+0+0*0*0-0+9', '10*0+0+0+0*0*0*0+9', '10*0+0+0-0+0+0+0+9', '10*0+0+0-0+0+0-0+9', '10*0+0+0-0+0+0*0+9', '10*0+0+0-0+0-0+0+9', '10*0+0+0-0+0-0-0+9', '10*0+0+0-0+0-0*0+9', '10*0+0+0-0+0*0+0+9', '10*0+0+0-0+0*0-0+9', '10*0+0+0-0+0*0*0+9', '10*0+0+0-0-0+0+0+9', '10*0+0+0-0-0+0-0+9', '10*0+0+0-0-0+0*0+9', '10*0+0+0-0-0-0+0+9', '10*0+0+0-0-0-0-0+9', '10*0+0+0-0-0-0*0+9', '10*0+0+0-0-0*0+0+9', '10*0+0+0-0-0*0-0+9', '10*0+0+0-0-0*0*0+9', '10*0+0+0-0*0+0+0+9', '10*0+0+0-0*0+0-0+9', '10*0+0+0-0*0+0*0+9', '10*0+0+0-0*0-0+0+9', '10*0+0+0-0*0-0-0+9', '10*0+0+0-0*0-0*0+9', '10*0+0+0-0*0*0+0+9', '10*0+0+0-0*0*0-0+9', '10*0+0+0-0*0*0*0+9', '10*0+0+0*0+0+0+0+9', '10*0+0+0*0+0+0-0+9', '10*0+0+0*0+0+0*0+9', '10*0+0+0*0+0-0+0+9', '10*0+0+0*0+0-0-0+9', '10*0+0+0*0+0-0*0+9', '10*0+0+0*0+0*0+0+9', '10*0+0+0*0+0*0-0+9', '10*0+0+0*0+0*0*0+9', '10*0+0+0*0-0+0+0+9', '10*0+0+0*0-0+0-0+9', '10*0+0+0*0-0+0*0+9', '10*0+0+0*0-0-0+0+9', '10*0+0+0*0-0-0-0+9', '10*0+0+0*0-0-0*0+9', '10*0+0+0*0-0*0+0+9', '10*0+0+0*0-0*0-0+9', '10*0+0+0*0-0*0*0+9', '10*0+0+0*0*0+0+0+9', '10*0+0+0*0*0+0-0+9', '10*0+0+0*0*0+0*0+9', '10*0+0+0*0*0-0+0+9', '10*0+0+0*0*0-0-0+9', '10*0+0+0*0*0-0*0+9', '10*0+0+0*0*0*0+0+9', '10*0+0+0*0*0*0-0+9', '10*0+0+0*0*0*0*0+9', '10*0+0-0+0+0+0+0+9', '10*0+0-0+0+0+0-0+9', '10*0+0-0+0+0+0*0+9', '10*0+0-0+0+0-0+0+9', '10*0+0-0+0+0-0-0+9', '10*0+0-0+0+0-0*0+9', '10*0+0-0+0+0*0+0+9', '10*0+0-0+0+0*0-0+9', '10*0+0-0+0+0*0*0+9', '10*0+0-0+0-0+0+0+9', '10*0+0-0+0-0+0-0+9', '10*0+0-0+0-0+0*0+9', '10*0+0-0+0-0-0+0+9', '10*0+0-0+0-0-0-0+9', '10*0+0-0+0-0-0*0+9', '10*0+0-0+0-0*0+0+9', '10*0+0-0+0-0*0-0+9', '10*0+0-0+0-0*0*0+9', '10*0+0-0+0*0+0+0+9', '10*0+0-0+0*0+0-0+9', '10*0+0-0+0*0+0*0+9', '10*0+0-0+0*0-0+0+9', '10*0+0-0+0*0-0-0+9', '10*0+0-0+0*0-0*0+9', '10*0+0-0+0*0*0+0+9', '10*0+0-0+0*0*0-0+9', '10*0+0-0+0*0*0*0+9', '10*0+0-0-0+0+0+0+9', '10*0+0-0-0+0+0-0+9', '10*0+0-0-0+0+0*0+9', '10*0+0-0-0+0-0+0+9', '10*0+0-0-0+0-0-0+9', '10*0+0-0-0+0-0*0+9', '10*0+0-0-0+0*0+0+9', '10*0+0-0-0+0*0-0+9', '10*0+0-0-0+0*0*0+9', '10*0+0-0-0-0+0+0+9', '10*0+0-0-0-0+0-0+9', '10*0+0-0-0-0+0*0+9', '10*0+0-0-0-0-0+0+9', '10*0+0-0-0-0-0-0+9', '10*0+0-0-0-0-0*0+9', '10*0+0-0-0-0*0+0+9', '10*0+0-0-0-0*0-0+9', '10*0+0-0-0-0*0*0+9', '10*0+0-0-0*0+0+0+9', '10*0+0-0-0*0+0-0+9', '10*0+0-0-0*0+0*0+9', '10*0+0-0-0*0-0+0+9', '10*0+0-0-0*0-0-0+9', '10*0+0-0-0*0-0*0+9', '10*0+0-0-0*0*0+0+9', '10*0+0-0-0*0*0-0+9', '10*0+0-0-0*0*0*0+9', '10*0+0-0*0+0+0+0+9', '10*0+0-0*0+0+0-0+9', '10*0+0-0*0+0+0*0+9', '10*0+0-0*0+0-0+0+9', '10*0+0-0*0+0-0-0+9', '10*0+0-0*0+0-0*0+9', '10*0+0-0*0+0*0+0+9', '10*0+0-0*0+0*0-0+9', '10*0+0-0*0+0*0*0+9', '10*0+0-0*0-0+0+0+9', '10*0+0-0*0-0+0-0+9', '10*0+0-0*0-0+0*0+9', '10*0+0-0*0-0-0+0+9', '10*0+0-0*0-0-0-0+9', '10*0+0-0*0-0-0*0+9', '10*0+0-0*0-0*0+0+9', '10*0+0-0*0-0*0-0+9', '10*0+0-0*0-0*0*0+9', '10*0+0-0*0*0+0+0+9', '10*0+0-0*0*0+0-0+9', '10*0+0-0*0*0+0*0+9', '10*0+0-0*0*0-0+0+9', '10*0+0-0*0*0-0-0+9', '10*0+0-0*0*0-0*0+9', '10*0+0-0*0*0*0+0+9', '10*0+0-0*0*0*0-0+9', '10*0+0-0*0*0*0*0+9', '10*0+0*0+0+0+0+0+9', '10*0+0*0+0+0+0-0+9', '10*0+0*0+0+0+0*0+9', '10*0+0*0+0+0-0+0+9', '10*0+0*0+0+0-0-0+9', '10*0+0*0+0+0-0*0+9', '10*0+0*0+0+0*0+0+9', '10*0+0*0+0+0*0-0+9', '10*0+0*0+0+0*0*0+9', '10*0+0*0+0-0+0+0+9', '10*0+0*0+0-0+0-0+9', '10*0+0*0+0-0+0*0+9', '10*0+0*0+0-0-0+0+9', '10*0+0*0+0-0-0-0+9', '10*0+0*0+0-0-0*0+9', '10*0+0*0+0-0*0+0+9', '10*0+0*0+0-0*0-0+9', '10*0+0*0+0-0*0*0+9', '10*0+0*0+0*0+0+0+9', '10*0+0*0+0*0+0-0+9', '10*0+0*0+0*0+0*0+9', '10*0+0*0+0*0-0+0+9', '10*0+0*0+0*0-0-0+9', '10*0+0*0+0*0-0*0+9', '10*0+0*0+0*0*0+0+9', '10*0+0*0+0*0*0-0+9', '10*0+0*0+0*0*0*0+9', '10*0+0*0-0+0+0+0+9', '10*0+0*0-0+0+0-0+9', '10*0+0*0-0+0+0*0+9', '10*0+0*0-0+0-0+0+9', '10*0+0*0-0+0-0-0+9', '10*0+0*0-0+0-0*0+9', '10*0+0*0-0+0*0+0+9', '10*0+0*0-0+0*0-0+9', '10*0+0*0-0+0*0*0+9', '10*0+0*0-0-0+0+0+9', '10*0+0*0-0-0+0-0+9', '10*0+0*0-0-0+0*0+9', '10*0+0*0-0-0-0+0+9', '10*0+0*0-0-0-0-0+9', '10*0+0*0-0-0-0*0+9', '10*0+0*0-0-0*0+0+9', '10*0+0*0-0-0*0-0+9', '10*0+0*0-0-0*0*0+9', '10*0+0*0-0*0+0+0+9', '10*0+0*0-0*0+0-0+9', '10*0+0*0-0*0+0*0+9', '10*0+0*0-0*0-0+0+9', '10*0+0*0-0*0-0-0+9', '10*0+0*0-0*0-0*0+9', '10*0+0*0-0*0*0+0+9', '10*0+0*0-0*0*0-0+9', '10*0+0*0-0*0*0*0+9', '10*0+0*0*0+0+0+0+9', '10*0+0*0*0+0+0-0+9', '10*0+0*0*0+0+0*0+9', '10*0+0*0*0+0-0+0+9', '10*0+0*0*0+0-0-0+9', '10*0+0*0*0+0-0*0+9', '10*0+0*0*0+0*0+0+9', '10*0+0*0*0+0*0-0+9', '10*0+0*0*0+0*0*0+9', '10*0+0*0*0-0+0+0+9', '10*0+0*0*0-0+0-0+9', '10*0+0*0*0-0+0*0+9', '10*0+0*0*0-0-0+0+9', '10*0+0*0*0-0-0-0+9', '10*0+0*0*0-0-0*0+9', '10*0+0*0*0-0*0+0+9', '10*0+0*0*0-0*0-0+9', '10*0+0*0*0-0*0*0+9', '10*0+0*0*0*0+0+0+9', '10*0+0*0*0*0+0-0+9', '10*0+0*0*0*0+0*0+9', '10*0+0*0*0*0-0+0+9', '10*0+0*0*0*0-0-0+9', '10*0+0*0*0*0-0*0+9', '10*0+0*0*0*0*0+0+9', '10*0+0*0*0*0*0-0+9', '10*0+0*0*0*0*0*0+9', '10*0-0+0+0+0+0+0+9', '10*0-0+0+0+0+0-0+9', '10*0-0+0+0+0+0*0+9', '10*0-0+0+0+0-0+0+9', '10*0-0+0+0+0-0-0+9', '10*0-0+0+0+0-0*0+9', '10*0-0+0+0+0*0+0+9', '10*0-0+0+0+0*0-0+9', '10*0-0+0+0+0*0*0+9', '10*0-0+0+0-0+0+0+9', '10*0-0+0+0-0+0-0+9', '10*0-0+0+0-0+0*0+9', '10*0-0+0+0-0-0+0+9', '10*0-0+0+0-0-0-0+9', '10*0-0+0+0-0-0*0+9', '10*0-0+0+0-0*0+0+9', '10*0-0+0+0-0*0-0+9', '10*0-0+0+0-0*0*0+9', '10*0-0+0+0*0+0+0+9', '10*0-0+0+0*0+0-0+9', '10*0-0+0+0*0+0*0+9', '10*0-0+0+0*0-0+0+9', '10*0-0+0+0*0-0-0+9', '10*0-0+0+0*0-0*0+9', '10*0-0+0+0*0*0+0+9', '10*0-0+0+0*0*0-0+9', '10*0-0+0+0*0*0*0+9', '10*0-0+0-0+0+0+0+9', '10*0-0+0-0+0+0-0+9', '10*0-0+0-0+0+0*0+9', '10*0-0+0-0+0-0+0+9', '10*0-0+0-0+0-0-0+9', '10*0-0+0-0+0-0*0+9', '10*0-0+0-0+0*0+0+9', '10*0-0+0-0+0*0-0+9', '10*0-0+0-0+0*0*0+9', '10*0-0+0-0-0+0+0+9', '10*0-0+0-0-0+0-0+9', '10*0-0+0-0-0+0*0+9', '10*0-0+0-0-0-0+0+9', '10*0-0+0-0-0-0-0+9', '10*0-0+0-0-0-0*0+9', '10*0-0+0-0-0*0+0+9', '10*0-0+0-0-0*0-0+9', '10*0-0+0-0-0*0*0+9', '10*0-0+0-0*0+0+0+9', '10*0-0+0-0*0+0-0+9', '10*0-0+0-0*0+0*0+9', '10*0-0+0-0*0-0+0+9', '10*0-0+0-0*0-0-0+9', '10*0-0+0-0*0-0*0+9', '10*0-0+0-0*0*0+0+9', '10*0-0+0-0*0*0-0+9', '10*0-0+0-0*0*0*0+9', '10*0-0+0*0+0+0+0+9', '10*0-0+0*0+0+0-0+9', '10*0-0+0*0+0+0*0+9', '10*0-0+0*0+0-0+0+9', '10*0-0+0*0+0-0-0+9', '10*0-0+0*0+0-0*0+9', '10*0-0+0*0+0*0+0+9', '10*0-0+0*0+0*0-0+9', '10*0-0+0*0+0*0*0+9', '10*0-0+0*0-0+0+0+9', '10*0-0+0*0-0+0-0+9', '10*0-0+0*0-0+0*0+9', '10*0-0+0*0-0-0+0+9', '10*0-0+0*0-0-0-0+9', '10*0-0+0*0-0-0*0+9', '10*0-0+0*0-0*0+0+9', '10*0-0+0*0-0*0-0+9', '10*0-0+0*0-0*0*0+9', '10*0-0+0*0*0+0+0+9', '10*0-0+0*0*0+0-0+9', '10*0-0+0*0*0+0*0+9', '10*0-0+0*0*0-0+0+9', '10*0-0+0*0*0-0-0+9', '10*0-0+0*0*0-0*0+9', '10*0-0+0*0*0*0+0+9', '10*0-0+0*0*0*0-0+9', '10*0-0+0*0*0*0*0+9', '10*0-0-0+0+0+0+0+9', '10*0-0-0+0+0+0-0+9', '10*0-0-0+0+0+0*0+9', '10*0-0-0+0+0-0+0+9', '10*0-0-0+0+0-0-0+9', '10*0-0-0+0+0-0*0+9', '10*0-0-0+0+0*0+0+9', '10*0-0-0+0+0*0-0+9', '10*0-0-0+0+0*0*0+9', '10*0-0-0+0-0+0+0+9', '10*0-0-0+0-0+0-0+9', '10*0-0-0+0-0+0*0+9', '10*0-0-0+0-0-0+0+9', '10*0-0-0+0-0-0-0+9', '10*0-0-0+0-0-0*0+9', '10*0-0-0+0-0*0+0+9', '10*0-0-0+0-0*0-0+9', '10*0-0-0+0-0*0*0+9', '10*0-0-0+0*0+0+0+9', '10*0-0-0+0*0+0-0+9', '10*0-0-0+0*0+0*0+9', '10*0-0-0+0*0-0+0+9', '10*0-0-0+0*0-0-0+9', '10*0-0-0+0*0-0*0+9', '10*0-0-0+0*0*0+0+9', '10*0-0-0+0*0*0-0+9', '10*0-0-0+0*0*0*0+9', '10*0-0-0-0+0+0+0+9', '10*0-0-0-0+0+0-0+9', '10*0-0-0-0+0+0*0+9', '10*0-0-0-0+0-0+0+9', '10*0-0-0-0+0-0-0+9', '10*0-0-0-0+0-0*0+9', '10*0-0-0-0+0*0+0+9', '10*0-0-0-0+0*0-0+9', '10*0-0-0-0+0*0*0+9', '10*0-0-0-0-0+0+0+9', '10*0-0-0-0-0+0-0+9', '10*0-0-0-0-0+0*0+9', '10*0-0-0-0-0-0+0+9', '10*0-0-0-0-0-0-0+9', '10*0-0-0-0-0-0*0+9', '10*0-0-0-0-0*0+0+9', '10*0-0-0-0-0*0-0+9', '10*0-0-0-0-0*0*0+9', '10*0-0-0-0*0+0+0+9', '10*0-0-0-0*0+0-0+9', '10*0-0-0-0*0+0*0+9', '10*0-0-0-0*0-0+0+9', '10*0-0-0-0*0-0-0+9', '10*0-0-0-0*0-0*0+9', '10*0-0-0-0*0*0+0+9', '10*0-0-0-0*0*0-0+9', '10*0-0-0-0*0*0*0+9', '10*0-0-0*0+0+0+0+9', '10*0-0-0*0+0+0-0+9', '10*0-0-0*0+0+0*0+9', '10*0-0-0*0+0-0+0+9', '10*0-0-0*0+0-0-0+9', '10*0-0-0*0+0-0*0+9', '10*0-0-0*0+0*0+0+9', '10*0-0-0*0+0*0-0+9', '10*0-0-0*0+0*0*0+9', '10*0-0-0*0-0+0+0+9', '10*0-0-0*0-0+0-0+9', '10*0-0-0*0-0+0*0+9', '10*0-0-0*0-0-0+0+9', '10*0-0-0*0-0-0-0+9', '10*0-0-0*0-0-0*0+9', '10*0-0-0*0-0*0+0+9', '10*0-0-0*0-0*0-0+9', '10*0-0-0*0-0*0*0+9', '10*0-0-0*0*0+0+0+9', '10*0-0-0*0*0+0-0+9', '10*0-0-0*0*0+0*0+9', '10*0-0-0*0*0-0+0+9', '10*0-0-0*0*0-0-0+9', '10*0-0-0*0*0-0*0+9', '10*0-0-0*0*0*0+0+9', '10*0-0-0*0*0*0-0+9', '10*0-0-0*0*0*0*0+9', '10*0-0*0+0+0+0+0+9', '10*0-0*0+0+0+0-0+9', '10*0-0*0+0+0+0*0+9', '10*0-0*0+0+0-0+0+9', '10*0-0*0+0+0-0-0+9', '10*0-0*0+0+0-0*0+9', '10*0-0*0+0+0*0+0+9', '10*0-0*0+0+0*0-0+9', '10*0-0*0+0+0*0*0+9', '10*0-0*0+0-0+0+0+9', '10*0-0*0+0-0+0-0+9', '10*0-0*0+0-0+0*0+9', '10*0-0*0+0-0-0+0+9', '10*0-0*0+0-0-0-0+9', '10*0-0*0+0-0-0*0+9', '10*0-0*0+0-0*0+0+9', '10*0-0*0+0-0*0-0+9', '10*0-0*0+0-0*0*0+9', '10*0-0*0+0*0+0+0+9', '10*0-0*0+0*0+0-0+9', '10*0-0*0+0*0+0*0+9', '10*0-0*0+0*0-0+0+9', '10*0-0*0+0*0-0-0+9', '10*0-0*0+0*0-0*0+9', '10*0-0*0+0*0*0+0+9', '10*0-0*0+0*0*0-0+9', '10*0-0*0+0*0*0*0+9', '10*0-0*0-0+0+0+0+9', '10*0-0*0-0+0+0-0+9', '10*0-0*0-0+0+0*0+9', '10*0-0*0-0+0-0+0+9', '10*0-0*0-0+0-0-0+9', '10*0-0*0-0+0-0*0+9', '10*0-0*0-0+0*0+0+9', '10*0-0*0-0+0*0-0+9', '10*0-0*0-0+0*0*0+9', '10*0-0*0-0-0+0+0+9', '10*0-0*0-0-0+0-0+9', '10*0-0*0-0-0+0*0+9', '10*0-0*0-0-0-0+0+9', '10*0-0*0-0-0-0-0+9', '10*0-0*0-0-0-0*0+9', '10*0-0*0-0-0*0+0+9', '10*0-0*0-0-0*0-0+9', '10*0-0*0-0-0*0*0+9', '10*0-0*0-0*0+0+0+9', '10*0-0*0-0*0+0-0+9', '10*0-0*0-0*0+0*0+9', '10*0-0*0-0*0-0+0+9', '10*0-0*0-0*0-0-0+9', '10*0-0*0-0*0-0*0+9', '10*0-0*0-0*0*0+0+9', '10*0-0*0-0*0*0-0+9', '10*0-0*0-0*0*0*0+9', '10*0-0*0*0+0+0+0+9', '10*0-0*0*0+0+0-0+9', '10*0-0*0*0+0+0*0+9', '10*0-0*0*0+0-0+0+9', '10*0-0*0*0+0-0-0+9', '10*0-0*0*0+0-0*0+9', '10*0-0*0*0+0*0+0+9', '10*0-0*0*0+0*0-0+9', '10*0-0*0*0+0*0*0+9', '10*0-0*0*0-0+0+0+9', '10*0-0*0*0-0+0-0+9', '10*0-0*0*0-0+0*0+9', '10*0-0*0*0-0-0+0+9', '10*0-0*0*0-0-0-0+9', '10*0-0*0*0-0-0*0+9', '10*0-0*0*0-0*0+0+9', '10*0-0*0*0-0*0-0+9', '10*0-0*0*0-0*0*0+9', '10*0-0*0*0*0+0+0+9', '10*0-0*0*0*0+0-0+9', '10*0-0*0*0*0+0*0+9', '10*0-0*0*0*0-0+0+9', '10*0-0*0*0*0-0-0+9', '10*0-0*0*0*0-0*0+9', '10*0-0*0*0*0*0+0+9', '10*0-0*0*0*0*0-0+9', '10*0-0*0*0*0*0*0+9', '10*0*0+0+0+0+0+0+9', '10*0*0+0+0+0+0-0+9', '10*0*0+0+0+0+0*0+9', '10*0*0+0+0+0-0+0+9', '10*0*0+0+0+0-0-0+9', '10*0*0+0+0+0-0*0+9', '10*0*0+0+0+0*0+0+9', '10*0*0+0+0+0*0-0+9', '10*0*0+0+0+0*0*0+9', '10*0*0+0+0-0+0+0+9', '10*0*0+0+0-0+0-0+9', '10*0*0+0+0-0+0*0+9', '10*0*0+0+0-0-0+0+9', '10*0*0+0+0-0-0-0+9', '10*0*0+0+0-0-0*0+9', '10*0*0+0+0-0*0+0+9', '10*0*0+0+0-0*0-0+9', '10*0*0+0+0-0*0*0+9', '10*0*0+0+0*0+0+0+9', '10*0*0+0+0*0+0-0+9', '10*0*0+0+0*0+0*0+9', '10*0*0+0+0*0-0+0+9', '10*0*0+0+0*0-0-0+9', '10*0*0+0+0*0-0*0+9', '10*0*0+0+0*0*0+0+9', '10*0*0+0+0*0*0-0+9', '10*0*0+0+0*0*0*0+9', '10*0*0+0-0+0+0+0+9', '10*0*0+0-0+0+0-0+9', '10*0*0+0-0+0+0*0+9', '10*0*0+0-0+0-0+0+9', '10*0*0+0-0+0-0-0+9', '10*0*0+0-0+0-0*0+9', '10*0*0+0-0+0*0+0+9', '10*0*0+0-0+0*0-0+9', '10*0*0+0-0+0*0*0+9', '10*0*0+0-0-0+0+0+9', '10*0*0+0-0-0+0-0+9', '10*0*0+0-0-0+0*0+9', '10*0*0+0-0-0-0+0+9', '10*0*0+0-0-0-0-0+9', '10*0*0+0-0-0-0*0+9', '10*0*0+0-0-0*0+0+9', '10*0*0+0-0-0*0-0+9', '10*0*0+0-0-0*0*0+9', '10*0*0+0-0*0+0+0+9', '10*0*0+0-0*0+0-0+9', '10*0*0+0-0*0+0*0+9', '10*0*0+0-0*0-0+0+9', '10*0*0+0-0*0-0-0+9', '10*0*0+0-0*0-0*0+9', '10*0*0+0-0*0*0+0+9', '10*0*0+0-0*0*0-0+9', '10*0*0+0-0*0*0*0+9', '10*0*0+0*0+0+0+0+9', '10*0*0+0*0+0+0-0+9', '10*0*0+0*0+0+0*0+9', '10*0*0+0*0+0-0+0+9', '10*0*0+0*0+0-0-0+9', '10*0*0+0*0+0-0*0+9', '10*0*0+0*0+0*0+0+9', '10*0*0+0*0+0*0-0+9', '10*0*0+0*0+0*0*0+9', '10*0*0+0*0-0+0+0+9', '10*0*0+0*0-0+0-0+9', '10*0*0+0*0-0+0*0+9', '10*0*0+0*0-0-0+0+9', '10*0*0+0*0-0-0-0+9', '10*0*0+0*0-0-0*0+9', '10*0*0+0*0-0*0+0+9', '10*0*0+0*0-0*0-0+9', '10*0*0+0*0-0*0*0+9', '10*0*0+0*0*0+0+0+9', '10*0*0+0*0*0+0-0+9', '10*0*0+0*0*0+0*0+9', '10*0*0+0*0*0-0+0+9', '10*0*0+0*0*0-0-0+9', '10*0*0+0*0*0-0*0+9', '10*0*0+0*0*0*0+0+9', '10*0*0+0*0*0*0-0+9', '10*0*0+0*0*0*0*0+9', '10*0*0-0+0+0+0+0+9', '10*0*0-0+0+0+0-0+9', '10*0*0-0+0+0+0*0+9', '10*0*0-0+0+0-0+0+9', '10*0*0-0+0+0-0-0+9', '10*0*0-0+0+0-0*0+9', '10*0*0-0+0+0*0+0+9', '10*0*0-0+0+0*0-0+9', '10*0*0-0+0+0*0*0+9', '10*0*0-0+0-0+0+0+9', '10*0*0-0+0-0+0-0+9', '10*0*0-0+0-0+0*0+9', '10*0*0-0+0-0-0+0+9', '10*0*0-0+0-0-0-0+9', '10*0*0-0+0-0-0*0+9', '10*0*0-0+0-0*0+0+9', '10*0*0-0+0-0*0-0+9', '10*0*0-0+0-0*0*0+9', '10*0*0-0+0*0+0+0+9', '10*0*0-0+0*0+0-0+9', '10*0*0-0+0*0+0*0+9', '10*0*0-0+0*0-0+0+9', '10*0*0-0+0*0-0-0+9', '10*0*0-0+0*0-0*0+9', '10*0*0-0+0*0*0+0+9', '10*0*0-0+0*0*0-0+9', '10*0*0-0+0*0*0*0+9', '10*0*0-0-0+0+0+0+9', '10*0*0-0-0+0+0-0+9', '10*0*0-0-0+0+0*0+9', '10*0*0-0-0+0-0+0+9', '10*0*0-0-0+0-0-0+9', '10*0*0-0-0+0-0*0+9', '10*0*0-0-0+0*0+0+9', '10*0*0-0-0+0*0-0+9', '10*0*0-0-0+0*0*0+9', '10*0*0-0-0-0+0+0+9', '10*0*0-0-0-0+0-0+9', '10*0*0-0-0-0+0*0+9', '10*0*0-0-0-0-0+0+9', '10*0*0-0-0-0-0-0+9', '10*0*0-0-0-0-0*0+9', '10*0*0-0-0-0*0+0+9', '10*0*0-0-0-0*0-0+9', '10*0*0-0-0-0*0*0+9', '10*0*0-0-0*0+0+0+9', '10*0*0-0-0*0+0-0+9', '10*0*0-0-0*0+0*0+9', '10*0*0-0-0*0-0+0+9', '10*0*0-0-0*0-0-0+9', '10*0*0-0-0*0-0*0+9', '10*0*0-0-0*0*0+0+9', '10*0*0-0-0*0*0-0+9', '10*0*0-0-0*0*0*0+9', '10*0*0-0*0+0+0+0+9', '10*0*0-0*0+0+0-0+9', '10*0*0-0*0+0+0*0+9', '10*0*0-0*0+0-0+0+9', '10*0*0-0*0+0-0-0+9', '10*0*0-0*0+0-0*0+9', '10*0*0-0*0+0*0+0+9', '10*0*0-0*0+0*0-0+9', '10*0*0-0*0+0*0*0+9', '10*0*0-0*0-0+0+0+9', '10*0*0-0*0-0+0-0+9', '10*0*0-0*0-0+0*0+9', '10*0*0-0*0-0-0+0+9', '10*0*0-0*0-0-0-0+9', '10*0*0-0*0-0-0*0+9', '10*0*0-0*0-0*0+0+9', '10*0*0-0*0-0*0-0+9', '10*0*0-0*0-0*0*0+9', '10*0*0-0*0*0+0+0+9', '10*0*0-0*0*0+0-0+9', '10*0*0-0*0*0+0*0+9', '10*0*0-0*0*0-0+0+9', '10*0*0-0*0*0-0-0+9', '10*0*0-0*0*0-0*0+9', '10*0*0-0*0*0*0+0+9', '10*0*0-0*0*0*0-0+9', '10*0*0-0*0*0*0*0+9', '10*0*0*0+0+0+0+0+9', '10*0*0*0+0+0+0-0+9', '10*0*0*0+0+0+0*0+9', '10*0*0*0+0+0-0+0+9', '10*0*0*0+0+0-0-0+9', '10*0*0*0+0+0-0*0+9', '10*0*0*0+0+0*0+0+9', '10*0*0*0+0+0*0-0+9', '10*0*0*0+0+0*0*0+9', '10*0*0*0+0-0+0+0+9', '10*0*0*0+0-0+0-0+9', '10*0*0*0+0-0+0*0+9', '10*0*0*0+0-0-0+0+9', '10*0*0*0+0-0-0-0+9', '10*0*0*0+0-0-0*0+9', '10*0*0*0+0-0*0+0+9', '10*0*0*0+0-0*0-0+9', '10*0*0*0+0-0*0*0+9', '10*0*0*0+0*0+0+0+9', '10*0*0*0+0*0+0-0+9', '10*0*0*0+0*0+0*0+9', '10*0*0*0+0*0-0+0+9', '10*0*0*0+0*0-0-0+9', '10*0*0*0+0*0-0*0+9', '10*0*0*0+0*0*0+0+9', '10*0*0*0+0*0*0-0+9', '10*0*0*0+0*0*0*0+9', '10*0*0*0-0+0+0+0+9', '10*0*0*0-0+0+0-0+9', '10*0*0*0-0+0+0*0+9', '10*0*0*0-0+0-0+0+9', '10*0*0*0-0+0-0-0+9', '10*0*0*0-0+0-0*0+9', '10*0*0*0-0+0*0+0+9', '10*0*0*0-0+0*0-0+9', '10*0*0*0-0+0*0*0+9', '10*0*0*0-0-0+0+0+9', '10*0*0*0-0-0+0-0+9', '10*0*0*0-0-0+0*0+9', '10*0*0*0-0-0-0+0+9', '10*0*0*0-0-0-0-0+9', '10*0*0*0-0-0-0*0+9', '10*0*0*0-0-0*0+0+9', '10*0*0*0-0-0*0-0+9', '10*0*0*0-0-0*0*0+9', '10*0*0*0-0*0+0+0+9', '10*0*0*0-0*0+0-0+9', '10*0*0*0-0*0+0*0+9', '10*0*0*0-0*0-0+0+9', '10*0*0*0-0*0-0-0+9', '10*0*0*0-0*0-0*0+9', '10*0*0*0-0*0*0+0+9', '10*0*0*0-0*0*0-0+9', '10*0*0*0-0*0*0*0+9', '10*0*0*0*0+0+0+0+9', '10*0*0*0*0+0+0-0+9', '10*0*0*0*0+0+0*0+9', '10*0*0*0*0+0-0+0+9', '10*0*0*0*0+0-0-0+9', '10*0*0*0*0+0-0*0+9', '10*0*0*0*0+0*0+0+9', '10*0*0*0*0+0*0-0+9', '10*0*0*0*0+0*0*0+9', '10*0*0*0*0-0+0+0+9', '10*0*0*0*0-0+0-0+9', '10*0*0*0*0-0+0*0+9', '10*0*0*0*0-0-0+0+9', '10*0*0*0*0-0-0-0+9', '10*0*0*0*0-0-0*0+9', '10*0*0*0*0-0*0+0+9', '10*0*0*0*0-0*0-0+9', '10*0*0*0*0-0*0*0+9', '10*0*0*0*0*0+0+0+9', '10*0*0*0*0*0+0-0+9', '10*0*0*0*0*0+0*0+9', '10*0*0*0*0*0-0+0+9', '10*0*0*0*0*0-0-0+9', '10*0*0*0*0*0-0*0+9', '10*0*0*0*0*0*0+0+9', '10*0*0*0*0*0*0-0+9', '10*0*0*0*0*0*0*0+9', '100*0+0+0+0+0+0+9', '100*0+0+0+0+0-0+9', '100*0+0+0+0+0*0+9', '100*0+0+0+0-0+0+9', '100*0+0+0+0-0-0+9', '100*0+0+0+0-0*0+9', '100*0+0+0+0*0+0+9', '100*0+0+0+0*0-0+9', '100*0+0+0+0*0*0+9', '100*0+0+0-0+0+0+9', '100*0+0+0-0+0-0+9', '100*0+0+0-0+0*0+9', '100*0+0+0-0-0+0+9', '100*0+0+0-0-0-0+9', '100*0+0+0-0-0*0+9', '100*0+0+0-0*0+0+9', '100*0+0+0-0*0-0+9', '100*0+0+0-0*0*0+9', '100*0+0+0*0+0+0+9', '100*0+0+0*0+0-0+9', '100*0+0+0*0+0*0+9', '100*0+0+0*0-0+0+9', '100*0+0+0*0-0-0+9', '100*0+0+0*0-0*0+9', '100*0+0+0*0*0+0+9', '100*0+0+0*0*0-0+9', '100*0+0+0*0*0*0+9', '100*0+0-0+0+0+0+9', '100*0+0-0+0+0-0+9', '100*0+0-0+0+0*0+9', '100*0+0-0+0-0+0+9', '100*0+0-0+0-0-0+9', '100*0+0-0+0-0*0+9', '100*0+0-0+0*0+0+9', '100*0+0-0+0*0-0+9', '100*0+0-0+0*0*0+9', '100*0+0-0-0+0+0+9', '100*0+0-0-0+0-0+9', '100*0+0-0-0+0*0+9', '100*0+0-0-0-0+0+9', '100*0+0-0-0-0-0+9', '100*0+0-0-0-0*0+9', '100*0+0-0-0*0+0+9', '100*0+0-0-0*0-0+9', '100*0+0-0-0*0*0+9', '100*0+0-0*0+0+0+9', '100*0+0-0*0+0-0+9', '100*0+0-0*0+0*0+9', '100*0+0-0*0-0+0+9', '100*0+0-0*0-0-0+9', '100*0+0-0*0-0*0+9', '100*0+0-0*0*0+0+9', '100*0+0-0*0*0-0+9', '100*0+0-0*0*0*0+9', '100*0+0*0+0+0+0+9', '100*0+0*0+0+0-0+9', '100*0+0*0+0+0*0+9', '100*0+0*0+0-0+0+9', '100*0+0*0+0-0-0+9', '100*0+0*0+0-0*0+9', '100*0+0*0+0*0+0+9', '100*0+0*0+0*0-0+9', '100*0+0*0+0*0*0+9', '100*0+0*0-0+0+0+9', '100*0+0*0-0+0-0+9', '100*0+0*0-0+0*0+9', '100*0+0*0-0-0+0+9', '100*0+0*0-0-0-0+9', '100*0+0*0-0-0*0+9', '100*0+0*0-0*0+0+9', '100*0+0*0-0*0-0+9', '100*0+0*0-0*0*0+9', '100*0+0*0*0+0+0+9', '100*0+0*0*0+0-0+9', '100*0+0*0*0+0*0+9', '100*0+0*0*0-0+0+9', '100*0+0*0*0-0-0+9', '100*0+0*0*0-0*0+9', '100*0+0*0*0*0+0+9', '100*0+0*0*0*0-0+9', '100*0+0*0*0*0*0+9', '100*0-0+0+0+0+0+9', '100*0-0+0+0+0-0+9', '100*0-0+0+0+0*0+9', '100*0-0+0+0-0+0+9', '100*0-0+0+0-0-0+9', '100*0-0+0+0-0*0+9', '100*0-0+0+0*0+0+9', '100*0-0+0+0*0-0+9', '100*0-0+0+0*0*0+9', '100*0-0+0-0+0+0+9', '100*0-0+0-0+0-0+9', '100*0-0+0-0+0*0+9', '100*0-0+0-0-0+0+9', '100*0-0+0-0-0-0+9', '100*0-0+0-0-0*0+9', '100*0-0+0-0*0+0+9', '100*0-0+0-0*0-0+9', '100*0-0+0-0*0*0+9', '100*0-0+0*0+0+0+9', '100*0-0+0*0+0-0+9', '100*0-0+0*0+0*0+9', '100*0-0+0*0-0+0+9', '100*0-0+0*0-0-0+9', '100*0-0+0*0-0*0+9', '100*0-0+0*0*0+0+9', '100*0-0+0*0*0-0+9', '100*0-0+0*0*0*0+9', '100*0-0-0+0+0+0+9', '100*0-0-0+0+0-0+9', '100*0-0-0+0+0*0+9', '100*0-0-0+0-0+0+9', '100*0-0-0+0-0-0+9', '100*0-0-0+0-0*0+9', '100*0-0-0+0*0+0+9', '100*0-0-0+0*0-0+9', '100*0-0-0+0*0*0+9', '100*0-0-0-0+0+0+9', '100*0-0-0-0+0-0+9', '100*0-0-0-0+0*0+9', '100*0-0-0-0-0+0+9', '100*0-0-0-0-0-0+9', '100*0-0-0-0-0*0+9', '100*0-0-0-0*0+0+9', '100*0-0-0-0*0-0+9', '100*0-0-0-0*0*0+9', '100*0-0-0*0+0+0+9', '100*0-0-0*0+0-0+9', '100*0-0-0*0+0*0+9', '100*0-0-0*0-0+0+9', '100*0-0-0*0-0-0+9', '100*0-0-0*0-0*0+9', '100*0-0-0*0*0+0+9', '100*0-0-0*0*0-0+9', '100*0-0-0*0*0*0+9', '100*0-0*0+0+0+0+9', '100*0-0*0+0+0-0+9', '100*0-0*0+0+0*0+9', '100*0-0*0+0-0+0+9', '100*0-0*0+0-0-0+9', '100*0-0*0+0-0*0+9', '100*0-0*0+0*0+0+9', '100*0-0*0+0*0-0+9', '100*0-0*0+0*0*0+9', '100*0-0*0-0+0+0+9', '100*0-0*0-0+0-0+9', '100*0-0*0-0+0*0+9', '100*0-0*0-0-0+0+9', '100*0-0*0-0-0-0+9', '100*0-0*0-0-0*0+9', '100*0-0*0-0*0+0+9', '100*0-0*0-0*0-0+9', '100*0-0*0-0*0*0+9', '100*0-0*0*0+0+0+9', '100*0-0*0*0+0-0+9', '100*0-0*0*0+0*0+9', '100*0-0*0*0-0+0+9', '100*0-0*0*0-0-0+9', '100*0-0*0*0-0*0+9', '100*0-0*0*0*0+0+9', '100*0-0*0*0*0-0+9', '100*0-0*0*0*0*0+9', '100*0*0+0+0+0+0+9', '100*0*0+0+0+0-0+9', '100*0*0+0+0+0*0+9', '100*0*0+0+0-0+0+9', '100*0*0+0+0-0-0+9', '100*0*0+0+0-0*0+9', '100*0*0+0+0*0+0+9', '100*0*0+0+0*0-0+9', '100*0*0+0+0*0*0+9', '100*0*0+0-0+0+0+9', '100*0*0+0-0+0-0+9', '100*0*0+0-0+0*0+9', '100*0*0+0-0-0+0+9', '100*0*0+0-0-0-0+9', '100*0*0+0-0-0*0+9', '100*0*0+0-0*0+0+9', '100*0*0+0-0*0-0+9', '100*0*0+0-0*0*0+9', '100*0*0+0*0+0+0+9', '100*0*0+0*0+0-0+9', '100*0*0+0*0+0*0+9', '100*0*0+0*0-0+0+9', '100*0*0+0*0-0-0+9', '100*0*0+0*0-0*0+9', '100*0*0+0*0*0+0+9', '100*0*0+0*0*0-0+9', '100*0*0+0*0*0*0+9', '100*0*0-0+0+0+0+9', '100*0*0-0+0+0-0+9', '100*0*0-0+0+0*0+9', '100*0*0-0+0-0+0+9', '100*0*0-0+0-0-0+9', '100*0*0-0+0-0*0+9', '100*0*0-0+0*0+0+9', '100*0*0-0+0*0-0+9', '100*0*0-0+0*0*0+9', '100*0*0-0-0+0+0+9', '100*0*0-0-0+0-0+9', '100*0*0-0-0+0*0+9', '100*0*0-0-0-0+0+9', '100*0*0-0-0-0-0+9', '100*0*0-0-0-0*0+9', '100*0*0-0-0*0+0+9', '100*0*0-0-0*0-0+9', '100*0*0-0-0*0*0+9', '100*0*0-0*0+0+0+9', '100*0*0-0*0+0-0+9', '100*0*0-0*0+0*0+9', '100*0*0-0*0-0+0+9', '100*0*0-0*0-0-0+9', '100*0*0-0*0-0*0+9', '100*0*0-0*0*0+0+9', '100*0*0-0*0*0-0+9', '100*0*0-0*0*0*0+9', '100*0*0*0+0+0+0+9', '100*0*0*0+0+0-0+9', '100*0*0*0+0+0*0+9', '100*0*0*0+0-0+0+9', '100*0*0*0+0-0-0+9', '100*0*0*0+0-0*0+9', '100*0*0*0+0*0+0+9', '100*0*0*0+0*0-0+9', '100*0*0*0+0*0*0+9', '100*0*0*0-0+0+0+9', '100*0*0*0-0+0-0+9', '100*0*0*0-0+0*0+9', '100*0*0*0-0-0+0+9', '100*0*0*0-0-0-0+9', '100*0*0*0-0-0*0+9', '100*0*0*0-0*0+0+9', '100*0*0*0-0*0-0+9', '100*0*0*0-0*0*0+9', '100*0*0*0*0+0+0+9', '100*0*0*0*0+0-0+9', '100*0*0*0*0+0*0+9', '100*0*0*0*0-0+0+9', '100*0*0*0*0-0-0+9', '100*0*0*0*0-0*0+9', '100*0*0*0*0*0+0+9', '100*0*0*0*0*0-0+9', '100*0*0*0*0*0*0+9', '1000*0+0+0+0+0+9', '1000*0+0+0+0-0+9', '1000*0+0+0+0*0+9', '1000*0+0+0-0+0+9', '1000*0+0+0-0-0+9', '1000*0+0+0-0*0+9', '1000*0+0+0*0+0+9', '1000*0+0+0*0-0+9', '1000*0+0+0*0*0+9', '1000*0+0-0+0+0+9', '1000*0+0-0+0-0+9', '1000*0+0-0+0*0+9', '1000*0+0-0-0+0+9', '1000*0+0-0-0-0+9', '1000*0+0-0-0*0+9', '1000*0+0-0*0+0+9', '1000*0+0-0*0-0+9', '1000*0+0-0*0*0+9', '1000*0+0*0+0+0+9', '1000*0+0*0+0-0+9', '1000*0+0*0+0*0+9', '1000*0+0*0-0+0+9', '1000*0+0*0-0-0+9', '1000*0+0*0-0*0+9', '1000*0+0*0*0+0+9', '1000*0+0*0*0-0+9', '1000*0+0*0*0*0+9', '1000*0-0+0+0+0+9', '1000*0-0+0+0-0+9', '1000*0-0+0+0*0+9', '1000*0-0+0-0+0+9', '1000*0-0+0-0-0+9', '1000*0-0+0-0*0+9', '1000*0-0+0*0+0+9', '1000*0-0+0*0-0+9', '1000*0-0+0*0*0+9', '1000*0-0-0+0+0+9', '1000*0-0-0+0-0+9', '1000*0-0-0+0*0+9', '1000*0-0-0-0+0+9', '1000*0-0-0-0-0+9', '1000*0-0-0-0*0+9', '1000*0-0-0*0+0+9', '1000*0-0-0*0-0+9', '1000*0-0-0*0*0+9', '1000*0-0*0+0+0+9', '1000*0-0*0+0-0+9', '1000*0-0*0+0*0+9', '1000*0-0*0-0+0+9', '1000*0-0*0-0-0+9', '1000*0-0*0-0*0+9', '1000*0-0*0*0+0+9', '1000*0-0*0*0-0+9', '1000*0-0*0*0*0+9', '1000*0*0+0+0+0+9', '1000*0*0+0+0-0+9', '1000*0*0+0+0*0+9', '1000*0*0+0-0+0+9', '1000*0*0+0-0-0+9', '1000*0*0+0-0*0+9', '1000*0*0+0*0+0+9', '1000*0*0+0*0-0+9', '1000*0*0+0*0*0+9', '1000*0*0-0+0+0+9', '1000*0*0-0+0-0+9', '1000*0*0-0+0*0+9', '1000*0*0-0-0+0+9', '1000*0*0-0-0-0+9', '1000*0*0-0-0*0+9', '1000*0*0-0*0+0+9', '1000*0*0-0*0-0+9', '1000*0*0-0*0*0+9', '1000*0*0*0+0+0+9', '1000*0*0*0+0-0+9', '1000*0*0*0+0*0+9', '1000*0*0*0-0+0+9', '1000*0*0*0-0-0+9', '1000*0*0*0-0*0+9', '1000*0*0*0*0+0+9', '1000*0*0*0*0-0+9', '1000*0*0*0*0*0+9', '10000*0+0+0+0+9', '10000*0+0+0-0+9', '10000*0+0+0*0+9', '10000*0+0-0+0+9', '10000*0+0-0-0+9', '10000*0+0-0*0+9', '10000*0+0*0+0+9', '10000*0+0*0-0+9', '10000*0+0*0*0+9', '10000*0-0+0+0+9', '10000*0-0+0-0+9', '10000*0-0+0*0+9', '10000*0-0-0+0+9', '10000*0-0-0-0+9', '10000*0-0-0*0+9', '10000*0-0*0+0+9', '10000*0-0*0-0+9', '10000*0-0*0*0+9', '10000*0*0+0+0+9', '10000*0*0+0-0+9', '10000*0*0+0*0+9', '10000*0*0-0+0+9', '10000*0*0-0-0+9', '10000*0*0-0*0+9', '10000*0*0*0+0+9', '10000*0*0*0-0+9', '10000*0*0*0*0+9', '100000*0+0+0+9', '100000*0+0-0+9', '100000*0+0*0+9', '100000*0-0+0+9', '100000*0-0-0+9', '100000*0-0*0+9', '100000*0*0+0+9', '100000*0*0-0+9', '100000*0*0*0+9', '1000000*0+0+9', '1000000*0-0+9', '1000000*0*0+9', '10000000*0+9'", - "", - "'999999999'", - "'0+1'", - "'1+2*3+4', '1-2+3*4', '12+3-4'" - ], - "boilerplate": { - "python": "class Solution:\n def addOperators(self, num: str, target: int) -> List[str]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List addOperators(String num, int target) {\n List results = new ArrayList();\n // Implement your solution logic here\n return results;\n }\n}", - "cpp": "class Solution {\npublic:\n vector addOperators(string num, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "import java.util.Arrays;\n\nArrays.sort(result);\nArrays.sort(expected);\nreturn Arrays.equals(result, expected);", - "cpp": "std::sort(result.begin(), result.end());\nstd::sort(expected.begin(), expected.end());\nreturn result == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=tunRDBsP7OQ&pp=ygUhTmVldENvZGUgRXhwcmVzc2lvbiBBZGQgT3BlcmF0b3Jz" + "title": "Expression Add Operators", + "source": "https://leetcode.com/problems/expression-add-operators/", + "description": "

Given a string num that contains only digits and an integer target, return all possibilities to insert the binary operators '+', '-', and/or '*' between the digits of num so that the resultant expression evaluates to the target value.

\n\n

Note that operands in the returned expressions should not contain leading zeros.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = "123", target = 6\nOutput: ["1*2*3","1+2+3"]\nExplanation: Both "1*2*3" and "1+2+3" evaluate to 6.\n
\n\n

Example 2:

\n\n
\nInput: num = "232", target = 8\nOutput: ["2*3+2","2+3*2"]\nExplanation: Both "2*3+2" and "2+3*2" evaluate to 8.\n
\n\n

Example 3:

\n\n
\nInput: num = "3456237490", target = 9191\nOutput: []\nExplanation: There are no expressions that can be created from "3456237490" to evaluate to 9191.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num.length <= 10
  • \n\t
  • num consists of only digits.
  • \n\t
  • -231 <= target <= 231 - 1
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=\"123\" --arg2=6", + "--arg1=\"232\" --arg2=8", + "--arg1=\"3456237490\" --arg2=9191" + ], + "sample_test_results": [ + "['1+2+3','1*2*3']", + "['2+3*2','2*3+2']", + "[]" + ], + "hidden_test_cases": [ + "--arg1=\"123\" --arg2=6", + "--arg1=\"232\" --arg2=8", + "--arg1=\"105\" --arg2=5", + "--arg1=\"00\" --arg2=0", + "--arg1=\"3456237490\" --arg2=9191", + "--arg1=\"1000000009\" --arg2=9", + "--arg1=\"2147483648\" --arg2=-2147483648", + "--arg1=\"999999999\" --arg2=999999999", + "--arg1=\"01\" --arg2=1", + "--arg1=\"1234\" --arg2=11" + ], + "hidden_test_results": [ + "['1+2+3','1*2*3']", + "['2+3*2','2*3+2']", + "['1*0+5','10-5']", + "['0+0','0-0','0*0']", + "[]", + "['1*0+0+0+0+0+0+0+0+9','1*0+0+0+0+0+0+0-0+9','1*0+0+0+0+0+0+0*0+9','1*0+0+0+0+0+0-0+0+9','1*0+0+0+0+0+0-0-0+9','1*0+0+0+0+0+0-0*0+9','1*0+0+0+0+0+0*0+0+9','1*0+0+0+0+0+0*0-0+9','1*0+0+0+0+0+0*0*0+9','1*0+0+0+0+0-0+0+0+9','1*0+0+0+0+0-0+0-0+9','1*0+0+0+0+0-0+0*0+9','1*0+0+0+0+0-0-0+0+9','1*0+0+0+0+0-0-0-0+9','1*0+0+0+0+0-0-0*0+9','1*0+0+0+0+0-0*0+0+9','1*0+0+0+0+0-0*0-0+9','1*0+0+0+0+0-0*0*0+9','1*0+0+0+0+0*0+0+0+9','1*0+0+0+0+0*0+0-0+9','1*0+0+0+0+0*0+0*0+9','1*0+0+0+0+0*0-0+0+9','1*0+0+0+0+0*0-0-0+9','1*0+0+0+0+0*0-0*0+9','1*0+0+0+0+0*0*0+0+9','1*0+0+0+0+0*0*0-0+9','1*0+0+0+0+0*0*0*0+9','1*0+0+0+0-0+0+0+0+9','1*0+0+0+0-0+0+0-0+9','1*0+0+0+0-0+0+0*0+9','1*0+0+0+0-0+0-0+0+9','1*0+0+0+0-0+0-0-0+9','1*0+0+0+0-0+0-0*0+9','1*0+0+0+0-0+0*0+0+9','1*0+0+0+0-0+0*0-0+9','1*0+0+0+0-0+0*0*0+9','1*0+0+0+0-0-0+0+0+9','1*0+0+0+0-0-0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+9','1*0+0+0-0+0+0*0*0+9','1*0+0+0-0+0-0+0+0+9','1*0+0+0-0+0-0+0-0+9','1*0+0+0-0+0-0+0*0+9','1*0+0+0-0+0-0-0+0+9','1*0+0+0-0+0-0-0-0+9','1*0+0+0-0+0-0-0*0+9','1*0+0+0-0+0-0*0+0+9','1*0+0+0-0+0-0*0-0+9','1*0+0+0-0+0-0*0*0+9','1*0+0+0-0+0*0+0+0+9','1*0+0+0-0+0*0+0-0+9','1*0+0+0-0+0*0+0*0+9','1*0+0+0-0+0*0-0+0+9','1*0+0+0-0+0*0-0-0+9','1*0+0+0-0+0*0-0*0+9','1*0+0+0-0+0*0*0+0+9','1*0+0+0-0+0*0*0-0+9','1*0+0+0-0+0*0*0*0+9','1*0+0+0-0-0+0+0+0+9','1*0+0+0-0-0+0+0-0+9','1*0+0+0-0-0+0+0*0+9','1*0+0+0-0-0+0-0+0+9','1*0+0+0-0-0+0-0-0+9','1*0+0+0-0-0+0-0*0+9','1*0+0+0-0-0+0*0+0+9','1*0+0+0-0-0+0*0-0+9','1*0+0+0-0-0+0*0*0+9','1*0+0+0-0-0-0+0+0+9','1*0+0+0-0-0-0+0-0+9','1*0+0+0-0-0-0+0*0+9','1*0+0+0-0-0-0-0+0+9','1*0+0+0-0-0-0-0-0+9','1*0+0+0-0-0-0-0*0+9','1*0+0+0-0-0-0*0+0+9','1*0+0+0-0-0-0*0-0+9','1*0+0+0-0-0-0*0*0+9','1*0+0+0-0-0*0+0+0+9','1*0+0+0-0-0*0+0-0+9','1*0+0+0-0-0*0+0*0+9','1*0+0+0-0-0*0-0+0+9','1*0+0+0-0-0*0-0-0+9','1*0+0+0-0-0*0-0*0+9','1*0+0+0-0-0*0*0+0+9','1*0+0+0-0-0*0*0-0+9','1*0+0+0-0-0*0*0*0+9','1*0+0+0-0*0+0+0+0+9','1*0+0+0-0*0+0+0-0+9','1*0+0+0-0*0+0+0*0+9','1*0+0+0-0*0+0-0+0+9','1*0+0+0-0*0+0-0-0+9','1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+9','1*0+0-0-0+0*0-0+0+9','1*0+0-0-0+0*0-0-0+9','1*0+0-0-0+0*0-0*0+9','1*0+0-0-0+0*0*0+0+9','1*0+0-0-0+0*0*0-0+9','1*0+0-0-0+0*0*0*0+9','1*0+0-0-0-0+0+0+0+9','1*0+0-0-0-0+0+0-0+9','1*0+0-0-0-0+0+0*0+9','1*0+0-0-0-0+0-0+0+9','1*0+0-0-0-0+0-0-0+9','1*0+0-0-0-0+0-0*0+9','1*0+0-0-0-0+0*0+0+9','1*0+0-0-0-0+0*0-0+9','1*0+0-0-0-0+0*0*0+9','1*0+0-0-0-0-0+0+0+9','1*0+0-0-0-0-0+0-0+9','1*0+0-0-0-0-0+0*0+9','1*0+0-0-0-0-0-0+0+9','1*0+0-0-0-0-0-0-0+9','1*0+0-0-0-0-0-0*0+9','1*0+0-0-0-0-0*0+0+9','1*0+0-0-0-0-0*0-0+9','1*0+0-0-0-0-0*0*0+9','1*0+0-0-0-0*0+0+0+9','1*0+0-0-0-0*0+0-0+9','1*0+0-0-0-0*0+0*0+9','1*0+0-0-0-0*0-0+0+9','1*0+0-0-0-0*0-0-0+9','1*0+0-0-0-0*0-0*0+9','1*0+0-0-0-0*0*0+0+9','1*0+0-0-0-0*0*0-0+9','1*0+0-0-0-0*0*0*0+9','1*0+0-0-0*0+0+0+0+9','1*0+0-0-0*0+0+0-0+9','1*0+0-0-0*0+0+0*0+9','1*0+0-0-0*0+0-0+0+9','1*0+0-0-0*0+0-0-0+9','1*0+0-0-0*0+0-0*0+9','1*0+0-0-0*0+0*0+0+9','1*0+0-0-0*0+0*0-0+9','1*0+0-0-0*0+0*0*0+9','1*0+0-0-0*0-0+0+0+9','1*0+0-0-0*0-0+0-0+9','1*0+0-0-0*0-0+0*0+9','1*0+0-0-0*0-0-0+0+9','1*0+0-0-0*0-0-0-0+9','1*0+0-0-0*0-0-0*0+9','1*0+0-0-0*0-0*0+0+9','1*0+0-0-0*0-0*0-0+9','1*0+0-0-0*0-0*0*0+9','1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+9','1*0+0*0-0-0+0*0-0+9','1*0+0*0-0-0+0*0*0+9','1*0+0*0-0-0-0+0+0+9','1*0+0*0-0-0-0+0-0+9','1*0+0*0-0-0-0+0*0+9','1*0+0*0-0-0-0-0+0+9','1*0+0*0-0-0-0-0-0+9','1*0+0*0-0-0-0-0*0+9','1*0+0*0-0-0-0*0+0+9','1*0+0*0-0-0-0*0-0+9','1*0+0*0-0-0-0*0*0+9','1*0+0*0-0-0*0+0+0+9','1*0+0*0-0-0*0+0-0+9','1*0+0*0-0-0*0+0*0+9','1*0+0*0-0-0*0-0+0+9','1*0+0*0-0-0*0-0-0+9','1*0+0*0-0-0*0-0*0+9','1*0+0*0-0-0*0*0+0+9','1*0+0*0-0-0*0*0-0+9','1*0+0*0-0-0*0*0*0+9','1*0+0*0-0*0+0+0+0+9','1*0+0*0-0*0+0+0-0+9','1*0+0*0-0*0+0+0*0+9','1*0+0*0-0*0+0-0+0+9','1*0+0*0-0*0+0-0-0+9','1*0+0*0-0*0+0-0*0+9','1*0+0*0-0*0+0*0+0+9','1*0+0*0-0*0+0*0-0+9','1*0+0*0-0*0+0*0*0+9','1*0+0*0-0*0-0+0+0+9','1*0+0*0-0*0-0+0-0+9','1*0+0*0-0*0-0+0*0+9','1*0+0*0-0*0-0-0+0+9','1*0+0*0-0*0-0-0-0+9','1*0+0*0-0*0-0-0*0+9','1*0+0*0-0*0-0*0+0+9','1*0+0*0-0*0-0*0-0+9','1*0+0*0-0*0-0*0*0+9','1*0+0*0-0*0*0+0+0+9','1*0+0*0-0*0*0+0-0+9','1*0+0*0-0*0*0+0*0+9','1*0+0*0-0*0*0-0+0+9','1*0+0*0-0*0*0-0-0+9','1*0+0*0-0*0*0-0*0+9','1*0+0*0-0*0*0*0+0+9','1*0+0*0-0*0*0*0-0+9','1*0+0*0-0*0*0*0*0+9','1*0+0*0*0+0+0+0+0+9','1*0+0*0*0+0+0+0-0+9','1*0+0*0*0+0+0+0*0+9','1*0+0*0*0+0+0-0+0+9','1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+9','1*0-0+0-0-0*0+0*0+9','1*0-0+0-0-0*0-0+0+9','1*0-0+0-0-0*0-0-0+9','1*0-0+0-0-0*0-0*0+9','1*0-0+0-0-0*0*0+0+9','1*0-0+0-0-0*0*0-0+9','1*0-0+0-0-0*0*0*0+9','1*0-0+0-0*0+0+0+0+9','1*0-0+0-0*0+0+0-0+9','1*0-0+0-0*0+0+0*0+9','1*0-0+0-0*0+0-0+0+9','1*0-0+0-0*0+0-0-0+9','1*0-0+0-0*0+0-0*0+9','1*0-0+0-0*0+0*0+0+9','1*0-0+0-0*0+0*0-0+9','1*0-0+0-0*0+0*0*0+9','1*0-0+0-0*0-0+0+0+9','1*0-0+0-0*0-0+0-0+9','1*0-0+0-0*0-0+0*0+9','1*0-0+0-0*0-0-0+0+9','1*0-0+0-0*0-0-0-0+9','1*0-0+0-0*0-0-0*0+9','1*0-0+0-0*0-0*0+0+9','1*0-0+0-0*0-0*0-0+9','1*0-0+0-0*0-0*0*0+9','1*0-0+0-0*0*0+0+0+9','1*0-0+0-0*0*0+0-0+9','1*0-0+0-0*0*0+0*0+9','1*0-0+0-0*0*0-0+0+9','1*0-0+0-0*0*0-0-0+9','1*0-0+0-0*0*0-0*0+9','1*0-0+0-0*0*0*0+0+9','1*0-0+0-0*0*0*0-0+9','1*0-0+0-0*0*0*0*0+9','1*0-0+0*0+0+0+0+0+9','1*0-0+0*0+0+0+0-0+9','1*0-0+0*0+0+0+0*0+9','1*0-0+0*0+0+0-0+0+9','1*0-0+0*0+0+0-0-0+9','1*0-0+0*0+0+0-0*0+9','1*0-0+0*0+0+0*0+0+9','1*0-0+0*0+0+0*0-0+9','1*0-0+0*0+0+0*0*0+9','1*0-0+0*0+0-0+0+0+9','1*0-0+0*0+0-0+0-0+9','1*0-0+0*0+0-0+0*0+9','1*0-0+0*0+0-0-0+0+9','1*0-0+0*0+0-0-0-0+9','1*0-0+0*0+0-0-0*0+9','1*0-0+0*0+0-0*0+0+9','1*0-0+0*0+0-0*0-0+9','1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+9','1*0-0-0-0*0+0*0+0+9','1*0-0-0-0*0+0*0-0+9','1*0-0-0-0*0+0*0*0+9','1*0-0-0-0*0-0+0+0+9','1*0-0-0-0*0-0+0-0+9','1*0-0-0-0*0-0+0*0+9','1*0-0-0-0*0-0-0+0+9','1*0-0-0-0*0-0-0-0+9','1*0-0-0-0*0-0-0*0+9','1*0-0-0-0*0-0*0+0+9','1*0-0-0-0*0-0*0-0+9','1*0-0-0-0*0-0*0*0+9','1*0-0-0-0*0*0+0+0+9','1*0-0-0-0*0*0+0-0+9','1*0-0-0-0*0*0+0*0+9','1*0-0-0-0*0*0-0+0+9','1*0-0-0-0*0*0-0-0+9','1*0-0-0-0*0*0-0*0+9','1*0-0-0-0*0*0*0+0+9','1*0-0-0-0*0*0*0-0+9','1*0-0-0-0*0*0*0*0+9','1*0-0-0*0+0+0+0+0+9','1*0-0-0*0+0+0+0-0+9','1*0-0-0*0+0+0+0*0+9','1*0-0-0*0+0+0-0+0+9','1*0-0-0*0+0+0-0-0+9','1*0-0-0*0+0+0-0*0+9','1*0-0-0*0+0+0*0+0+9','1*0-0-0*0+0+0*0-0+9','1*0-0-0*0+0+0*0*0+9','1*0-0-0*0+0-0+0+0+9','1*0-0-0*0+0-0+0-0+9','1*0-0-0*0+0-0+0*0+9','1*0-0-0*0+0-0-0+0+9','1*0-0-0*0+0-0-0-0+9','1*0-0-0*0+0-0-0*0+9','1*0-0-0*0+0-0*0+0+9','1*0-0-0*0+0-0*0-0+9','1*0-0-0*0+0-0*0*0+9','1*0-0-0*0+0*0+0+0+9','1*0-0-0*0+0*0+0-0+9','1*0-0-0*0+0*0+0*0+9','1*0-0-0*0+0*0-0+0+9','1*0-0-0*0+0*0-0-0+9','1*0-0-0*0+0*0-0*0+9','1*0-0-0*0+0*0*0+0+9','1*0-0-0*0+0*0*0-0+9','1*0-0-0*0+0*0*0*0+9','1*0-0-0*0-0+0+0+0+9','1*0-0-0*0-0+0+0-0+9','1*0-0-0*0-0+0+0*0+9','1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+9','1*0-0*0-0*0*0+0-0+9','1*0-0*0-0*0*0+0*0+9','1*0-0*0-0*0*0-0+0+9','1*0-0*0-0*0*0-0-0+9','1*0-0*0-0*0*0-0*0+9','1*0-0*0-0*0*0*0+0+9','1*0-0*0-0*0*0*0-0+9','1*0-0*0-0*0*0*0*0+9','1*0-0*0*0+0+0+0+0+9','1*0-0*0*0+0+0+0-0+9','1*0-0*0*0+0+0+0*0+9','1*0-0*0*0+0+0-0+0+9','1*0-0*0*0+0+0-0-0+9','1*0-0*0*0+0+0-0*0+9','1*0-0*0*0+0+0*0+0+9','1*0-0*0*0+0+0*0-0+9','1*0-0*0*0+0+0*0*0+9','1*0-0*0*0+0-0+0+0+9','1*0-0*0*0+0-0+0-0+9','1*0-0*0*0+0-0+0*0+9','1*0-0*0*0+0-0-0+0+9','1*0-0*0*0+0-0-0-0+9','1*0-0*0*0+0-0-0*0+9','1*0-0*0*0+0-0*0+0+9','1*0-0*0*0+0-0*0-0+9','1*0-0*0*0+0-0*0*0+9','1*0-0*0*0+0*0+0+0+9','1*0-0*0*0+0*0+0-0+9','1*0-0*0*0+0*0+0*0+9','1*0-0*0*0+0*0-0+0+9','1*0-0*0*0+0*0-0-0+9','1*0-0*0*0+0*0-0*0+9','1*0-0*0*0+0*0*0+0+9','1*0-0*0*0+0*0*0-0+9','1*0-0*0*0+0*0*0*0+9','1*0-0*0*0-0+0+0+0+9','1*0-0*0*0-0+0+0-0+9','1*0-0*0*0-0+0+0*0+9','1*0-0*0*0-0+0-0+0+9','1*0-0*0*0-0+0-0-0+9','1*0-0*0*0-0+0-0*0+9','1*0-0*0*0-0+0*0+0+9','1*0-0*0*0-0+0*0-0+9','1*0-0*0*0-0+0*0*0+9','1*0-0*0*0-0-0+0+0+9','1*0-0*0*0-0-0+0-0+9','1*0-0*0*0-0-0+0*0+9','1*0-0*0*0-0-0-0+0+9','1*0-0*0*0-0-0-0-0+9','1*0-0*0*0-0-0-0*0+9','1*0-0*0*0-0-0*0+0+9','1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+9','1*0*0+0*0+0+0-0*0+9','1*0*0+0*0+0+0*0+0+9','1*0*0+0*0+0+0*0-0+9','1*0*0+0*0+0+0*0*0+9','1*0*0+0*0+0-0+0+0+9','1*0*0+0*0+0-0+0-0+9','1*0*0+0*0+0-0+0*0+9','1*0*0+0*0+0-0-0+0+9','1*0*0+0*0+0-0-0-0+9','1*0*0+0*0+0-0-0*0+9','1*0*0+0*0+0-0*0+0+9','1*0*0+0*0+0-0*0-0+9','1*0*0+0*0+0-0*0*0+9','1*0*0+0*0+0*0+0+0+9','1*0*0+0*0+0*0+0-0+9','1*0*0+0*0+0*0+0*0+9','1*0*0+0*0+0*0-0+0+9','1*0*0+0*0+0*0-0-0+9','1*0*0+0*0+0*0-0*0+9','1*0*0+0*0+0*0*0+0+9','1*0*0+0*0+0*0*0-0+9','1*0*0+0*0+0*0*0*0+9','1*0*0+0*0-0+0+0+0+9','1*0*0+0*0-0+0+0-0+9','1*0*0+0*0-0+0+0*0+9','1*0*0+0*0-0+0-0+0+9','1*0*0+0*0-0+0-0-0+9','1*0*0+0*0-0+0-0*0+9','1*0*0+0*0-0+0*0+0+9','1*0*0+0*0-0+0*0-0+9','1*0*0+0*0-0+0*0*0+9','1*0*0+0*0-0-0+0+0+9','1*0*0+0*0-0-0+0-0+9','1*0*0+0*0-0-0+0*0+9','1*0*0+0*0-0-0-0+0+9','1*0*0+0*0-0-0-0-0+9','1*0*0+0*0-0-0-0*0+9','1*0*0+0*0-0-0*0+0+9','1*0*0+0*0-0-0*0-0+9','1*0*0+0*0-0-0*0*0+9','1*0*0+0*0-0*0+0+0+9','1*0*0+0*0-0*0+0-0+9','1*0*0+0*0-0*0+0*0+9','1*0*0+0*0-0*0-0+0+9','1*0*0+0*0-0*0-0-0+9','1*0*0+0*0-0*0-0*0+9','1*0*0+0*0-0*0*0+0+9','1*0*0+0*0-0*0*0-0+9','1*0*0+0*0-0*0*0*0+9','1*0*0+0*0*0+0+0+0+9','1*0*0+0*0*0+0+0-0+9','1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+9','1*0*0-0*0+0*0+0+0+9','1*0*0-0*0+0*0+0-0+9','1*0*0-0*0+0*0+0*0+9','1*0*0-0*0+0*0-0+0+9','1*0*0-0*0+0*0-0-0+9','1*0*0-0*0+0*0-0*0+9','1*0*0-0*0+0*0*0+0+9','1*0*0-0*0+0*0*0-0+9','1*0*0-0*0+0*0*0*0+9','1*0*0-0*0-0+0+0+0+9','1*0*0-0*0-0+0+0-0+9','1*0*0-0*0-0+0+0*0+9','1*0*0-0*0-0+0-0+0+9','1*0*0-0*0-0+0-0-0+9','1*0*0-0*0-0+0-0*0+9','1*0*0-0*0-0+0*0+0+9','1*0*0-0*0-0+0*0-0+9','1*0*0-0*0-0+0*0*0+9','1*0*0-0*0-0-0+0+0+9','1*0*0-0*0-0-0+0-0+9','1*0*0-0*0-0-0+0*0+9','1*0*0-0*0-0-0-0+0+9','1*0*0-0*0-0-0-0-0+9','1*0*0-0*0-0-0-0*0+9','1*0*0-0*0-0-0*0+0+9','1*0*0-0*0-0-0*0-0+9','1*0*0-0*0-0-0*0*0+9','1*0*0-0*0-0*0+0+0+9','1*0*0-0*0-0*0+0-0+9','1*0*0-0*0-0*0+0*0+9','1*0*0-0*0-0*0-0+0+9','1*0*0-0*0-0*0-0-0+9','1*0*0-0*0-0*0-0*0+9','1*0*0-0*0-0*0*0+0+9','1*0*0-0*0-0*0*0-0+9','1*0*0-0*0-0*0*0*0+9','1*0*0-0*0*0+0+0+0+9','1*0*0-0*0*0+0+0-0+9','1*0*0-0*0*0+0+0*0+9','1*0*0-0*0*0+0-0+0+9','1*0*0-0*0*0+0-0-0+9','1*0*0-0*0*0+0-0*0+9','1*0*0-0*0*0+0*0+0+9','1*0*0-0*0*0+0*0-0+9','1*0*0-0*0*0+0*0*0+9','1*0*0-0*0*0-0+0+0+9','1*0*0-0*0*0-0+0-0+9','1*0*0-0*0*0-0+0*0+9','1*0*0-0*0*0-0-0+0+9','1*0*0-0*0*0-0-0-0+9','1*0*0-0*0*0-0-0*0+9','1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+9','1*0*0*0*0-0+0-0-0+9','1*0*0*0*0-0+0-0*0+9','1*0*0*0*0-0+0*0+0+9','1*0*0*0*0-0+0*0-0+9','1*0*0*0*0-0+0*0*0+9','1*0*0*0*0-0-0+0+0+9','1*0*0*0*0-0-0+0-0+9','1*0*0*0*0-0-0+0*0+9','1*0*0*0*0-0-0-0+0+9','1*0*0*0*0-0-0-0-0+9','1*0*0*0*0-0-0-0*0+9','1*0*0*0*0-0-0*0+0+9','1*0*0*0*0-0-0*0-0+9','1*0*0*0*0-0-0*0*0+9','1*0*0*0*0-0*0+0+0+9','1*0*0*0*0-0*0+0-0+9','1*0*0*0*0-0*0+0*0+9','1*0*0*0*0-0*0-0+0+9','1*0*0*0*0-0*0-0-0+9','1*0*0*0*0-0*0-0*0+9','1*0*0*0*0-0*0*0+0+9','1*0*0*0*0-0*0*0-0+9','1*0*0*0*0-0*0*0*0+9','1*0*0*0*0*0+0+0+0+9','1*0*0*0*0*0+0+0-0+9','1*0*0*0*0*0+0+0*0+9','1*0*0*0*0*0+0-0+0+9','1*0*0*0*0*0+0-0-0+9','1*0*0*0*0*0+0-0*0+9','1*0*0*0*0*0+0*0+0+9','1*0*0*0*0*0+0*0-0+9','1*0*0*0*0*0+0*0*0+9','1*0*0*0*0*0-0+0+0+9','1*0*0*0*0*0-0+0-0+9','1*0*0*0*0*0-0+0*0+9','1*0*0*0*0*0-0-0+0+9','1*0*0*0*0*0-0-0-0+9','1*0*0*0*0*0-0-0*0+9','1*0*0*0*0*0-0*0+0+9','1*0*0*0*0*0-0*0-0+9','1*0*0*0*0*0-0*0*0+9','1*0*0*0*0*0*0+0+0+9','1*0*0*0*0*0*0+0-0+9','1*0*0*0*0*0*0+0*0+9','1*0*0*0*0*0*0-0+0+9','1*0*0*0*0*0*0-0-0+9','1*0*0*0*0*0*0-0*0+9','1*0*0*0*0*0*0*0+0+9','1*0*0*0*0*0*0*0-0+9','1*0*0*0*0*0*0*0*0+9','10*0+0+0+0+0+0+0+9','10*0+0+0+0+0+0-0+9','10*0+0+0+0+0+0*0+9','10*0+0+0+0+0-0+0+9','10*0+0+0+0+0-0-0+9','10*0+0+0+0+0-0*0+9','10*0+0+0+0+0*0+0+9','10*0+0+0+0+0*0-0+9','10*0+0+0+0+0*0*0+9','10*0+0+0+0-0+0+0+9','10*0+0+0+0-0+0-0+9','10*0+0+0+0-0+0*0+9','10*0+0+0+0-0-0+0+9','10*0+0+0+0-0-0-0+9','10*0+0+0+0-0-0*0+9','10*0+0+0+0-0*0+0+9','10*0+0+0+0-0*0-0+9','10*0+0+0+0-0*0*0+9','10*0+0+0+0*0+0+0+9','10*0+0+0+0*0+0-0+9','10*0+0+0+0*0+0*0+9','10*0+0+0+0*0-0+0+9','10*0+0+0+0*0-0-0+9','10*0+0+0+0*0-0*0+9','10*0+0+0+0*0*0+0+9','10*0+0+0+0*0*0-0+9','10*0+0+0+0*0*0*0+9','10*0+0+0-0+0+0+0+9','10*0+0+0-0+0+0-0+9','10*0+0+0-0+0+0*0+9','10*0+0+0-0+0-0+0+9','10*0+0+0-0+0-0-0+9','10*0+0+0-0+0-0*0+9','10*0+0+0-0+0*0+0+9','10*0+0+0-0+0*0-0+9','10*0+0+0-0+0*0*0+9','10*0+0+0-0-0+0+0+9','10*0+0+0-0-0+0-0+9','10*0+0+0-0-0+0*0+9','10*0+0+0-0-0-0+0+9','10*0+0+0-0-0-0-0+9','10*0+0+0-0-0-0*0+9','10*0+0+0-0-0*0+0+9','10*0+0+0-0-0*0-0+9','10*0+0+0-0-0*0*0+9','10*0+0+0-0*0+0+0+9','10*0+0+0-0*0+0-0+9','10*0+0+0-0*0+0*0+9','10*0+0+0-0*0-0+0+9','10*0+0+0-0*0-0-0+9','10*0+0+0-0*0-0*0+9','10*0+0+0-0*0*0+0+9','10*0+0+0-0*0*0-0+9','10*0+0+0-0*0*0*0+9','10*0+0+0*0+0+0+0+9','10*0+0+0*0+0+0-0+9','10*0+0+0*0+0+0*0+9','10*0+0+0*0+0-0+0+9','10*0+0+0*0+0-0-0+9','10*0+0+0*0+0-0*0+9','10*0+0+0*0+0*0+0+9','10*0+0+0*0+0*0-0+9','10*0+0+0*0+0*0*0+9','10*0+0+0*0-0+0+0+9','10*0+0+0*0-0+0-0+9','10*0+0+0*0-0+0*0+9','10*0+0+0*0-0-0+0+9','10*0+0+0*0-0-0-0+9','10*0+0+0*0-0-0*0+9','10*0+0+0*0-0*0+0+9','10*0+0+0*0-0*0-0+9','10*0+0+0*0-0*0*0+9','10*0+0+0*0*0+0+0+9','10*0+0+0*0*0+0-0+9','10*0+0+0*0*0+0*0+9','10*0+0+0*0*0-0+0+9','10*0+0+0*0*0-0-0+9','10*0+0+0*0*0-0*0+9','10*0+0+0*0*0*0+0+9','10*0+0+0*0*0*0-0+9','10*0+0+0*0*0*0*0+9','10*0+0-0+0+0+0+0+9','10*0+0-0+0+0+0-0+9','10*0+0-0+0+0+0*0+9','10*0+0-0+0+0-0+0+9','10*0+0-0+0+0-0-0+9','10*0+0-0+0+0-0*0+9','10*0+0-0+0+0*0+0+9','10*0+0-0+0+0*0-0+9','10*0+0-0+0+0*0*0+9','10*0+0-0+0-0+0+0+9','10*0+0-0+0-0+0-0+9','10*0+0-0+0-0+0*0+9','10*0+0-0+0-0-0+0+9','10*0+0-0+0-0-0-0+9','10*0+0-0+0-0-0*0+9','10*0+0-0+0-0*0+0+9','10*0+0-0+0-0*0-0+9','10*0+0-0+0-0*0*0+9','10*0+0-0+0*0+0+0+9','10*0+0-0+0*0+0-0+9','10*0+0-0+0*0+0*0+9','10*0+0-0+0*0-0+0+9','10*0+0-0+0*0-0-0+9','10*0+0-0+0*0-0*0+9','10*0+0-0+0*0*0+0+9','10*0+0-0+0*0*0-0+9','10*0+0-0+0*0*0*0+9','10*0+0-0-0+0+0+0+9','10*0+0-0-0+0+0-0+9','10*0+0-0-0+0+0*0+9','10*0+0-0-0+0-0+0+9','10*0+0-0-0+0-0-0+9','10*0+0-0-0+0-0*0+9','10*0+0-0-0+0*0+0+9','10*0+0-0-0+0*0-0+9','10*0+0-0-0+0*0*0+9','10*0+0-0-0-0+0+0+9','10*0+0-0-0-0+0-0+9','10*0+0-0-0-0+0*0+9','10*0+0-0-0-0-0+0+9','10*0+0-0-0-0-0-0+9','10*0+0-0-0-0-0*0+9','10*0+0-0-0-0*0+0+9','10*0+0-0-0-0*0-0+9','10*0+0-0-0-0*0*0+9','10*0+0-0-0*0+0+0+9','10*0+0-0-0*0+0-0+9','10*0+0-0-0*0+0*0+9','10*0+0-0-0*0-0+0+9','10*0+0-0-0*0-0-0+9','10*0+0-0-0*0-0*0+9','10*0+0-0-0*0*0+0+9','10*0+0-0-0*0*0-0+9','10*0+0-0-0*0*0*0+9','10*0+0-0*0+0+0+0+9','10*0+0-0*0+0+0-0+9','10*0+0-0*0+0+0*0+9','10*0+0-0*0+0-0+0+9','10*0+0-0*0+0-0-0+9','10*0+0-0*0+0-0*0+9','10*0+0-0*0+0*0+0+9','10*0+0-0*0+0*0-0+9','10*0+0-0*0+0*0*0+9','10*0+0-0*0-0+0+0+9','10*0+0-0*0-0+0-0+9','10*0+0-0*0-0+0*0+9','10*0+0-0*0-0-0+0+9','10*0+0-0*0-0-0-0+9','10*0+0-0*0-0-0*0+9','10*0+0-0*0-0*0+0+9','10*0+0-0*0-0*0-0+9','10*0+0-0*0-0*0*0+9','10*0+0-0*0*0+0+0+9','10*0+0-0*0*0+0-0+9','10*0+0-0*0*0+0*0+9','10*0+0-0*0*0-0+0+9','10*0+0-0*0*0-0-0+9','10*0+0-0*0*0-0*0+9','10*0+0-0*0*0*0+0+9','10*0+0-0*0*0*0-0+9','10*0+0-0*0*0*0*0+9','10*0+0*0+0+0+0+0+9','10*0+0*0+0+0+0-0+9','10*0+0*0+0+0+0*0+9','10*0+0*0+0+0-0+0+9','10*0+0*0+0+0-0-0+9','10*0+0*0+0+0-0*0+9','10*0+0*0+0+0*0+0+9','10*0+0*0+0+0*0-0+9','10*0+0*0+0+0*0*0+9','10*0+0*0+0-0+0+0+9','10*0+0*0+0-0+0-0+9','10*0+0*0+0-0+0*0+9','10*0+0*0+0-0-0+0+9','10*0+0*0+0-0-0-0+9','10*0+0*0+0-0-0*0+9','10*0+0*0+0-0*0+0+9','10*0+0*0+0-0*0-0+9','10*0+0*0+0-0*0*0+9','10*0+0*0+0*0+0+0+9','10*0+0*0+0*0+0-0+9','10*0+0*0+0*0+0*0+9','10*0+0*0+0*0-0+0+9','10*0+0*0+0*0-0-0+9','10*0+0*0+0*0-0*0+9','10*0+0*0+0*0*0+0+9','10*0+0*0+0*0*0-0+9','10*0+0*0+0*0*0*0+9','10*0+0*0-0+0+0+0+9','10*0+0*0-0+0+0-0+9','10*0+0*0-0+0+0*0+9','10*0+0*0-0+0-0+0+9','10*0+0*0-0+0-0-0+9','10*0+0*0-0+0-0*0+9','10*0+0*0-0+0*0+0+9','10*0+0*0-0+0*0-0+9','10*0+0*0-0+0*0*0+9','10*0+0*0-0-0+0+0+9','10*0+0*0-0-0+0-0+9','10*0+0*0-0-0+0*0+9','10*0+0*0-0-0-0+0+9','10*0+0*0-0-0-0-0+9','10*0+0*0-0-0-0*0+9','10*0+0*0-0-0*0+0+9','10*0+0*0-0-0*0-0+9','10*0+0*0-0-0*0*0+9','10*0+0*0-0*0+0+0+9','10*0+0*0-0*0+0-0+9','10*0+0*0-0*0+0*0+9','10*0+0*0-0*0-0+0+9','10*0+0*0-0*0-0-0+9','10*0+0*0-0*0-0*0+9','10*0+0*0-0*0*0+0+9','10*0+0*0-0*0*0-0+9','10*0+0*0-0*0*0*0+9','10*0+0*0*0+0+0+0+9','10*0+0*0*0+0+0-0+9','10*0+0*0*0+0+0*0+9','10*0+0*0*0+0-0+0+9','10*0+0*0*0+0-0-0+9','10*0+0*0*0+0-0*0+9','10*0+0*0*0+0*0+0+9','10*0+0*0*0+0*0-0+9','10*0+0*0*0+0*0*0+9','10*0+0*0*0-0+0+0+9','10*0+0*0*0-0+0-0+9','10*0+0*0*0-0+0*0+9','10*0+0*0*0-0-0+0+9','10*0+0*0*0-0-0-0+9','10*0+0*0*0-0-0*0+9','10*0+0*0*0-0*0+0+9','10*0+0*0*0-0*0-0+9','10*0+0*0*0-0*0*0+9','10*0+0*0*0*0+0+0+9','10*0+0*0*0*0+0-0+9','10*0+0*0*0*0+0*0+9','10*0+0*0*0*0-0+0+9','10*0+0*0*0*0-0-0+9','10*0+0*0*0*0-0*0+9','10*0+0*0*0*0*0+0+9','10*0+0*0*0*0*0-0+9','10*0+0*0*0*0*0*0+9','10*0-0+0+0+0+0+0+9','10*0-0+0+0+0+0-0+9','10*0-0+0+0+0+0*0+9','10*0-0+0+0+0-0+0+9','10*0-0+0+0+0-0-0+9','10*0-0+0+0+0-0*0+9','10*0-0+0+0+0*0+0+9','10*0-0+0+0+0*0-0+9','10*0-0+0+0+0*0*0+9','10*0-0+0+0-0+0+0+9','10*0-0+0+0-0+0-0+9','10*0-0+0+0-0+0*0+9','10*0-0+0+0-0-0+0+9','10*0-0+0+0-0-0-0+9','10*0-0+0+0-0-0*0+9','10*0-0+0+0-0*0+0+9','10*0-0+0+0-0*0-0+9','10*0-0+0+0-0*0*0+9','10*0-0+0+0*0+0+0+9','10*0-0+0+0*0+0-0+9','10*0-0+0+0*0+0*0+9','10*0-0+0+0*0-0+0+9','10*0-0+0+0*0-0-0+9','10*0-0+0+0*0-0*0+9','10*0-0+0+0*0*0+0+9','10*0-0+0+0*0*0-0+9','10*0-0+0+0*0*0*0+9','10*0-0+0-0+0+0+0+9','10*0-0+0-0+0+0-0+9','10*0-0+0-0+0+0*0+9','10*0-0+0-0+0-0+0+9','10*0-0+0-0+0-0-0+9','10*0-0+0-0+0-0*0+9','10*0-0+0-0+0*0+0+9','10*0-0+0-0+0*0-0+9','10*0-0+0-0+0*0*0+9','10*0-0+0-0-0+0+0+9','10*0-0+0-0-0+0-0+9','10*0-0+0-0-0+0*0+9','10*0-0+0-0-0-0+0+9','10*0-0+0-0-0-0-0+9','10*0-0+0-0-0-0*0+9','10*0-0+0-0-0*0+0+9','10*0-0+0-0-0*0-0+9','10*0-0+0-0-0*0*0+9','10*0-0+0-0*0+0+0+9','10*0-0+0-0*0+0-0+9','10*0-0+0-0*0+0*0+9','10*0-0+0-0*0-0+0+9','10*0-0+0-0*0-0-0+9','10*0-0+0-0*0-0*0+9','10*0-0+0-0*0*0+0+9','10*0-0+0-0*0*0-0+9','10*0-0+0-0*0*0*0+9','10*0-0+0*0+0+0+0+9','10*0-0+0*0+0+0-0+9','10*0-0+0*0+0+0*0+9','10*0-0+0*0+0-0+0+9','10*0-0+0*0+0-0-0+9','10*0-0+0*0+0-0*0+9','10*0-0+0*0+0*0+0+9','10*0-0+0*0+0*0-0+9','10*0-0+0*0+0*0*0+9','10*0-0+0*0-0+0+0+9','10*0-0+0*0-0+0-0+9','10*0-0+0*0-0+0*0+9','10*0-0+0*0-0-0+0+9','10*0-0+0*0-0-0-0+9','10*0-0+0*0-0-0*0+9','10*0-0+0*0-0*0+0+9','10*0-0+0*0-0*0-0+9','10*0-0+0*0-0*0*0+9','10*0-0+0*0*0+0+0+9','10*0-0+0*0*0+0-0+9','10*0-0+0*0*0+0*0+9','10*0-0+0*0*0-0+0+9','10*0-0+0*0*0-0-0+9','10*0-0+0*0*0-0*0+9','10*0-0+0*0*0*0+0+9','10*0-0+0*0*0*0-0+9','10*0-0+0*0*0*0*0+9','10*0-0-0+0+0+0+0+9','10*0-0-0+0+0+0-0+9','10*0-0-0+0+0+0*0+9','10*0-0-0+0+0-0+0+9','10*0-0-0+0+0-0-0+9','10*0-0-0+0+0-0*0+9','10*0-0-0+0+0*0+0+9','10*0-0-0+0+0*0-0+9','10*0-0-0+0+0*0*0+9','10*0-0-0+0-0+0+0+9','10*0-0-0+0-0+0-0+9','10*0-0-0+0-0+0*0+9','10*0-0-0+0-0-0+0+9','10*0-0-0+0-0-0-0+9','10*0-0-0+0-0-0*0+9','10*0-0-0+0-0*0+0+9','10*0-0-0+0-0*0-0+9','10*0-0-0+0-0*0*0+9','10*0-0-0+0*0+0+0+9','10*0-0-0+0*0+0-0+9','10*0-0-0+0*0+0*0+9','10*0-0-0+0*0-0+0+9','10*0-0-0+0*0-0-0+9','10*0-0-0+0*0-0*0+9','10*0-0-0+0*0*0+0+9','10*0-0-0+0*0*0-0+9','10*0-0-0+0*0*0*0+9','10*0-0-0-0+0+0+0+9','10*0-0-0-0+0+0-0+9','10*0-0-0-0+0+0*0+9','10*0-0-0-0+0-0+0+9','10*0-0-0-0+0-0-0+9','10*0-0-0-0+0-0*0+9','10*0-0-0-0+0*0+0+9','10*0-0-0-0+0*0-0+9','10*0-0-0-0+0*0*0+9','10*0-0-0-0-0+0+0+9','10*0-0-0-0-0+0-0+9','10*0-0-0-0-0+0*0+9','10*0-0-0-0-0-0+0+9','10*0-0-0-0-0-0-0+9','10*0-0-0-0-0-0*0+9','10*0-0-0-0-0*0+0+9','10*0-0-0-0-0*0-0+9','10*0-0-0-0-0*0*0+9','10*0-0-0-0*0+0+0+9','10*0-0-0-0*0+0-0+9','10*0-0-0-0*0+0*0+9','10*0-0-0-0*0-0+0+9','10*0-0-0-0*0-0-0+9','10*0-0-0-0*0-0*0+9','10*0-0-0-0*0*0+0+9','10*0-0-0-0*0*0-0+9','10*0-0-0-0*0*0*0+9','10*0-0-0*0+0+0+0+9','10*0-0-0*0+0+0-0+9','10*0-0-0*0+0+0*0+9','10*0-0-0*0+0-0+0+9','10*0-0-0*0+0-0-0+9','10*0-0-0*0+0-0*0+9','10*0-0-0*0+0*0+0+9','10*0-0-0*0+0*0-0+9','10*0-0-0*0+0*0*0+9','10*0-0-0*0-0+0+0+9','10*0-0-0*0-0+0-0+9','10*0-0-0*0-0+0*0+9','10*0-0-0*0-0-0+0+9','10*0-0-0*0-0-0-0+9','10*0-0-0*0-0-0*0+9','10*0-0-0*0-0*0+0+9','10*0-0-0*0-0*0-0+9','10*0-0-0*0-0*0*0+9','10*0-0-0*0*0+0+0+9','10*0-0-0*0*0+0-0+9','10*0-0-0*0*0+0*0+9','10*0-0-0*0*0-0+0+9','10*0-0-0*0*0-0-0+9','10*0-0-0*0*0-0*0+9','10*0-0-0*0*0*0+0+9','10*0-0-0*0*0*0-0+9','10*0-0-0*0*0*0*0+9','10*0-0*0+0+0+0+0+9','10*0-0*0+0+0+0-0+9','10*0-0*0+0+0+0*0+9','10*0-0*0+0+0-0+0+9','10*0-0*0+0+0-0-0+9','10*0-0*0+0+0-0*0+9','10*0-0*0+0+0*0+0+9','10*0-0*0+0+0*0-0+9','10*0-0*0+0+0*0*0+9','10*0-0*0+0-0+0+0+9','10*0-0*0+0-0+0-0+9','10*0-0*0+0-0+0*0+9','10*0-0*0+0-0-0+0+9','10*0-0*0+0-0-0-0+9','10*0-0*0+0-0-0*0+9','10*0-0*0+0-0*0+0+9','10*0-0*0+0-0*0-0+9','10*0-0*0+0-0*0*0+9','10*0-0*0+0*0+0+0+9','10*0-0*0+0*0+0-0+9','10*0-0*0+0*0+0*0+9','10*0-0*0+0*0-0+0+9','10*0-0*0+0*0-0-0+9','10*0-0*0+0*0-0*0+9','10*0-0*0+0*0*0+0+9','10*0-0*0+0*0*0-0+9','10*0-0*0+0*0*0*0+9','10*0-0*0-0+0+0+0+9','10*0-0*0-0+0+0-0+9','10*0-0*0-0+0+0*0+9','10*0-0*0-0+0-0+0+9','10*0-0*0-0+0-0-0+9','10*0-0*0-0+0-0*0+9','10*0-0*0-0+0*0+0+9','10*0-0*0-0+0*0-0+9','10*0-0*0-0+0*0*0+9','10*0-0*0-0-0+0+0+9','10*0-0*0-0-0+0-0+9','10*0-0*0-0-0+0*0+9','10*0-0*0-0-0-0+0+9','10*0-0*0-0-0-0-0+9','10*0-0*0-0-0-0*0+9','10*0-0*0-0-0*0+0+9','10*0-0*0-0-0*0-0+9','10*0-0*0-0-0*0*0+9','10*0-0*0-0*0+0+0+9','10*0-0*0-0*0+0-0+9','10*0-0*0-0*0+0*0+9','10*0-0*0-0*0-0+0+9','10*0-0*0-0*0-0-0+9','10*0-0*0-0*0-0*0+9','10*0-0*0-0*0*0+0+9','10*0-0*0-0*0*0-0+9','10*0-0*0-0*0*0*0+9','10*0-0*0*0+0+0+0+9','10*0-0*0*0+0+0-0+9','10*0-0*0*0+0+0*0+9','10*0-0*0*0+0-0+0+9','10*0-0*0*0+0-0-0+9','10*0-0*0*0+0-0*0+9','10*0-0*0*0+0*0+0+9','10*0-0*0*0+0*0-0+9','10*0-0*0*0+0*0*0+9','10*0-0*0*0-0+0+0+9','10*0-0*0*0-0+0-0+9','10*0-0*0*0-0+0*0+9','10*0-0*0*0-0-0+0+9','10*0-0*0*0-0-0-0+9','10*0-0*0*0-0-0*0+9','10*0-0*0*0-0*0+0+9','10*0-0*0*0-0*0-0+9','10*0-0*0*0-0*0*0+9','10*0-0*0*0*0+0+0+9','10*0-0*0*0*0+0-0+9','10*0-0*0*0*0+0*0+9','10*0-0*0*0*0-0+0+9','10*0-0*0*0*0-0-0+9','10*0-0*0*0*0-0*0+9','10*0-0*0*0*0*0+0+9','10*0-0*0*0*0*0-0+9','10*0-0*0*0*0*0*0+9','10*0*0+0+0+0+0+0+9','10*0*0+0+0+0+0-0+9','10*0*0+0+0+0+0*0+9','10*0*0+0+0+0-0+0+9','10*0*0+0+0+0-0-0+9','10*0*0+0+0+0-0*0+9','10*0*0+0+0+0*0+0+9','10*0*0+0+0+0*0-0+9','10*0*0+0+0+0*0*0+9','10*0*0+0+0-0+0+0+9','10*0*0+0+0-0+0-0+9','10*0*0+0+0-0+0*0+9','10*0*0+0+0-0-0+0+9','10*0*0+0+0-0-0-0+9','10*0*0+0+0-0-0*0+9','10*0*0+0+0-0*0+0+9','10*0*0+0+0-0*0-0+9','10*0*0+0+0-0*0*0+9','10*0*0+0+0*0+0+0+9','10*0*0+0+0*0+0-0+9','10*0*0+0+0*0+0*0+9','10*0*0+0+0*0-0+0+9','10*0*0+0+0*0-0-0+9','10*0*0+0+0*0-0*0+9','10*0*0+0+0*0*0+0+9','10*0*0+0+0*0*0-0+9','10*0*0+0+0*0*0*0+9','10*0*0+0-0+0+0+0+9','10*0*0+0-0+0+0-0+9','10*0*0+0-0+0+0*0+9','10*0*0+0-0+0-0+0+9','10*0*0+0-0+0-0-0+9','10*0*0+0-0+0-0*0+9','10*0*0+0-0+0*0+0+9','10*0*0+0-0+0*0-0+9','10*0*0+0-0+0*0*0+9','10*0*0+0-0-0+0+0+9','10*0*0+0-0-0+0-0+9','10*0*0+0-0-0+0*0+9','10*0*0+0-0-0-0+0+9','10*0*0+0-0-0-0-0+9','10*0*0+0-0-0-0*0+9','10*0*0+0-0-0*0+0+9','10*0*0+0-0-0*0-0+9','10*0*0+0-0-0*0*0+9','10*0*0+0-0*0+0+0+9','10*0*0+0-0*0+0-0+9','10*0*0+0-0*0+0*0+9','10*0*0+0-0*0-0+0+9','10*0*0+0-0*0-0-0+9','10*0*0+0-0*0-0*0+9','10*0*0+0-0*0*0+0+9','10*0*0+0-0*0*0-0+9','10*0*0+0-0*0*0*0+9','10*0*0+0*0+0+0+0+9','10*0*0+0*0+0+0-0+9','10*0*0+0*0+0+0*0+9','10*0*0+0*0+0-0+0+9','10*0*0+0*0+0-0-0+9','10*0*0+0*0+0-0*0+9','10*0*0+0*0+0*0+0+9','10*0*0+0*0+0*0-0+9','10*0*0+0*0+0*0*0+9','10*0*0+0*0-0+0+0+9','10*0*0+0*0-0+0-0+9','10*0*0+0*0-0+0*0+9','10*0*0+0*0-0-0+0+9','10*0*0+0*0-0-0-0+9','10*0*0+0*0-0-0*0+9','10*0*0+0*0-0*0+0+9','10*0*0+0*0-0*0-0+9','10*0*0+0*0-0*0*0+9','10*0*0+0*0*0+0+0+9','10*0*0+0*0*0+0-0+9','10*0*0+0*0*0+0*0+9','10*0*0+0*0*0-0+0+9','10*0*0+0*0*0-0-0+9','10*0*0+0*0*0-0*0+9','10*0*0+0*0*0*0+0+9','10*0*0+0*0*0*0-0+9','10*0*0+0*0*0*0*0+9','10*0*0-0+0+0+0+0+9','10*0*0-0+0+0+0-0+9','10*0*0-0+0+0+0*0+9','10*0*0-0+0+0-0+0+9','10*0*0-0+0+0-0-0+9','10*0*0-0+0+0-0*0+9','10*0*0-0+0+0*0+0+9','10*0*0-0+0+0*0-0+9','10*0*0-0+0+0*0*0+9','10*0*0-0+0-0+0+0+9','10*0*0-0+0-0+0-0+9','10*0*0-0+0-0+0*0+9','10*0*0-0+0-0-0+0+9','10*0*0-0+0-0-0-0+9','10*0*0-0+0-0-0*0+9','10*0*0-0+0-0*0+0+9','10*0*0-0+0-0*0-0+9','10*0*0-0+0-0*0*0+9','10*0*0-0+0*0+0+0+9','10*0*0-0+0*0+0-0+9','10*0*0-0+0*0+0*0+9','10*0*0-0+0*0-0+0+9','10*0*0-0+0*0-0-0+9','10*0*0-0+0*0-0*0+9','10*0*0-0+0*0*0+0+9','10*0*0-0+0*0*0-0+9','10*0*0-0+0*0*0*0+9','10*0*0-0-0+0+0+0+9','10*0*0-0-0+0+0-0+9','10*0*0-0-0+0+0*0+9','10*0*0-0-0+0-0+0+9','10*0*0-0-0+0-0-0+9','10*0*0-0-0+0-0*0+9','10*0*0-0-0+0*0+0+9','10*0*0-0-0+0*0-0+9','10*0*0-0-0+0*0*0+9','10*0*0-0-0-0+0+0+9','10*0*0-0-0-0+0-0+9','10*0*0-0-0-0+0*0+9','10*0*0-0-0-0-0+0+9','10*0*0-0-0-0-0-0+9','10*0*0-0-0-0-0*0+9','10*0*0-0-0-0*0+0+9','10*0*0-0-0-0*0-0+9','10*0*0-0-0-0*0*0+9','10*0*0-0-0*0+0+0+9','10*0*0-0-0*0+0-0+9','10*0*0-0-0*0+0*0+9','10*0*0-0-0*0-0+0+9','10*0*0-0-0*0-0-0+9','10*0*0-0-0*0-0*0+9','10*0*0-0-0*0*0+0+9','10*0*0-0-0*0*0-0+9','10*0*0-0-0*0*0*0+9','10*0*0-0*0+0+0+0+9','10*0*0-0*0+0+0-0+9','10*0*0-0*0+0+0*0+9','10*0*0-0*0+0-0+0+9','10*0*0-0*0+0-0-0+9','10*0*0-0*0+0-0*0+9','10*0*0-0*0+0*0+0+9','10*0*0-0*0+0*0-0+9','10*0*0-0*0+0*0*0+9','10*0*0-0*0-0+0+0+9','10*0*0-0*0-0+0-0+9','10*0*0-0*0-0+0*0+9','10*0*0-0*0-0-0+0+9','10*0*0-0*0-0-0-0+9','10*0*0-0*0-0-0*0+9','10*0*0-0*0-0*0+0+9','10*0*0-0*0-0*0-0+9','10*0*0-0*0-0*0*0+9','10*0*0-0*0*0+0+0+9','10*0*0-0*0*0+0-0+9','10*0*0-0*0*0+0*0+9','10*0*0-0*0*0-0+0+9','10*0*0-0*0*0-0-0+9','10*0*0-0*0*0-0*0+9','10*0*0-0*0*0*0+0+9','10*0*0-0*0*0*0-0+9','10*0*0-0*0*0*0*0+9','10*0*0*0+0+0+0+0+9','10*0*0*0+0+0+0-0+9','10*0*0*0+0+0+0*0+9','10*0*0*0+0+0-0+0+9','10*0*0*0+0+0-0-0+9','10*0*0*0+0+0-0*0+9','10*0*0*0+0+0*0+0+9','10*0*0*0+0+0*0-0+9','10*0*0*0+0+0*0*0+9','10*0*0*0+0-0+0+0+9','10*0*0*0+0-0+0-0+9','10*0*0*0+0-0+0*0+9','10*0*0*0+0-0-0+0+9','10*0*0*0+0-0-0-0+9','10*0*0*0+0-0-0*0+9','10*0*0*0+0-0*0+0+9','10*0*0*0+0-0*0-0+9','10*0*0*0+0-0*0*0+9','10*0*0*0+0*0+0+0+9','10*0*0*0+0*0+0-0+9','10*0*0*0+0*0+0*0+9','10*0*0*0+0*0-0+0+9','10*0*0*0+0*0-0-0+9','10*0*0*0+0*0-0*0+9','10*0*0*0+0*0*0+0+9','10*0*0*0+0*0*0-0+9','10*0*0*0+0*0*0*0+9','10*0*0*0-0+0+0+0+9','10*0*0*0-0+0+0-0+9','10*0*0*0-0+0+0*0+9','10*0*0*0-0+0-0+0+9','10*0*0*0-0+0-0-0+9','10*0*0*0-0+0-0*0+9','10*0*0*0-0+0*0+0+9','10*0*0*0-0+0*0-0+9','10*0*0*0-0+0*0*0+9','10*0*0*0-0-0+0+0+9','10*0*0*0-0-0+0-0+9','10*0*0*0-0-0+0*0+9','10*0*0*0-0-0-0+0+9','10*0*0*0-0-0-0-0+9','10*0*0*0-0-0-0*0+9','10*0*0*0-0-0*0+0+9','10*0*0*0-0-0*0-0+9','10*0*0*0-0-0*0*0+9','10*0*0*0-0*0+0+0+9','10*0*0*0-0*0+0-0+9','10*0*0*0-0*0+0*0+9','10*0*0*0-0*0-0+0+9','10*0*0*0-0*0-0-0+9','10*0*0*0-0*0-0*0+9','10*0*0*0-0*0*0+0+9','10*0*0*0-0*0*0-0+9','10*0*0*0-0*0*0*0+9','10*0*0*0*0+0+0+0+9','10*0*0*0*0+0+0-0+9','10*0*0*0*0+0+0*0+9','10*0*0*0*0+0-0+0+9','10*0*0*0*0+0-0-0+9','10*0*0*0*0+0-0*0+9','10*0*0*0*0+0*0+0+9','10*0*0*0*0+0*0-0+9','10*0*0*0*0+0*0*0+9','10*0*0*0*0-0+0+0+9','10*0*0*0*0-0+0-0+9','10*0*0*0*0-0+0*0+9','10*0*0*0*0-0-0+0+9','10*0*0*0*0-0-0-0+9','10*0*0*0*0-0-0*0+9','10*0*0*0*0-0*0+0+9','10*0*0*0*0-0*0-0+9','10*0*0*0*0-0*0*0+9','10*0*0*0*0*0+0+0+9','10*0*0*0*0*0+0-0+9','10*0*0*0*0*0+0*0+9','10*0*0*0*0*0-0+0+9','10*0*0*0*0*0-0-0+9','10*0*0*0*0*0-0*0+9','10*0*0*0*0*0*0+0+9','10*0*0*0*0*0*0-0+9','10*0*0*0*0*0*0*0+9','100*0+0+0+0+0+0+9','100*0+0+0+0+0-0+9','100*0+0+0+0+0*0+9','100*0+0+0+0-0+0+9','100*0+0+0+0-0-0+9','100*0+0+0+0-0*0+9','100*0+0+0+0*0+0+9','100*0+0+0+0*0-0+9','100*0+0+0+0*0*0+9','100*0+0+0-0+0+0+9','100*0+0+0-0+0-0+9','100*0+0+0-0+0*0+9','100*0+0+0-0-0+0+9','100*0+0+0-0-0-0+9','100*0+0+0-0-0*0+9','100*0+0+0-0*0+0+9','100*0+0+0-0*0-0+9','100*0+0+0-0*0*0+9','100*0+0+0*0+0+0+9','100*0+0+0*0+0-0+9','100*0+0+0*0+0*0+9','100*0+0+0*0-0+0+9','100*0+0+0*0-0-0+9','100*0+0+0*0-0*0+9','100*0+0+0*0*0+0+9','100*0+0+0*0*0-0+9','100*0+0+0*0*0*0+9','100*0+0-0+0+0+0+9','100*0+0-0+0+0-0+9','100*0+0-0+0+0*0+9','100*0+0-0+0-0+0+9','100*0+0-0+0-0-0+9','100*0+0-0+0-0*0+9','100*0+0-0+0*0+0+9','100*0+0-0+0*0-0+9','100*0+0-0+0*0*0+9','100*0+0-0-0+0+0+9','100*0+0-0-0+0-0+9','100*0+0-0-0+0*0+9','100*0+0-0-0-0+0+9','100*0+0-0-0-0-0+9','100*0+0-0-0-0*0+9','100*0+0-0-0*0+0+9','100*0+0-0-0*0-0+9','100*0+0-0-0*0*0+9','100*0+0-0*0+0+0+9','100*0+0-0*0+0-0+9','100*0+0-0*0+0*0+9','100*0+0-0*0-0+0+9','100*0+0-0*0-0-0+9','100*0+0-0*0-0*0+9','100*0+0-0*0*0+0+9','100*0+0-0*0*0-0+9','100*0+0-0*0*0*0+9','100*0+0*0+0+0+0+9','100*0+0*0+0+0-0+9','100*0+0*0+0+0*0+9','100*0+0*0+0-0+0+9','100*0+0*0+0-0-0+9','100*0+0*0+0-0*0+9','100*0+0*0+0*0+0+9','100*0+0*0+0*0-0+9','100*0+0*0+0*0*0+9','100*0+0*0-0+0+0+9','100*0+0*0-0+0-0+9','100*0+0*0-0+0*0+9','100*0+0*0-0-0+0+9','100*0+0*0-0-0-0+9','100*0+0*0-0-0*0+9','100*0+0*0-0*0+0+9','100*0+0*0-0*0-0+9','100*0+0*0-0*0*0+9','100*0+0*0*0+0+0+9','100*0+0*0*0+0-0+9','100*0+0*0*0+0*0+9','100*0+0*0*0-0+0+9','100*0+0*0*0-0-0+9','100*0+0*0*0-0*0+9','100*0+0*0*0*0+0+9','100*0+0*0*0*0-0+9','100*0+0*0*0*0*0+9','100*0-0+0+0+0+0+9','100*0-0+0+0+0-0+9','100*0-0+0+0+0*0+9','100*0-0+0+0-0+0+9','100*0-0+0+0-0-0+9','100*0-0+0+0-0*0+9','100*0-0+0+0*0+0+9','100*0-0+0+0*0-0+9','100*0-0+0+0*0*0+9','100*0-0+0-0+0+0+9','100*0-0+0-0+0-0+9','100*0-0+0-0+0*0+9','100*0-0+0-0-0+0+9','100*0-0+0-0-0-0+9','100*0-0+0-0-0*0+9','100*0-0+0-0*0+0+9','100*0-0+0-0*0-0+9','100*0-0+0-0*0*0+9','100*0-0+0*0+0+0+9','100*0-0+0*0+0-0+9','100*0-0+0*0+0*0+9','100*0-0+0*0-0+0+9','100*0-0+0*0-0-0+9','100*0-0+0*0-0*0+9','100*0-0+0*0*0+0+9','100*0-0+0*0*0-0+9','100*0-0+0*0*0*0+9','100*0-0-0+0+0+0+9','100*0-0-0+0+0-0+9','100*0-0-0+0+0*0+9','100*0-0-0+0-0+0+9','100*0-0-0+0-0-0+9','100*0-0-0+0-0*0+9','100*0-0-0+0*0+0+9','100*0-0-0+0*0-0+9','100*0-0-0+0*0*0+9','100*0-0-0-0+0+0+9','100*0-0-0-0+0-0+9','100*0-0-0-0+0*0+9','100*0-0-0-0-0+0+9','100*0-0-0-0-0-0+9','100*0-0-0-0-0*0+9','100*0-0-0-0*0+0+9','100*0-0-0-0*0-0+9','100*0-0-0-0*0*0+9','100*0-0-0*0+0+0+9','100*0-0-0*0+0-0+9','100*0-0-0*0+0*0+9','100*0-0-0*0-0+0+9','100*0-0-0*0-0-0+9','100*0-0-0*0-0*0+9','100*0-0-0*0*0+0+9','100*0-0-0*0*0-0+9','100*0-0-0*0*0*0+9','100*0-0*0+0+0+0+9','100*0-0*0+0+0-0+9','100*0-0*0+0+0*0+9','100*0-0*0+0-0+0+9','100*0-0*0+0-0-0+9','100*0-0*0+0-0*0+9','100*0-0*0+0*0+0+9','100*0-0*0+0*0-0+9','100*0-0*0+0*0*0+9','100*0-0*0-0+0+0+9','100*0-0*0-0+0-0+9','100*0-0*0-0+0*0+9','100*0-0*0-0-0+0+9','100*0-0*0-0-0-0+9','100*0-0*0-0-0*0+9','100*0-0*0-0*0+0+9','100*0-0*0-0*0-0+9','100*0-0*0-0*0*0+9','100*0-0*0*0+0+0+9','100*0-0*0*0+0-0+9','100*0-0*0*0+0*0+9','100*0-0*0*0-0+0+9','100*0-0*0*0-0-0+9','100*0-0*0*0-0*0+9','100*0-0*0*0*0+0+9','100*0-0*0*0*0-0+9','100*0-0*0*0*0*0+9','100*0*0+0+0+0+0+9','100*0*0+0+0+0-0+9','100*0*0+0+0+0*0+9','100*0*0+0+0-0+0+9','100*0*0+0+0-0-0+9','100*0*0+0+0-0*0+9','100*0*0+0+0*0+0+9','100*0*0+0+0*0-0+9','100*0*0+0+0*0*0+9','100*0*0+0-0+0+0+9','100*0*0+0-0+0-0+9','100*0*0+0-0+0*0+9','100*0*0+0-0-0+0+9','100*0*0+0-0-0-0+9','100*0*0+0-0-0*0+9','100*0*0+0-0*0+0+9','100*0*0+0-0*0-0+9','100*0*0+0-0*0*0+9','100*0*0+0*0+0+0+9','100*0*0+0*0+0-0+9','100*0*0+0*0+0*0+9','100*0*0+0*0-0+0+9','100*0*0+0*0-0-0+9','100*0*0+0*0-0*0+9','100*0*0+0*0*0+0+9','100*0*0+0*0*0-0+9','100*0*0+0*0*0*0+9','100*0*0-0+0+0+0+9','100*0*0-0+0+0-0+9','100*0*0-0+0+0*0+9','100*0*0-0+0-0+0+9','100*0*0-0+0-0-0+9','100*0*0-0+0-0*0+9','100*0*0-0+0*0+0+9','100*0*0-0+0*0-0+9','100*0*0-0+0*0*0+9','100*0*0-0-0+0+0+9','100*0*0-0-0+0-0+9','100*0*0-0-0+0*0+9','100*0*0-0-0-0+0+9','100*0*0-0-0-0-0+9','100*0*0-0-0-0*0+9','100*0*0-0-0*0+0+9','100*0*0-0-0*0-0+9','100*0*0-0-0*0*0+9','100*0*0-0*0+0+0+9','100*0*0-0*0+0-0+9','100*0*0-0*0+0*0+9','100*0*0-0*0-0+0+9','100*0*0-0*0-0-0+9','100*0*0-0*0-0*0+9','100*0*0-0*0*0+0+9','100*0*0-0*0*0-0+9','100*0*0-0*0*0*0+9','100*0*0*0+0+0+0+9','100*0*0*0+0+0-0+9','100*0*0*0+0+0*0+9','100*0*0*0+0-0+0+9','100*0*0*0+0-0-0+9','100*0*0*0+0-0*0+9','100*0*0*0+0*0+0+9','100*0*0*0+0*0-0+9','100*0*0*0+0*0*0+9','100*0*0*0-0+0+0+9','100*0*0*0-0+0-0+9','100*0*0*0-0+0*0+9','100*0*0*0-0-0+0+9','100*0*0*0-0-0-0+9','100*0*0*0-0-0*0+9','100*0*0*0-0*0+0+9','100*0*0*0-0*0-0+9','100*0*0*0-0*0*0+9','100*0*0*0*0+0+0+9','100*0*0*0*0+0-0+9','100*0*0*0*0+0*0+9','100*0*0*0*0-0+0+9','100*0*0*0*0-0-0+9','100*0*0*0*0-0*0+9','100*0*0*0*0*0+0+9','100*0*0*0*0*0-0+9','100*0*0*0*0*0*0+9','1000*0+0+0+0+0+9','1000*0+0+0+0-0+9','1000*0+0+0+0*0+9','1000*0+0+0-0+0+9','1000*0+0+0-0-0+9','1000*0+0+0-0*0+9','1000*0+0+0*0+0+9','1000*0+0+0*0-0+9','1000*0+0+0*0*0+9','1000*0+0-0+0+0+9','1000*0+0-0+0-0+9','1000*0+0-0+0*0+9','1000*0+0-0-0+0+9','1000*0+0-0-0-0+9','1000*0+0-0-0*0+9','1000*0+0-0*0+0+9','1000*0+0-0*0-0+9','1000*0+0-0*0*0+9','1000*0+0*0+0+0+9','1000*0+0*0+0-0+9','1000*0+0*0+0*0+9','1000*0+0*0-0+0+9','1000*0+0*0-0-0+9','1000*0+0*0-0*0+9','1000*0+0*0*0+0+9','1000*0+0*0*0-0+9','1000*0+0*0*0*0+9','1000*0-0+0+0+0+9','1000*0-0+0+0-0+9','1000*0-0+0+0*0+9','1000*0-0+0-0+0+9','1000*0-0+0-0-0+9','1000*0-0+0-0*0+9','1000*0-0+0*0+0+9','1000*0-0+0*0-0+9','1000*0-0+0*0*0+9','1000*0-0-0+0+0+9','1000*0-0-0+0-0+9','1000*0-0-0+0*0+9','1000*0-0-0-0+0+9','1000*0-0-0-0-0+9','1000*0-0-0-0*0+9','1000*0-0-0*0+0+9','1000*0-0-0*0-0+9','1000*0-0-0*0*0+9','1000*0-0*0+0+0+9','1000*0-0*0+0-0+9','1000*0-0*0+0*0+9','1000*0-0*0-0+0+9','1000*0-0*0-0-0+9','1000*0-0*0-0*0+9','1000*0-0*0*0+0+9','1000*0-0*0*0-0+9','1000*0-0*0*0*0+9','1000*0*0+0+0+0+9','1000*0*0+0+0-0+9','1000*0*0+0+0*0+9','1000*0*0+0-0+0+9','1000*0*0+0-0-0+9','1000*0*0+0-0*0+9','1000*0*0+0*0+0+9','1000*0*0+0*0-0+9','1000*0*0+0*0*0+9','1000*0*0-0+0+0+9','1000*0*0-0+0-0+9','1000*0*0-0+0*0+9','1000*0*0-0-0+0+9','1000*0*0-0-0-0+9','1000*0*0-0-0*0+9','1000*0*0-0*0+0+9','1000*0*0-0*0-0+9','1000*0*0-0*0*0+9','1000*0*0*0+0+0+9','1000*0*0*0+0-0+9','1000*0*0*0+0*0+9','1000*0*0*0-0+0+9','1000*0*0*0-0-0+9','1000*0*0*0-0*0+9','1000*0*0*0*0+0+9','1000*0*0*0*0-0+9','1000*0*0*0*0*0+9','10000*0+0+0+0+9','10000*0+0+0-0+9','10000*0+0+0*0+9','10000*0+0-0+0+9','10000*0+0-0-0+9','10000*0+0-0*0+9','10000*0+0*0+0+9','10000*0+0*0-0+9','10000*0+0*0*0+9','10000*0-0+0+0+9','10000*0-0+0-0+9','10000*0-0+0*0+9','10000*0-0-0+0+9','10000*0-0-0-0+9','10000*0-0-0*0+9','10000*0-0*0+0+9','10000*0-0*0-0+9','10000*0-0*0*0+9','10000*0*0+0+0+9','10000*0*0+0-0+9','10000*0*0+0*0+9','10000*0*0-0+0+9','10000*0*0-0-0+9','10000*0*0-0*0+9','10000*0*0*0+0+9','10000*0*0*0-0+9','10000*0*0*0*0+9','100000*0+0+0+9','100000*0+0-0+9','100000*0+0*0+9','100000*0-0+0+9','100000*0-0-0+9','100000*0-0*0+9','100000*0*0+0+9','100000*0*0-0+9','100000*0*0*0+9','1000000*0+0+9','1000000*0-0+9','1000000*0*0+9','10000000*0+9']", + "[]", + "['999999999']", + "['0+1']", + "['1+2*3+4','1-2+3*4','12+3-4']" + ], + "boilerplate": { + "python": "class Solution:\n def addOperators(self, num: str, target: int) -> List[str]:\n ", + "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List addOperators(String num, int target) {\n List results = new ArrayList();\n // Implement your solution logic here\n return results;\n }\n}", + "cpp": "class Solution {\npublic:\n vector addOperators(string num, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "import java.util.Arrays;\n\nArrays.sort(result);\nArrays.sort(expected);\nreturn Arrays.equals(result, expected);", + "cpp": "std::sort(result.begin(), result.end());\nstd::sort(expected.begin(), expected.end());\nreturn result == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=tunRDBsP7OQ&pp=ygUhTmVldENvZGUgRXhwcmVzc2lvbiBBZGQgT3BlcmF0b3Jz", + "method_name": "addOperators" }, { - "title": "Remove Invalid Parentheses", - "source": "https://leetcode.com/problems/remove-invalid-parentheses/", - "description": "

Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.

\n\n

Return a list of unique strings that are valid with the minimum number of removals. You may return the answer in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "()())()"\nOutput: ["(())()","()()()"]\n
\n\n

Example 2:

\n\n
\nInput: s = "(a)())()"\nOutput: ["(a())()","(a)()()"]\n
\n\n

Example 3:

\n\n
\nInput: s = ")("\nOutput: [""]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 25
  • \n\t
  • s consists of lowercase English letters and parentheses '(' and ')'.
  • \n\t
  • There will be at most 20 parentheses in s.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=\"()())()\"", - "--arg1=\"(a)())()\"", - "--arg1=\")(\"" - ], - "sample_test_results": [ - "'(())()', '()()()'", - "'(a())()', '(a)()()'", - "''" - ], - "hidden_test_cases": [ - "--arg1=\"()())()\"", - "--arg1=\"(a)())()\"", - "--arg1=\")(\"", - "--arg1=\"((()\"", - "--arg1=\")()\"", - "--arg1=\"(())())\"", - "--arg1=\"())()(((\"", - "--arg1=\"(a)(b)(c))(\"", - "--arg1=\")()(\"", - "--arg1=\"((())\"" - ], - "hidden_test_results": [ - "'(())()', '()()()'", - "'(a())()', '(a)()()'", - "''", - "'()'", - "'()'", - "'(()())', '(())()'", - "'()()'", - "'(a(b)(c))', '(a)(b(c))', '(a)(b)(c)'", - "'()'", - "'(())'" - ], - "boilerplate": { - "python": "class Solution:\n def removeInvalidParentheses(self, s: str) -> List[str]:\n ", - "java": "class Solution {\n public List removeInvalidParentheses(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n vector removeInvalidParentheses(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "List resultSorted = new ArrayList<>(result);\nCollections.sort(resultSorted);\nList expectedSorted = new ArrayList<>(Arrays.asList(eval(expected)));\nCollections.sort(expectedSorted);\nreturn resultSorted.equals(expectedSorted);", - "cpp": "bool compareFunction(const vector& result, const string& expected) {\n vector expectedVec;\n // Assumes a parsing function from string to vector exists\n parseStringToIntVector(expected, expectedVec);\n \n vector sortedResult = result;\n sort(sortedResult.begin(), sortedResult.end());\n \n sort(expectedVec.begin(), expectedVec.end());\n \n return sortedResult == expectedVec;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=mgQ4O9iUEbg&pp=ygUjTmVldENvZGUgUmVtb3ZlIEludmFsaWQgUGFyZW50aGVzZXM%3D" + "title": "Remove Invalid Parentheses", + "source": "https://leetcode.com/problems/remove-invalid-parentheses/", + "description": "

Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.

\n\n

Return a list of unique strings that are valid with the minimum number of removals. You may return the answer in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "()())()"\nOutput: ["(())()","()()()"]\n
\n\n

Example 2:

\n\n
\nInput: s = "(a)())()"\nOutput: ["(a())()","(a)()()"]\n
\n\n

Example 3:

\n\n
\nInput: s = ")("\nOutput: [""]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 25
  • \n\t
  • s consists of lowercase English letters and parentheses '(' and ')'.
  • \n\t
  • There will be at most 20 parentheses in s.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=\"()())()\"", + "--arg1=\"(a)())()\"", + "--arg1=\")(\"" + ], + "sample_test_results": [ + "['(())()','()()()']", + "['(a())()','(a)()()']", + "['']" + ], + "hidden_test_cases": [ + "--arg1=\"()())()\"", + "--arg1=\"(a)())()\"", + "--arg1=\")(\"", + "--arg1=\"((()\"", + "--arg1=\")()\"", + "--arg1=\"(())())\"", + "--arg1=\"())()(((\"", + "--arg1=\"(a)(b)(c))(\"", + "--arg1=\")()(\"", + "--arg1=\"((())\"" + ], + "hidden_test_results": [ + "['(())()','()()()']", + "['(a())()','(a)()()']", + "['']", + "['()']", + "['()']", + "['(()())','(())()']", + "['()()']", + "['(a(b)(c))','(a)(b(c))','(a)(b)(c)']", + "['()']", + "['(())']" + ], + "boilerplate": { + "python": "class Solution:\n def removeInvalidParentheses(self, s: str) -> List[str]:\n ", + "java": "class Solution {\n public List removeInvalidParentheses(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector removeInvalidParentheses(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "List resultSorted = new ArrayList<>(result);\nCollections.sort(resultSorted);\nList expectedSorted = new ArrayList<>(Arrays.asList(eval(expected)));\nCollections.sort(expectedSorted);\nreturn resultSorted.equals(expectedSorted);", + "cpp": "bool compareFunction(const vector& result, const string& expected) {\n vector expectedVec;\n // Assumes a parsing function from string to vector exists\n parseStringToIntVector(expected, expectedVec);\n \n vector sortedResult = result;\n sort(sortedResult.begin(), sortedResult.end());\n \n sort(expectedVec.begin(), expectedVec.end());\n \n return sortedResult == expectedVec;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=mgQ4O9iUEbg&pp=ygUjTmVldENvZGUgUmVtb3ZlIEludmFsaWQgUGFyZW50aGVzZXM%3D", + "method_name": "removeInvalidParentheses" } -] \ No newline at end of file + ] \ No newline at end of file diff --git a/app/db/init.py b/app/db/init.py index bc47149..30250e3 100644 --- a/app/db/init.py +++ b/app/db/init.py @@ -2,7 +2,7 @@ from core.config import settings from db.base import Base -from db.models.problem import Problem +from db.models.problem import Problem, Boilerplate, CompareFunc from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy_utils import create_database, database_exists @@ -30,15 +30,30 @@ def init_db(test=False): title=problem['title'], source=problem['source'], description=problem['description'], + explanation=problem['explanation'], difficulty=problem['difficulty'], sample_test_cases=problem['sample_test_cases'], sample_test_results=problem['sample_test_results'], hidden_test_cases=problem['hidden_test_cases'], hidden_test_results=problem['hidden_test_results'], - boilerplate=problem['boilerplate'], - compare_func=problem['compare_func'] + method_name=problem['method_name'], ) + new_boilerplate = Boilerplate( + java=problem['boilerplate']['java'], + cpp=problem['boilerplate']['cpp'], + python=problem['boilerplate']['python'], + ) + + new_compare_func = CompareFunc( + java=problem['compare_func']['java'], + cpp=problem['compare_func']['cpp'], + python=problem['compare_func']['python'], + ) + + new_problem.boilerplate = new_boilerplate + new_problem.compare_func = new_compare_func + session.add(new_problem) session.commit() diff --git a/app/db/models/problem.py b/app/db/models/problem.py index 67ce373..8d4d52e 100644 --- a/app/db/models/problem.py +++ b/app/db/models/problem.py @@ -1,7 +1,7 @@ from db.base_class import Base -from sqlalchemy import JSON, Column, Float, Integer, String, Text +from sqlalchemy import JSON, Column, Float, Integer, String, Text, ForeignKey from sqlalchemy.sql import func - +from sqlalchemy.orm import relationship class Problem(Base): """ @@ -15,9 +15,7 @@ class Problem(Base): :param sample_test_results: The sample test results of the problem. :param hidden_test_cases: The hidden test cases of the problem. :param hidden_test_results: The hidden test results of the problem. - :param boilerplate: The boilerplate code of the problem. - :param compare_func: The function used to compare the results of the hidden test cases. - :param created_at: Epoch time when the problem was created. + :param created_at: Epoch time when the problem was created. """ __tablename__ = "problems" @@ -25,11 +23,50 @@ class Problem(Base): title = Column(String, nullable=False) source = Column(String, nullable=False) description = Column(Text, nullable=False) + explanation = Column(String, nullable=True) difficulty = Column(String, nullable=False, index=True) sample_test_cases = Column(JSON, nullable=False) sample_test_results = Column(JSON, nullable=False) hidden_test_cases = Column(JSON, nullable=False) hidden_test_results = Column(JSON, nullable=False) - boilerplate = Column(Text, nullable=False) - compare_func = Column(Text, nullable=False) + method_name = Column(String, nullable=False) created_at = Column(Float, server_default=func.extract('epoch', func.now())) + + boilerplate = relationship("Boilerplate", back_populates="problem", uselist=False, lazy="joined") + compare_func = relationship("CompareFunc", back_populates="problem", uselist=False, lazy="joined") + +class Boilerplate(Base): + """ + Database model representing the boilerplate code for a problem. + + :param pid: The problem ID. + :param java: The boilerplate code in Java. + :param cpp: The boilerplate code in C++. + :param python: The boilerplate code in Python. + """ + __tablename__ = "boilerplates" + + pid = Column(Integer, ForeignKey("problems.id"), primary_key=True) + java = Column(Text) + cpp = Column(Text) + python = Column(Text) + + problem = relationship("Problem", back_populates="boilerplate") + +class CompareFunc(Base): + """ + Database model representing the comparison function for a problem. + + :param pid: The problem ID. + :param java: The comparison function in Java. + :param cpp: The comparison function in C++. + :param python: The comparison function in Python. + """ + __tablename__ = "compare_funcs" + + pid = Column(Integer, ForeignKey("problems.id"), primary_key=True) + java = Column(Text) + cpp = Column(Text) + python = Column(Text) + + problem = relationship("Problem", back_populates="compare_func") \ No newline at end of file diff --git a/app/services/execution/service.py b/app/services/execution/service.py index 3b21e1a..172b282 100644 --- a/app/services/execution/service.py +++ b/app/services/execution/service.py @@ -6,11 +6,10 @@ import docker from core.config import settings from services.execution.docker import DockerRunner -from services.execution.test_generator import TestGenerator +from services.execution.test_generator import PythonTestGenerator, JavaTestGenerator, CppTestGenerator from services.execution.types import ExecutionResult from services.execution.runtime_analysis import runtime_analysis_service - class CodeExecutionService: """ A service class in charge of executing code. @@ -18,7 +17,12 @@ class CodeExecutionService: def __init__(self): self.docker = DockerRunner(docker.from_env()) - self.test_generator = TestGenerator() + self.test_generators = { + "python": PythonTestGenerator(), + "java": JavaTestGenerator(), + "cpp": CppTestGenerator(), + + } easy, medium, hard = [ int(x) for x in settings.MAX_CONCURRENT.split(",") ] @@ -31,12 +35,14 @@ def __init__(self): async def execute_code( self, code: str, + method_name: str, test_cases: List[str], expected_results: List[str], sample_test_cases: List[str], sample_expected_results: List[str], difficulty: str, compare_func: str, + lang: str = 'python' ) -> ExecutionResult: """ Execute the code with the given test cases and expected results. @@ -46,14 +52,16 @@ async def execute_code( :param expected_results: A list of expected results. :param difficulty: The difficulty of the problem. :param compare_func: The name of the comparison function. + :param lang: The programming language of the code. """ # Limit the number of concurrent executions based on the difficulty level. sem = self._execution_semaphores[difficulty.lower()] + gen = self.test_generators[lang] async with sem: # blocks until a semaphore is available # Create a temporary file to store the test runner file. - with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f: + with tempfile.NamedTemporaryFile(mode='w', suffix=gen.get_file_extension(), delete=False) as f: # Test data are pairs of test cases and its expected results. test_data = [ {"input": tc, "expected": er} @@ -63,7 +71,7 @@ async def execute_code( {"input": tc, "expected": er} for tc, er in zip(sample_test_cases, sample_expected_results) ] - f.write(self.test_generator.generate_test_runner(code, test_data, sample_data, compare_func)) + f.write(gen.generate_test_file(code, method_name, test_data, sample_data, compare_func)) file_path = f.name try: diff --git a/app/services/execution/templates.py b/app/services/execution/templates.py new file mode 100644 index 0000000..090d5c2 --- /dev/null +++ b/app/services/execution/templates.py @@ -0,0 +1,85 @@ +PYTHON_TEMPLATE = r"""{code} + +import json +import traceback +from typing import * + +def compare_results(result: Any, expected: str) -> bool: + {compare_func} + +class TestResult: + def __init__( + self, + expected: str, + passed: bool, + output: Any = None, + error: str = None, + input_data: str = None, + ): + self.expected = expected + self.output = str(output) if output is not None else None + self.passed = passed + self.error = error + self.input_data = input_data + + def to_dict(self, include_input: bool = True): + result = {{ + "expected": self.expected, + "output": self.output, + "passed": self.passed, + "error": self.error, + }} + if include_input: + result["input_data"] = self.input_data + return result + +def run_tests(solution, test_data, is_sample: bool = False): + results = [] + + for test in test_data: + try: + result = eval(f"solution.{{test['input']}}") + passed = compare_results(result, test['expected']) + results.append(TestResult( + expected=test['expected'], + output=result, + passed=passed, + input_data=test['input'], + ).to_dict(include_input=is_sample)) + except Exception as e: + results.append(TestResult( + expected=test['expected'], + passed=False, + error=traceback.format_exc(), + input_data=test['input'], + ).to_dict(include_input=is_sample)) + + return {{ + "test_results": results, + "summary": {{ + "total_tests": len(results), + "passed_tests": len([r for r in results if r["passed"]]), + }} + }} + +if __name__ == "__main__": + test_data = {test_data} + sample_data = {sample_data} + try: + solution = Solution() + hidden_results = run_tests(solution, test_data, is_sample=False) + sample_results = run_tests(solution, sample_data, is_sample=True) + results = {{ + "hidden_results": hidden_results, + "sample_results": sample_results + }} + print("EXECUTION_RESULTS:", json.dumps(results)) + except Exception as e: + print("GLOBAL_ERROR:\\n" + traceback.format_exc()) +""" + +JAVA_TEMPLATE = r""" +""" + +CPP_TEMPLATE = r""" +""" \ No newline at end of file diff --git a/app/services/execution/test_generator.py b/app/services/execution/test_generator.py index 071bb19..1989ca2 100644 --- a/app/services/execution/test_generator.py +++ b/app/services/execution/test_generator.py @@ -1,99 +1,118 @@ import json from typing import Dict, List +from abc import ABC, abstractmethod +from services.execution.templates import PYTHON_TEMPLATE, JAVA_TEMPLATE, CPP_TEMPLATE - -class TestGenerator: +class TestGenerator(ABC): """ A class to generate test runner code for a given solution code, test data and compare function. """ - def generate_test_runner(self, code: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + @abstractmethod + def generate_test_file(self, code: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: """ Generate test runner code for a given solution code, test data and compare function. :param code: The solution code. + :param method_name: The solution's main function name. :param test_data: The test data. :param compare_func: The compare function. """ - compare_func = "\n ".join(compare_func.splitlines()) - return f""" -import json -import traceback -from typing import * - -{code} + + @abstractmethod + def get_file_extension(self, lang: str) -> str: + """ + Get the file extension for the given language. + """ -def compare_results(result: Any, expected: str) -> bool: - {compare_func} +class PythonTestGenerator(TestGenerator): + def generate_test_file(self, code: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + test_data = self.format_test_data(method_name, test_data) + sample_data = self.format_test_data(method_name, sample_data) + return PYTHON_TEMPLATE.format( + code=code, + compare_func=compare_func, + test_data=json.dumps(test_data), + sample_data=json.dumps(sample_data), + ) -class TestResult: - def __init__( - self, - expected: str, - passed: bool, - output: Any = None, - error: str = None, - input_data: str = None, - ): - self.expected = expected - self.output = str(output) if output is not None else None - self.passed = passed - self.error = error - self.input_data = input_data - - def to_dict(self, include_input: bool = True): - result = {{ - "expected": self.expected, - "output": self.output, - "passed": self.passed, - "error": self.error, - }} - if include_input: - result["input_data"] = self.input_data - return result - - -def run_tests(solution, test_data, is_sample: bool = False): - results = [] + def format_test_data(self, method_name: str, test_data: List[Dict]): + formatted = [] + for test in test_data: + segments = test["input"].split("--arg") + segments = [s.strip() for s in segments if s.strip()] + params = [] + for s in segments: + if "=" in s: + _, val = s.split("=", 1) + params.append(val.strip()) + formatted.append({ + "input": f"{method_name}({', '.join(params)})", + "expected": test["expected"] + }) + return formatted + + def get_file_extension(self, lang: str) -> str: + return ".py" + +class JavaTestGenerator(TestGenerator): + def generate_test_file(self, code: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + test_data = self.format_test_data(method_name, test_data) + sample_data = self.format_test_data(method_name, sample_data) + return JAVA_TEMPLATE.format( + code=code, + compare_func=compare_func, + test_data=json.dumps(test_data), + sample_data=json.dumps(sample_data), + ) - for test in test_data: - try: - result = eval(f"solution.{{test['input']}}") - passed = compare_results(result, test['expected']) - results.append(TestResult( - expected=test['expected'], - output=result, - passed=passed, - input_data=test['input'], - ).to_dict(include_input=is_sample)) - except Exception as e: - results.append(TestResult( - expected=test['expected'], - passed=False, - error=traceback.format_exc(), - input_data=test['input'], - ).to_dict(include_input=is_sample)) - - return {{ - "test_results": results, - "summary": {{ - "total_tests": len(results), - "passed_tests": len([r for r in results if r["passed"]]), - }} - }} + def format_test_data(self, method_name: str, test_data: List[Dict]): + #TODO: Format array and objects + formatted = [] + for test in test_data: + segments = test["input"].split("--arg") + segments = [s.strip() for s in segments if s.strip()] + params = [] + for s in segments: + if "=" in s: + _, val = s.split("=", 1) + params.append(val.strip()) + formatted.append({ + "input": f"{method_name}({', '.join(params)})", + "expected": test["expected"] + }) + return formatted + + def get_file_extension(self, lang: str) -> str: + return ".java" + +class CppTestGenerator(TestGenerator): + def generate_test_file(self, code: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + test_data = self.format_test_data(method_name, test_data) + sample_data = self.format_test_data(method_name, sample_data) + return CPP_TEMPLATE.format( + code=code, + compare_func=compare_func, + test_data=json.dumps(test_data), + sample_data=json.dumps(sample_data), + ) -if __name__ == "__main__": - test_data = {json.dumps(test_data)} - sample_data = {json.dumps(sample_data)} - try: - solution = Solution() - hidden_results = run_tests(solution, test_data, is_sample=False) - sample_results = run_tests(solution, sample_data, is_sample=True) - results = {{ - "hidden_results": hidden_results, - "sample_results": sample_results - }} - print("EXECUTION_RESULTS:", json.dumps(results)) - except Exception as e: - print("GLOBAL_ERROR:\\n" + traceback.format_exc()) -""" + def format_test_data(self, method_name: str, test_data: List[Dict]): + #TODO: Format arrays and objects + formatted = [] + for test in test_data: + segments = test["input"].split("--arg") + segments = [s.strip() for s in segments if s.strip()] + params = [] + for s in segments: + if "=" in s: + _, val = s.split("=", 1) + params.append(val.strip()) + formatted.append({ + "input": f"{method_name}({', '.join(params)})", + "expected": test["expected"] + }) + return formatted + + def get_file_extension(self, lang: str) -> str: + return ".cpp" diff --git a/app/services/problem/service.py b/app/services/problem/service.py index 1e9f05a..ec0019e 100644 --- a/app/services/problem/service.py +++ b/app/services/problem/service.py @@ -1,10 +1,9 @@ import random from typing import Dict, List, Optional - from core.config import settings from db.models.problem import Problem from sqlalchemy import func -from sqlalchemy.orm import Session +from sqlalchemy.orm import Session, joinedload class ProblemManager: @@ -47,9 +46,11 @@ async def get_problem_by_id( :return: The problem with the specified ID, if it exists. """ - return db.query(Problem).filter( - Problem.id == problem_id - ).first() + return ( + db.query(Problem) + .filter(Problem.id == problem_id) + .first() + ) @staticmethod async def get_problems_by_distribution( @@ -91,7 +92,11 @@ def prepare_problem_for_client(problem: Problem) -> Dict: "difficulty": problem.difficulty, "sample_test_cases": problem.sample_test_cases, "sample_test_results": problem.sample_test_results, - "boilerplate": problem.boilerplate, + "boilerplate": { + "java": problem.boilerplate.java, + "cpp": problem.boilerplate.cpp, + "python": problem.boilerplate.python, + } } @staticmethod @@ -102,37 +107,37 @@ def get_problem_for_validation(problem: Problem) -> Dict: if settings.TESTING: return { "hidden_test_cases": [ - "test(True)", - "test(True)", - "test(True)", - "test(True)", - "test(True)", - "test(True)", - "test(True)", - "test(False)", - "test(False)", - "test(False)", + "--arg1=true", + "--arg1=true", + "--arg1=true", + "--arg1=true", + "--arg1=true", + "--arg1=true", + "--arg1=true", + "--arg1=false", + "--arg1=false", + "--arg1=false", ], "hidden_test_results": [ - "False", - "False", - "False", - "False", - "False", - "False", - "False", - "True", - "True", - "True", + "false", + "false", + "false", + "false", + "false", + "false", + "false", + "true", + "true", + "true", ], - "compare_func": "return str(result) == expected", + # "compare_func": "return str(result) == expected", "sample_test_cases": [ - "test(True)", - "test(False)", + "--arg1=true", + "--arg2=false", ], "sample_test_results": [ - "False", - "True", + "false", + "true", ] } @@ -141,5 +146,5 @@ def get_problem_for_validation(problem: Problem) -> Dict: "hidden_test_results": problem.hidden_test_results, "sample_test_cases": problem.sample_test_cases, "sample_test_results": problem.sample_test_results, - "compare_func": problem.compare_func, + # "compare_func": problem.compare_func, } From 2c494f2f5a05c7c0816305486b09aefed8a78572 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Sat, 8 Feb 2025 03:50:25 -0500 Subject: [PATCH 03/24] Add java image and compiler --- Dockerfile | 14 +++ app/api/endpoints/game.py | 2 +- app/core/config.py | 6 +- app/services/execution/docker.py | 51 ++++++-- app/services/execution/service.py | 11 +- app/services/execution/templates.py | 152 ++++++++++++++++++++++- app/services/execution/test_generator.py | 79 ++++-------- app/services/problem/service.py | 3 +- docker/cpp/Dockerfile | 16 +++ docker/java/Dockerfile | 19 +++ docker/python/Dockerfile | 10 ++ 11 files changed, 292 insertions(+), 71 deletions(-) create mode 100644 docker/cpp/Dockerfile create mode 100644 docker/java/Dockerfile create mode 100644 docker/python/Dockerfile diff --git a/Dockerfile b/Dockerfile index 2efaad4..6f5ce0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,20 @@ FROM python:3.11-alpine WORKDIR /app +# Install Docker client +RUN apk add --no-cache docker-cli + +# Copy Docker environment files +COPY docker/python/Dockerfile docker/python/ +COPY docker/java/Dockerfile docker/java/ +COPY docker/cpp/Dockerfile docker/cpp/ + +# Build execution environment images +RUN docker build -t beatcode-python:latest docker/python/ && \ + docker build -t beatcode-java:latest docker/java/ && \ + docker build -t beatcode-cpp:latest docker/cpp/ + +# Continue with app setup COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt diff --git a/app/api/endpoints/game.py b/app/api/endpoints/game.py index bd23156..6d76252 100644 --- a/app/api/endpoints/game.py +++ b/app/api/endpoints/game.py @@ -346,7 +346,7 @@ async def game_websocket( validation_data["sample_test_cases"], validation_data["sample_test_results"], problem.difficulty, - validation_data["compare_func"], + getattr(validation_data["compare_func"], lang), lang, ) result = result.to_dict() diff --git a/app/core/config.py b/app/core/config.py index df0c1ae..97a6b68 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -48,11 +48,15 @@ class Settings(BaseSettings): REFRESH_TOKEN_EXPIRE_DAYS: int # Time in days for the refresh token to expire # Code Execution + JAVA_PACKAGES: str # Packages to install for running Java codes + CPP_PACKAGES: str # Packages to install for running C++ codes MAX_CONCURRENT: str # Maximum number of problems that can be executed concurrently for each difficulty OPENAI_API_KEY: str # API key for OpenAI (Used for Runtime Analysis) # Docker Settings - DOCKER_IMAGE: str # Docker image to use for code execution + DOCKER_IMAGE_PYTHON: str # Docker image for running Python code + DOCKER_IMAGE_JAVA: str # Docker image for running Java code + DOCKER_IMAGE_CPP: str # Docker image for running C++ code DOCKER_MEMORY_LIMIT: str # Memory limit (mb) for problems DOCKER_TIME_LIMIT: str # Time limit (ms) for problems DOCKER_CPU_LIMIT: float # CPU limit (0-1.0) for each container diff --git a/app/services/execution/docker.py b/app/services/execution/docker.py index 4ec7e48..365f63d 100644 --- a/app/services/execution/docker.py +++ b/app/services/execution/docker.py @@ -14,7 +14,11 @@ class DockerRunner: def __init__(self, client: docker.DockerClient): self.client = client - self.docker_image = settings.DOCKER_IMAGE + self.docker_image_map = { + "python": settings.DOCKER_IMAGE_PYTHON, + "java": settings.DOCKER_IMAGE_JAVA, + "cpp": settings.DOCKER_IMAGE_CPP, + } self.docker_cpu_limit = settings.DOCKER_CPU_LIMIT easy_mem, medium_mem, hard_mem = [ int(x) for x in settings.DOCKER_MEMORY_LIMIT.split(",") @@ -27,8 +31,37 @@ def __init__(self, client: docker.DockerClient): "medium": [medium_mem, medium_time], "hard": [hard_mem, hard_time], } + + def get_run_commands(self, lang: str, file_path: str) -> list: + """ + Get the command to run the code in a Docker container. + + :param lang: The language of the code. + :param file_path: The path to the file to run. + :return: The command to run the code in a Docker container. + """ + file_name = os.path.basename(file_path) + base_name = file_name.split('.')[0] + + if lang == "python": + return ["python", file_name] + + # Needs to compile first before running unlike Python + elif lang == "java": + return [ + "sh", "-c", + f"javac -cp /lib/*:/code {file_name} && java -cp /lib/*:/code {base_name}" + ] + + elif lang == "cpp": + return [ + "sh", "-c", + f"g++ -std=c++17 -o {base_name} {file_name} && ./{base_name}" + ] + + raise ValueError(f"Unsupported language: {lang}") - def run_container(self, file_path: str, difficulty: str) -> ExecutionResult: + def run_container(self, lang: str, file_path: str, difficulty: str) -> ExecutionResult: """ Run the code in a Docker container. @@ -38,23 +71,27 @@ def run_container(self, file_path: str, difficulty: str) -> ExecutionResult: """ # Get the memory and time limits for the difficulty level. memory_limit, time_limit = self._docker_settings[difficulty.lower()] + dir_path = os.path.dirname(file_path) + if not dir_path: + dir_path = "." try: # Run the container with the specified constraints container = self.client.containers.run( - self.docker_image, - ["python3", os.path.basename(file_path)], + self.docker_image_map[lang], + self.get_run_commands(lang, file_path), volumes={ - os.path.dirname(file_path): { + dir_path: { "bind": "/code", # bind the directory to /code in the container - "mode": "ro", # read only + "mode": "rw", # read write } }, working_dir="/code", mem_limit=f"{memory_limit}m", nano_cpus=int(self.docker_cpu_limit * 1e9), network_disabled=True, - read_only=True, + privileged=False, + # read_only=True, detach=True, # run the container in the background ) diff --git a/app/services/execution/service.py b/app/services/execution/service.py index 172b282..8e9acf0 100644 --- a/app/services/execution/service.py +++ b/app/services/execution/service.py @@ -21,7 +21,6 @@ def __init__(self): "python": PythonTestGenerator(), "java": JavaTestGenerator(), "cpp": CppTestGenerator(), - } easy, medium, hard = [ int(x) for x in settings.MAX_CONCURRENT.split(",") @@ -61,7 +60,7 @@ async def execute_code( async with sem: # blocks until a semaphore is available # Create a temporary file to store the test runner file. - with tempfile.NamedTemporaryFile(mode='w', suffix=gen.get_file_extension(), delete=False) as f: + with tempfile.NamedTemporaryFile(mode='w', suffix=gen.get_file_extension(lang), delete=False) as f: # Test data are pairs of test cases and its expected results. test_data = [ {"input": tc, "expected": er} @@ -71,11 +70,13 @@ async def execute_code( {"input": tc, "expected": er} for tc, er in zip(sample_test_cases, sample_expected_results) ] - f.write(gen.generate_test_file(code, method_name, test_data, sample_data, compare_func)) + import pdb; pdb.set_trace() + base_name = os.path.basename(f.name).split('.')[0] + file_content = gen.generate_test_file(code, base_name, method_name, test_data, sample_data, compare_func) + f.write(file_content) file_path = f.name - try: - result = self.docker.run_container(file_path, difficulty) + result = self.docker.run_container(lang, file_path, difficulty) # If all tests passed, get runtime analysis if result.all_cleared() and not settings.TESTING: diff --git a/app/services/execution/templates.py b/app/services/execution/templates.py index 090d5c2..acf9954 100644 --- a/app/services/execution/templates.py +++ b/app/services/execution/templates.py @@ -58,7 +58,7 @@ def run_tests(solution, test_data, is_sample: bool = False): "test_results": results, "summary": {{ "total_tests": len(results), - "passed_tests": len([r for r in results if r["passed"]]), + "passed_tests": len([r for r in results if r["passed"]), }} }} @@ -78,8 +78,152 @@ def run_tests(solution, test_data, is_sample: bool = False): print("GLOBAL_ERROR:\\n" + traceback.format_exc()) """ -JAVA_TEMPLATE = r""" +JAVA_TEMPLATE = r"""import org.junit.*; +import org.junit.runner.JUnitCore; +import com.google.gson.*; +import java.lang.reflect.*; + +{code} + +public class {file_name} {{ + private static JsonObject compareResults(Object result, String expected) {{ + JsonObject comparison = new JsonObject(); + comparison.addProperty("passed", result.toString().equals(expected)); + return comparison; + }} + + public static JsonArray runTests(Solution solution, JsonArray testData) {{ + JsonArray results = new JsonArray(); + Gson gson = new Gson(); + + for (JsonElement testElement : testData) {{ + JsonObject test = testElement.getAsJsonObject(); + JsonObject result = new JsonObject(); + + try {{ + String inputStr = test.get("input").getAsString(); + Class[] paramTypes = getParameterTypes(inputStr); + Object[] args = parseArguments(inputStr); + + // Replace "maxProfit" with the method you want to test if needed. + Method method = Solution.class.getMethod("maxProfit", paramTypes); + Object output = method.invoke(solution, args); + JsonObject comparison = compareResults(output, test.get("expected").getAsString()); + result.addProperty("passed", comparison.get("passed").getAsBoolean()); + result.addProperty("output", gson.toJson(output)); + }} catch (Exception e) {{ + result.addProperty("error", e.toString()); + result.addProperty("passed", false); + }} + results.add(result); + }} + return results; + }} + + private static Class[] getParameterTypes(String input) {{ + return new Class[] {{ int[].class }}; + }} + + private static Object[] parseArguments(String input) {{ + int startBracket = input.indexOf('['); + int endBracket = input.lastIndexOf(']'); + if (startBracket != -1 && endBracket != -1) {{ + String[] numStrs = input.substring(startBracket + 1, endBracket).split(","); + int[] nums = new int[numStrs.length]; + for (int i = 0; i < numStrs.length; i++) {{ + nums[i] = Integer.parseInt(numStrs[i].trim()); + }} + return new Object[] {{ nums }}; + }} + return new Object[0]; + }} + + // This method now wraps the results in a "test_results" field and adds a "summary" field. + private static JsonObject createResultObject(JsonArray results) {{ + JsonObject summary = new JsonObject(); + int totalTests = results.size(); + int passedTests = 0; + for (JsonElement element : results) {{ + JsonObject res = element.getAsJsonObject(); + if (res.has("passed") && res.get("passed").getAsBoolean()) {{ + passedTests++; + }} + }} + summary.addProperty("total_tests", totalTests); + summary.addProperty("passed_tests", passedTests); + + JsonObject obj = new JsonObject(); + obj.add("test_results", results); + obj.add("summary", summary); + return obj; + }} + + public static void main(String[] args) {{ + try {{ + Gson gson = new Gson(); + Solution solution = new Solution(); + + JsonArray testData = gson.fromJson("{test_data}", JsonArray.class); + JsonArray sampleData = gson.fromJson("{sample_data}", JsonArray.class); + + JsonObject results = new JsonObject(); + results.add("hidden_results", createResultObject(runTests(solution, testData))); + results.add("sample_results", createResultObject(runTests(solution, sampleData))); + + System.out.println("EXECUTION_RESULTS:" + results); + }} catch (Exception e) {{ + System.out.println("GLOBAL_ERROR:\n" + e); + }} + }} +}} + """ -CPP_TEMPLATE = r""" -""" \ No newline at end of file +CPP_TEMPLATE = r"""{code} + +\#include +\#include +\#include +\#include + +Json::Value compareResults(auto result, const std::string& expected) {{ + {compare_func} +}} + +Json::Value runTests(Solution& solution, const Json::Value& testData) {{ + Json::Value results(Json::arrayValue); + + for (const auto& test : testData) {{ + Json::Value result; + try {{ + std::istringstream iss(test["input"].asString()); + // Parameter parsing logic + auto output = solution.{method_name}(/* parsed args */); + Json::Value comparison = compareResults(output, test["expected"].asString()); + result["passed"] = comparison["passed"]; + result["output"] = Json::Value(output); + }} catch (const std::exception& e) {{ + result["error"] = e.what(); + result["passed"] = false; + }} + results.append(result); + }} + return results; +}} + +int main() {{ + Solution solution; + Json::Reader reader; + Json::Value testData, sampleData; + + reader.parse("{test_data}", testData); + reader.parse("{sample_data}", sampleData); + + Json::Value results; + results["hidden_results"] = runTests(solution, testData); + results["sample_results"] = runTests(solution, sampleData); + + std::cout << "EXECUTION_RESULTS:" << results.toStyledString(); + return 0; +}} +""" diff --git a/app/services/execution/test_generator.py b/app/services/execution/test_generator.py index 1989ca2..7af3090 100644 --- a/app/services/execution/test_generator.py +++ b/app/services/execution/test_generator.py @@ -9,7 +9,7 @@ class TestGenerator(ABC): """ @abstractmethod - def generate_test_file(self, code: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + def generate_test_file(self, code: str, file_name: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: """ Generate test runner code for a given solution code, test data and compare function. @@ -23,20 +23,12 @@ def generate_test_file(self, code: str, method_name: str, test_data: List[Dict], def get_file_extension(self, lang: str) -> str: """ Get the file extension for the given language. - """ + """ -class PythonTestGenerator(TestGenerator): - def generate_test_file(self, code: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: - test_data = self.format_test_data(method_name, test_data) - sample_data = self.format_test_data(method_name, sample_data) - return PYTHON_TEMPLATE.format( - code=code, - compare_func=compare_func, - test_data=json.dumps(test_data), - sample_data=json.dumps(sample_data), - ) - - def format_test_data(self, method_name: str, test_data: List[Dict]): + def format_test_data(self, method_name: str, test_data: List[Dict]) -> List[Dict]: + """ + Format the test data to be used in the test runner code. + """ formatted = [] for test in test_data: segments = test["input"].split("--arg") @@ -50,41 +42,40 @@ def format_test_data(self, method_name: str, test_data: List[Dict]): "input": f"{method_name}({', '.join(params)})", "expected": test["expected"] }) - return formatted + return formatted + +class PythonTestGenerator(TestGenerator): + def generate_test_file(self, code: str, file_name: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + test_data = self.format_test_data(method_name, test_data) + sample_data = self.format_test_data(method_name, sample_data) + return PYTHON_TEMPLATE.format( + code=code, + compare_func=compare_func, + test_data=json.dumps(test_data), + sample_data=json.dumps(sample_data), + ) def get_file_extension(self, lang: str) -> str: return ".py" class JavaTestGenerator(TestGenerator): - def generate_test_file(self, code: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + def generate_test_file(self, code: str, file_name: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: test_data = self.format_test_data(method_name, test_data) sample_data = self.format_test_data(method_name, sample_data) return JAVA_TEMPLATE.format( code=code, + file_name=file_name, + method_name=method_name, compare_func=compare_func, - test_data=json.dumps(test_data), - sample_data=json.dumps(sample_data), + test_data=self.process_quotes(json.dumps(test_data)), + sample_data=self.process_quotes(json.dumps(sample_data)), ) - - def format_test_data(self, method_name: str, test_data: List[Dict]): - #TODO: Format array and objects - formatted = [] - for test in test_data: - segments = test["input"].split("--arg") - segments = [s.strip() for s in segments if s.strip()] - params = [] - for s in segments: - if "=" in s: - _, val = s.split("=", 1) - params.append(val.strip()) - formatted.append({ - "input": f"{method_name}({', '.join(params)})", - "expected": test["expected"] - }) - return formatted def get_file_extension(self, lang: str) -> str: return ".java" + + def process_quotes(self, json_str: str) -> str: + return json_str.replace('"', '\\"').replace('\\\\"', '\\\\\\"') # cursed code alert class CppTestGenerator(TestGenerator): def generate_test_file(self, code: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: @@ -92,27 +83,11 @@ def generate_test_file(self, code: str, method_name: str, test_data: List[Dict], sample_data = self.format_test_data(method_name, sample_data) return CPP_TEMPLATE.format( code=code, + method_name=method_name, compare_func=compare_func, test_data=json.dumps(test_data), sample_data=json.dumps(sample_data), ) - - def format_test_data(self, method_name: str, test_data: List[Dict]): - #TODO: Format arrays and objects - formatted = [] - for test in test_data: - segments = test["input"].split("--arg") - segments = [s.strip() for s in segments if s.strip()] - params = [] - for s in segments: - if "=" in s: - _, val = s.split("=", 1) - params.append(val.strip()) - formatted.append({ - "input": f"{method_name}({', '.join(params)})", - "expected": test["expected"] - }) - return formatted def get_file_extension(self, lang: str) -> str: return ".cpp" diff --git a/app/services/problem/service.py b/app/services/problem/service.py index ec0019e..b1f4fd4 100644 --- a/app/services/problem/service.py +++ b/app/services/problem/service.py @@ -146,5 +146,6 @@ def get_problem_for_validation(problem: Problem) -> Dict: "hidden_test_results": problem.hidden_test_results, "sample_test_cases": problem.sample_test_cases, "sample_test_results": problem.sample_test_results, - # "compare_func": problem.compare_func, + "method_name": problem.method_name, + "compare_func": problem.compare_func, } diff --git a/docker/cpp/Dockerfile b/docker/cpp/Dockerfile new file mode 100644 index 0000000..8064c23 --- /dev/null +++ b/docker/cpp/Dockerfile @@ -0,0 +1,16 @@ +FROM gcc:11.2.0 + +WORKDIR /code + +# Install Google Test +RUN apt-get update && apt-get install -y \ + cmake \ + libgtest-dev \ + && cd /usr/src/gtest \ + && cmake CMakeLists.txt \ + && make \ + && cp lib/*.a /usr/lib + +# Set security limits +RUN mkdir /sandbox && chmod 777 /sandbox +USER nobody diff --git a/docker/java/Dockerfile b/docker/java/Dockerfile new file mode 100644 index 0000000..65c6a7f --- /dev/null +++ b/docker/java/Dockerfile @@ -0,0 +1,19 @@ +FROM openjdk:11-jdk-slim + +WORKDIR /code + +# Install wget to download dependencies +RUN apt-get update && apt-get install -y wget + +# Download JUnit and dependencies to a shorter path +RUN wget https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar -P /lib/ +RUN wget https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar -P /lib/ +RUN wget https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar -P /lib/ + +# Set CLASSPATH environment variable with shorter path +ENV CLASSPATH=/lib/*:/code + +# Set up security +RUN useradd -m codeuser +RUN chown -R codeuser:codeuser /code +USER codeuser diff --git a/docker/python/Dockerfile b/docker/python/Dockerfile new file mode 100644 index 0000000..dfbaa94 --- /dev/null +++ b/docker/python/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.9-slim + +WORKDIR /code + +# Install any needed packages +RUN pip install typing-extensions + +# Set security limits +RUN mkdir /sandbox && chmod 777 /sandbox +USER nobody From 93a7f3b39f3d175f9549d07ba8d3ae9332dee13f Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Sat, 8 Feb 2025 20:48:17 -0500 Subject: [PATCH 04/24] Fixed java compiler bug --- .github/workflows/tests.yml | 74 + app/db/combined.json | 9274 +++++++++++----------- app/services/execution/service.py | 2 +- app/services/execution/templates.py | 202 +- app/services/execution/test_generator.py | 7 +- app/tests/conftest.py | 11 + requirements.txt | 3 +- 7 files changed, 4915 insertions(+), 4658 deletions(-) create mode 100644 .github/workflows/tests.yml create mode 100644 app/tests/conftest.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..eedb1b1 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,74 @@ +name: BeatCode Server Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:latest + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: beatcode_test + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: '3.11' + + - name: Set up Docker + uses: docker/setup-buildx-action@v2 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Copy environment file + run: | + cp .env.example .env + # Set test database configurations + echo "TEST_DB_USER=postgres" >> .env + echo "TEST_DB_PASSWORD=postgres" >> .env + echo "TEST_DB_HOST=localhost" >> .env + echo "TESTING=True" >> .env + + - name: Initialize database + run: | + cd app + python -m db.init --drop --droptest + + - name: Run unit tests + run: | + cd app + pytest tests/unit -v + + - name: Start server for integration tests + run: | + cd app + nohup uvicorn main:app --host 0.0.0.0 --port 8000 & + sleep 5 # Wait for server to start + + - name: Run integration tests + run: | + cd app + python tests/integration/auth_test.py + python tests/integration/game_test.py + python tests/integration/room_test.py \ No newline at end of file diff --git a/app/db/combined.json b/app/db/combined.json index f2f5918..c445b21 100644 --- a/app/db/combined.json +++ b/app/db/combined.json @@ -1,4638 +1,4638 @@ [ - { - "title": "Two Sum", - "source": "https://leetcode.com/problems/two-sum/", - "description": "

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

\n\n

You may assume that each input would have exactly one solution, and you may not use the same element twice.

\n\n

You can return the answer in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [2,7,11,15], target = 9\nOutput: [0,1]\nExplanation: Because nums[0] + nums[1] == 9, we return [0, 1].\n
\n\n

Example 2:

\n\n
\nInput: nums = [3,2,4], target = 6\nOutput: [1,2]\n
\n\n

Example 3:

\n\n
\nInput: nums = [3,3], target = 6\nOutput: [0,1]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 2 <= nums.length <= 104
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • -109 <= target <= 109
  • \n\t
  • Only one valid answer exists.
  • \n
\n\n

 

\nFollow-up: Can you come up with an algorithm that is less than O(n2) time complexity?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=[2,7,11,15] --arg2=9", - "--arg1=[3,2,4] --arg2=6", - "--arg1=[3,3] --arg2=6" - ], - "sample_test_results": [ - "[0,1]", - "[1,2]", - "[0,1]" - ], - "hidden_test_cases": [ - "--arg1=[49,61,74,96,29,88,53,-34,-48] --arg2=184", - "--arg1=[62,15,-95,26,-65,12,-86,-5,-40,-64,-91,-14,20,-36,83] --arg2=-60", - "--arg1=[-12,-75,90,56,-15,-55,-51,-27,61,24,-9,-58] --arg2=-85", - "--arg1=[-87,21,-26,13,-29,-53,-87,11] --arg2=-140", - "--arg1=[-65,6,58,-29] --arg2=-7", - "--arg1=[-87,54] --arg2=-33", - "--arg1=[-97,-10,89] --arg2=-8", - "--arg1=[30,57,-82,-8,92,99,82,-76] --arg2=74", - "--arg1=[75,-74,40] --arg2=1", - "--arg1=[-67,-35,76,71,-85,91,-55,-42,66,-28,1,89] --arg2=56" - ], - "hidden_test_results": [ - "[3,5]", - "[3,6]", - "[7,11]", - "[0,5]", - "[0,2]", - "[0,1]", - "[0,2]", - "[3,6]", - "[0,1]", - "[1,5]" - ], - "boilerplate": { - "python": "class Solution:\n def twoSum(self, nums: List[int], target: int) -> List[int]:\n ", - "java": "class Solution {\n public int[] twoSum(int[] nums, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::vector twoSum(std::vector& nums, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "return Arrays.equals(Arrays.sort(result), Arrays.sort(eval(expected)));", - "cpp": "vector sortedResult(result.begin(), result.end());\nsort(sortedResult.begin(), sortedResult.end());\nvector sortedExpected(eval(expected).begin(), eval(expected).end());\nsort(sortedExpected.begin(), sortedExpected.end());\nreturn sortedResult == sortedExpected;" - }, - "explanation": "https://www.youtube.com/watch?v=KLlXCFG5TnA&pp=ygUQTmVldENvZGUgVHdvIFN1bQ%3D%3D", - "method_name": "twoSum" - }, - { - "title": "Palindrome Number", - "source": "https://leetcode.com/problems/palindrome-number/", - "description": "

Given an integer x, return true if x is a palindrome, and false otherwise.

\n\n

 

\n

Example 1:

\n\n
\nInput: x = 121\nOutput: true\nExplanation: 121 reads as 121 from left to right and from right to left.\n
\n\n

Example 2:

\n\n
\nInput: x = -121\nOutput: false\nExplanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.\n
\n\n

Example 3:

\n\n
\nInput: x = 10\nOutput: false\nExplanation: Reads 01 from right to left. Therefore it is not a palindrome.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= x <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without converting the integer to a string?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=121", - "--arg1=-121", - "--arg1=10" - ], - "sample_test_results": [ - "true", - "false", - "false" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=1234321", - "--arg1=-1", - "--arg1=1000", - "--arg1=12321", - "--arg1=100001", - "--arg1=2147483647", - "--arg1=-2147483648", - "--arg1=11", - "--arg1=1000021" - ], - "hidden_test_results": [ - "true", - "true", - "false", - "false", - "true", - "true", - "false", - "false", - "true", - "false" - ], - "boilerplate": { - "python": "class Solution:\n def isPalindrome(self, x: int) -> bool:\n ", - "java": "class Solution {\n public boolean isPalindrome(int x) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isPalindrome(int x) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "{\n return result == std::stod(expected);\n}" - }, - "explanation": "https://www.youtube.com/watch?v=yubRKwixN-U&pp=ygUaTmVldENvZGUgUGFsaW5kcm9tZSBOdW1iZXI%3D", - "method_name": "isPalindrome" - }, - { - "title": "Longest Common Prefix", - "source": "https://leetcode.com/problems/longest-common-prefix/", - "description": "

Write a function to find the longest common prefix string amongst an array of strings.

\n\n

If there is no common prefix, return an empty string "".

\n\n

 

\n

Example 1:

\n\n
\nInput: strs = ["flower","flow","flight"]\nOutput: "fl"\n
\n\n

Example 2:

\n\n
\nInput: strs = ["dog","racecar","car"]\nOutput: ""\nExplanation: There is no common prefix among the input strings.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= strs.length <= 200
  • \n\t
  • 0 <= strs[i].length <= 200
  • \n\t
  • strs[i] consists of only lowercase English letters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=['flower','flow','flight']", - "--arg1=['dog','racecar','car']" - ], - "sample_test_results": [ - "'fl'", - "''" - ], - "hidden_test_cases": [ - "--arg1=['interspecies','interstellar','interstate']", - "--arg1=['throne','throne']", - "--arg1=['']", - "--arg1=['a']", - "--arg1=['','b']", - "--arg1=['prefix','prefix','prefix']", - "--arg1=['abc','def','ghi']", - "--arg1=['flower','flower','flower','flower']", - "--arg1=['x','xy','xyz']", - "--arg1=['ab','a']" - ], - "hidden_test_results": [ - "'inters'", - "'throne'", - "''", - "'a'", - "''", - "'prefix'", - "''", - "'flower'", - "'x'", - "'a'" - ], - "boilerplate": { - "python": "class Solution:\n def longestCommonPrefix(self, strs: List[str]) -> str:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public String longestCommonPrefix(List strs) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string longestCommonPrefix(vector& strs) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "try { \n return result == expected;\n} catch (Exception e) {\n return false;\n}", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=0sWShKIJoo4&pp=ygUeTmVldENvZGUgTG9uZ2VzdCBDb21tb24gUHJlZml4", - "method_name": "longestCommonPrefix" - }, - { - "title": "Valid Parentheses", - "source": "https://leetcode.com/problems/valid-parentheses/", - "description": "

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

\n\n

An input string is valid if:

\n\n
    \n\t
  1. Open brackets must be closed by the same type of brackets.
  2. \n\t
  3. Open brackets must be closed in the correct order.
  4. \n\t
  5. Every close bracket has a corresponding open bracket of the same type.
  6. \n
\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "()"

\n\n

Output: true

\n
\n\n

Example 2:

\n\n
\n

Input: s = "()[]{}"

\n\n

Output: true

\n
\n\n

Example 3:

\n\n
\n

Input: s = "(]"

\n\n

Output: false

\n
\n\n

Example 4:

\n\n
\n

Input: s = "([])"

\n\n

Output: true

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of parentheses only '()[]{}'.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='()'", - "--arg1='()[]{}'", - "--arg1='(]'", - "--arg1='([])'" - ], - "sample_test_results": [ - "true", - "true", - "false", - "true" - ], - "hidden_test_cases": [ - "--arg1='{[]}'", - "--arg1='((()))'", - "--arg1='(()[]{})'", - "--arg1='}{}'", - "--arg1=''", - "--arg1='((())'", - "--arg1='())'", - "--arg1='([)]'", - "--arg1='{{{}}}'", - "--arg1='[({})]'" - ], - "hidden_test_results": [ - "true", - "true", - "true", - "false", - "true", - "false", - "false", - "false", - "true", - "true" - ], - "boilerplate": { - "python": "class Solution:\n def isValid(self, s: str) -> bool:\n ", - "java": "class Solution {\n public boolean isValid(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isValid(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(evaluate(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=WTzjTskDFMg&pp=ygUaTmVldENvZGUgVmFsaWQgUGFyZW50aGVzZXM%3D", - "method_name": "isValid" - }, - { - "title": "Find the Index of the First Occurrence in a String", - "source": "https://leetcode.com/problems/implement-strstr/", - "description": "

Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

\n\n

 

\n

Example 1:

\n\n
\nInput: haystack = "sadbutsad", needle = "sad"\nOutput: 0\nExplanation: "sad" occurs at index 0 and 6.\nThe first occurrence is at index 0, so we return 0.\n
\n\n

Example 2:

\n\n
\nInput: haystack = "leetcode", needle = "leeto"\nOutput: -1\nExplanation: "leeto" did not occur in "leetcode", so we return -1.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= haystack.length, needle.length <= 104
  • \n\t
  • haystack and needle consist of only lowercase English characters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='sadbutsad' --arg2='sad'", - "--arg1='leetcode' --arg2='leeto'" - ], - "sample_test_results": [ - "0", - "-1" - ], - "hidden_test_cases": [ - "--arg1='hello' --arg2='ll'", - "--arg1='aaaaa' --arg2='bba'", - "--arg1='' --arg2=''", - "--arg1='a' --arg2='a'", - "--arg1='mississippi' --arg2='issi'", - "--arg1='aaaaaa' --arg2='aa'", - "--arg1='abc' --arg2='c'", - "--arg1='hello world' --arg2='world'", - "--arg1='abcabcd' --arg2='abcd'", - "--arg1='testing' --arg2=''" - ], - "hidden_test_results": [ - "2", - "-1", - "0", - "0", - "1", - "0", - "2", - "6", - "3", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def strStr(self, haystack: str, needle: str) -> int:\n ", - "java": "class Solution {\n public int strStr(String haystack, String needle) {\n // Your logic here\n }\n}", - "cpp": "class Solution {\npublic:\n int strStr(string haystack, string needle) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=Gjkhm1gYIMw&pp=ygU7TmVldENvZGUgRmluZCB0aGUgSW5kZXggb2YgdGhlIEZpcnN0IE9jY3VycmVuY2UgaW4gYSBTdHJpbmc%3D", - "method_name": "strStr" - }, - { - "title": "Search Insert Position", - "source": "https://leetcode.com/problems/search-insert-position/", - "description": "

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.

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,3,5,6], target = 5\nOutput: 2\n
\n\n

Example 2:

\n\n
\nInput: nums = [1,3,5,6], target = 2\nOutput: 1\n
\n\n

Example 3:

\n\n
\nInput: nums = [1,3,5,6], target = 7\nOutput: 4\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 104
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • nums contains distinct values sorted in ascending order.
  • \n\t
  • -104 <= target <= 104
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=[1,3,5,6] --arg2=5", - "--arg1=[1,3,5,6] --arg2=2", - "--arg1=[1,3,5,6] --arg2=7" - ], - "sample_test_results": [ - "2", - "1", - "4" - ], - "hidden_test_cases": [ - "--arg1=[1] --arg2=0", - "--arg1=[1] --arg2=2", - "--arg1=[1,3,5,6,8,10] --arg2=9", - "--arg1=[1,4,6,7,8,9] --arg2=6", - "--arg1=[-5,-3,0,1,3] --arg2=-4", - "--arg1=[-3,-1,0,2] --arg2=1", - "--arg1=[1,2,3,4,5] --arg2=5", - "--arg1=[2,4,6,8] --arg2=1", - "--arg1=[1,3,5,7] --arg2=4", - "--arg1=[1,3,5,7,9] --arg2=8" - ], - "hidden_test_results": [ - "0", - "1", - "5", - "2", - "1", - "3", - "4", - "0", - "2", - "4" - ], - "boilerplate": { - "python": "class Solution:\n def searchInsert(self, nums: List[int], target: int) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int searchInsert(List nums, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int searchInsert(vector& nums, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return Integer.compare(result, Integer.parseInt(expected)) == 0;", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=K-RYzDZkzCI&pp=ygUfTmVldENvZGUgU2VhcmNoIEluc2VydCBQb3NpdGlvbg%3D%3D", - "method_name": "searchInsert" - }, - { - "title": "Length of Last Word", - "source": "https://leetcode.com/problems/length-of-last-word/", - "description": "

Given a string s consisting of words and spaces, return the length of the last word in the string.

\n\n

A word is a maximal substring consisting of non-space characters only.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "Hello World"\nOutput: 5\nExplanation: The last word is "World" with length 5.\n
\n\n

Example 2:

\n\n
\nInput: s = "   fly me   to   the moon  "\nOutput: 4\nExplanation: The last word is "moon" with length 4.\n
\n\n

Example 3:

\n\n
\nInput: s = "luffy is still joyboy"\nOutput: 6\nExplanation: The last word is "joyboy" with length 6.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of only English letters and spaces ' '.
  • \n\t
  • There will be at least one word in s.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=\"Hello World\"", - "--arg1=\" fly me to the moon \"", - "--arg1=\"luffy is still joyboy\"" - ], - "sample_test_results": [ - "5", - "4", - "6" - ], - "hidden_test_cases": [ - "--arg1=\"a\"", - "--arg1=\"hello \"", - "--arg1=\" space\"", - "--arg1=\"multiple words here\"", - "--arg1=\"oneword\"", - "--arg1=\" spaces between words \"", - "--arg1=\"trailing space \"", - "--arg1=\" leading space\"", - "--arg1=\"multiple spaces between\"", - "--arg1=\"z\"" - ], - "hidden_test_results": [ - "1", - "5", - "5", - "4", - "7", - "5", - "5", - "5", - "7", - "1" - ], - "boilerplate": { - "python": "class Solution:\n def lengthOfLastWord(self, s: str) -> int:\n ", - "java": "class Solution {\n public int lengthOfLastWord(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int lengthOfLastWord(const std::string& s) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=KT9rltZTybQ&pp=ygUcTmVldENvZGUgTGVuZ3RoIG9mIExhc3QgV29yZA%3D%3D", - "method_name": "lengthOfLastWord" - }, - { - "title": "Plus One", - "source": "https://leetcode.com/problems/plus-one/", - "description": "

You are given a large integer represented as an integer array digits, where each digits[i] is the ith 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 any leading 0's.

\n\n

Increment the large integer by one and return the resulting array of digits.

\n\n

 

\n

Example 1:

\n\n
\nInput: digits = [1,2,3]\nOutput: [1,2,4]\nExplanation: The array represents the integer 123.\nIncrementing by one gives 123 + 1 = 124.\nThus, the result should be [1,2,4].\n
\n\n

Example 2:

\n\n
\nInput: digits = [4,3,2,1]\nOutput: [4,3,2,2]\nExplanation: The array represents the integer 4321.\nIncrementing by one gives 4321 + 1 = 4322.\nThus, the result should be [4,3,2,2].\n
\n\n

Example 3:

\n\n
\nInput: digits = [9]\nOutput: [1,0]\nExplanation: The array represents the integer 9.\nIncrementing by one gives 9 + 1 = 10.\nThus, the result should be [1,0].\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= digits.length <= 100
  • \n\t
  • 0 <= digits[i] <= 9
  • \n\t
  • digits does not contain any leading 0's.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=[1,2,3]", - "--arg1=[4,3,2,1]", - "--arg1=[9]" - ], - "sample_test_results": [ - "[1,2,4]", - "[4,3,2,2]", - "[1,0]" - ], - "hidden_test_cases": [ - "--arg1=[0]", - "--arg1=[9,9]", - "--arg1=[1,0,0]", - "--arg1=[1,9,9]", - "--arg1=[9,8,9]", - "--arg1=[1,2,3,4]", - "--arg1=[9,9,9,9]", - "--arg1=[5,0,9]", - "--arg1=[1]", - "--arg1=[4,9,9,9]" - ], - "hidden_test_results": [ - "[1]", - "[1,0,0]", - "[1,0,1]", - "[2,0,0]", - "[9,9,0]", - "[1,2,3,5]", - "[1,0,0,0,0]", - "[5,1,0]", - "[2]", - "[5,0,0,0]" - ], - "boilerplate": { - "python": "class Solution:\n def plusOne(self, digits: List[int]) -> List[int]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List plusOne(List digits) {\n // \n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector plusOne(vector& digits) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=jIaA8boiG1s&pp=ygURTmVldENvZGUgUGx1cyBPbmU%3D", - "method_name": "plusOne" - }, - { - "title": "Add Binary", - "source": "https://leetcode.com/problems/add-binary/", - "description": "

Given two binary strings a and b, return their sum as a binary string.

\n\n

 

\n

Example 1:

\n
Input: a = \"11\", b = \"1\"\nOutput: \"100\"\n

Example 2:

\n
Input: a = \"1010\", b = \"1011\"\nOutput: \"10101\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= a.length, b.length <= 104
  • \n\t
  • a and b consist only of '0' or '1' characters.
  • \n\t
  • Each string does not contain leading zeros except for the zero itself.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=\"11\" --arg2=\"1\"", - "--arg1=\"1010\" --arg2=\"1011\"" - ], - "sample_test_results": [ - "'100'", - "'10101'" - ], - "hidden_test_cases": [ - "--arg1=\"0\" --arg2=\"0\"", - "--arg1=\"1\" --arg2=\"1\"", - "--arg1=\"111\" --arg2=\"111\"", - "--arg1=\"1111\" --arg2=\"1111\"", - "--arg1=\"1010\" --arg2=\"0101\"", - "--arg1=\"100\" --arg2=\"110\"", - "--arg1=\"11\" --arg2=\"11\"", - "--arg1=\"1\" --arg2=\"111\"", - "--arg1=\"1000\" --arg2=\"1100\"", - "--arg1=\"1111\" --arg2=\"1\"" - ], - "hidden_test_results": [ - "'0'", - "'10'", - "'1110'", - "'11110'", - "'1111'", - "'1010'", - "'110'", - "'1000'", - "'10100'", - "'10000'" - ], - "boilerplate": { - "python": "class Solution:\n def addBinary(self, a: str, b: str) -> str:\n ", - "java": "class Solution {\n public String addBinary(String a, String b) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string addBinary(string a, string b) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=keuWJ47xG8g&pp=ygUTTmVldENvZGUgQWRkIEJpbmFyeQ%3D%3D", - "method_name": "addBinary" - }, - { - "title": "Climbing Stairs", - "source": "https://leetcode.com/problems/climbing-stairs/", - "description": "

You are climbing a staircase. It takes n steps to reach the top.

\n\n

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 2\nOutput: 2\nExplanation: There are two ways to climb to the top.\n1. 1 step + 1 step\n2. 2 steps\n
\n\n

Example 2:

\n\n
\nInput: n = 3\nOutput: 3\nExplanation: There are three ways to climb to the top.\n1. 1 step + 1 step + 1 step\n2. 1 step + 2 steps\n3. 2 steps + 1 step\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 45
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=2", - "--arg1=3" - ], - "sample_test_results": [ - "2", - "3" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=4", - "--arg1=5", - "--arg1=6", - "--arg1=7", - "--arg1=8", - "--arg1=9", - "--arg1=10", - "--arg1=20", - "--arg1=30" - ], - "hidden_test_results": [ - "1", - "5", - "8", - "13", - "21", - "34", - "55", - "89", - "10946", - "1346269" - ], - "boilerplate": { - "python": "class Solution:\n def climbStairs(self, n: int) -> int:\n ", - "java": "class Solution {\n public int climbStairs(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int climbStairs(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=Y0lT9Fck7qI&pp=ygUYTmVldENvZGUgQ2xpbWJpbmcgU3RhaXJz", - "method_name": "climbStairs" - }, - { - "title": "Best Time to Buy and Sell Stock", - "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock/", - "description": "

You are given an array prices where prices[i] is the price of a given stock on the ith day.

\n\n

You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.

\n\n

Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.

\n\n

 

\n

Example 1:

\n\n
\nInput: prices = [7,1,5,3,6,4]\nOutput: 5\nExplanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.\nNote that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.\n
\n\n

Example 2:

\n\n
\nInput: prices = [7,6,4,3,1]\nOutput: 0\nExplanation: In this case, no transactions are done and the max profit = 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= prices.length <= 105
  • \n\t
  • 0 <= prices[i] <= 104
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=[7,1,5,3,6,4]", - "--arg1=[7,6,4,3,1]", - "--arg1=[2,4,1,7]" - ], - "sample_test_results": [ - "5", - "0", - "6" - ], - "hidden_test_cases": [ - "--arg1=[1]", - "--arg1=[1,2]", - "--arg1=[2,1]", - "--arg1=[3,3,3]", - "--arg1=[1,2,4,2,5,7,2,4,9,0]", - "--arg1=[2,1,2,1,0,1,2]", - "--arg1=[9,8,7,6,5,4,3,2,1]", - "--arg1=[1,4,1,4,3,1]", - "--arg1=[10000,9999,9998,9997]", - "--arg1=[0,2,0,2,0,2]" - ], - "hidden_test_results": [ - "0", - "1", - "0", - "0", - "8", - "2", - "0", - "3", - "0", - "2" - ], - "boilerplate": { - "python": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", - "java": "class Solution {\n public int maxProfit(int[] prices) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maxProfit(vector& prices) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=1pkOgXD63yU&pp=ygUoTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jaw%3D%3D", - "method_name": "maxProfit" - }, - { - "title": "Valid Palindrome", - "source": "https://leetcode.com/problems/valid-palindrome/", - "description": "

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.

\n\n

Given a string s, return true if it is a palindrome, or false otherwise.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "A man, a plan, a canal: Panama"\nOutput: true\nExplanation: "amanaplanacanalpanama" is a palindrome.\n
\n\n

Example 2:

\n\n
\nInput: s = "race a car"\nOutput: false\nExplanation: "raceacar" is not a palindrome.\n
\n\n

Example 3:

\n\n
\nInput: s = " "\nOutput: true\nExplanation: s is an empty string "" after removing non-alphanumeric characters.\nSince an empty string reads the same forward and backward, it is a palindrome.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 2 * 105
  • \n\t
  • s consists only of printable ASCII characters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=\"A man --arg2=a plan --arg3=a canal: Panama\"", - "--arg1=\"race a car\"", - "--arg1=\" \"" - ], - "sample_test_results": [ - "true", - "false", - "true" - ], - "hidden_test_cases": [ - "--arg1=\"\"", - "--arg1=\". --arg2=\"", - "--arg1=\"0P\"", - "--arg1=\"abc123cba\"", - "--arg1=\"Race a Car\"", - "--arg1=\"!@#$%^&*()\"", - "--arg1=\"12321\"", - "--arg1=\"Never odd or even\"", - "--arg1=\"a\"", - "--arg1=\". --arg2=a --arg3=.\"" - ], - "hidden_test_results": [ - "true", - "true", - "false", - "false", - "false", - "true", - "true", - "true", - "true", - "true" - ], - "boilerplate": { - "python": "class Solution:\n def isPalindrome(self, s: str) -> bool:\n ", - "java": "class Solution {\n public boolean isPalindrome(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isPalindrome(std::string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return toLowerCase(result) == toLowerCase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=jJXJ16kPFWg&pp=ygUZTmVldENvZGUgVmFsaWQgUGFsaW5kcm9tZQ%3D%3D", - "method_name": "isPalindrome" - }, - { - "title": "Excel Sheet Column Title", - "source": "https://leetcode.com/problems/excel-sheet-column-title/", - "description": "

Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.

\n\n

For example:

\n\n
\nA -> 1\nB -> 2\nC -> 3\n...\nZ -> 26\nAA -> 27\nAB -> 28 \n...\n
\n\n

 

\n

Example 1:

\n\n
\nInput: columnNumber = 1\nOutput: "A"\n
\n\n

Example 2:

\n\n
\nInput: columnNumber = 28\nOutput: "AB"\n
\n\n

Example 3:

\n\n
\nInput: columnNumber = 701\nOutput: "ZY"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= columnNumber <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1", - "--arg1=28", - "--arg1=701" - ], - "sample_test_results": [ - "'A'", - "'AB'", - "'ZY'" - ], - "hidden_test_cases": [ - "--arg1=26", - "--arg1=27", - "--arg1=52", - "--arg1=676", - "--arg1=702", - "--arg1=1000", - "--arg1=2147483647", - "--arg1=18278", - "--arg1=17576", - "--arg1=18277" - ], - "hidden_test_results": [ - "'Z'", - "'AA'", - "'AZ'", - "'YZ'", - "'ZZ'", - "'ALL'", - "'FXSHRXW'", - "'ZZZ'", - "'YYZ'", - "'ZZY'" - ], - "boilerplate": { - "python": "class Solution:\n def convertToTitle(self, columnNumber: int) -> str:\n ", - "java": "class Solution {\n public String convertToTitle(int columnNumber) {\n // Implementation goes here\n }\n}", - "cpp": "class Solution {\npublic:\n std::string convertToTitle(int columnNumber) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=X_vJDpCCuoA&pp=ygUhTmVldENvZGUgRXhjZWwgU2hlZXQgQ29sdW1uIFRpdGxl", - "method_name": "convertToTitle" - }, - { - "title": "Happy Number", - "source": "https://leetcode.com/problems/happy-number/", - "description": "

Write an algorithm to determine if a number n is happy.

\n\n

A happy number is a number defined by the following process:

\n\n
    \n\t
  • Starting with any positive integer, replace the number by the sum of the squares of its digits.
  • \n\t
  • Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1.
  • \n\t
  • Those numbers for which this process ends in 1 are happy.
  • \n
\n\n

Return true if n is a happy number, and false if not.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 19\nOutput: true\nExplanation:\n12 + 92 = 82\n82 + 22 = 68\n62 + 82 = 100\n12 + 02 + 02 = 1\n
\n\n

Example 2:

\n\n
\nInput: n = 2\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=19", - "--arg1=2", - "--arg1=7" - ], - "sample_test_results": [ - "true", - "false", - "true" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=4", - "--arg1=16", - "--arg1=89", - "--arg1=100", - "--arg1=1111111", - "--arg1=999999", - "--arg1=123", - "--arg1=3", - "--arg1=44" - ], - "hidden_test_results": [ - "true", - "false", - "false", - "false", - "true", - "true", - "false", - "false", - "false", - "true" - ], - "boilerplate": { - "python": "class Solution:\n def isHappy(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean isHappy(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isHappy(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=ljz85bxOYJ0&pp=ygUVTmVldENvZGUgSGFwcHkgTnVtYmVy", - "method_name": "isHappy" - }, - { - "title": "Isomorphic Strings", - "source": "https://leetcode.com/problems/isomorphic-strings/", - "description": "

Given two strings s and t, determine if they are isomorphic.

\n\n

Two strings s and t are isomorphic if the characters in s can be replaced to get t.

\n\n

All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself.

\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "egg", t = "add"

\n\n

Output: true

\n\n

Explanation:

\n\n

The strings s and t can be made identical by:

\n\n
    \n\t
  • Mapping 'e' to 'a'.
  • \n\t
  • Mapping 'g' to 'd'.
  • \n
\n
\n\n

Example 2:

\n\n
\n

Input: s = "foo", t = "bar"

\n\n

Output: false

\n\n

Explanation:

\n\n

The strings s and t can not be made identical as 'o' needs to be mapped to both 'a' and 'r'.

\n
\n\n

Example 3:

\n\n
\n

Input: s = "paper", t = "title"

\n\n

Output: true

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 5 * 104
  • \n\t
  • t.length == s.length
  • \n\t
  • s and t consist of any valid ascii character.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=\"egg\" --arg2=\"add\"", - "--arg1=\"foo\" --arg2=\"bar\"", - "--arg1=\"paper\" --arg2=\"title\"" - ], - "sample_test_results": [ - "true", - "false", - "true" - ], - "hidden_test_cases": [ - "--arg1=\"\" --arg2=\"\"", - "--arg1=\"a\" --arg2=\"b\"", - "--arg1=\"ab\" --arg2=\"aa\"", - "--arg1=\"badc\" --arg2=\"bada\"", - "--arg1=\"abcde\" --arg2=\"vwxyz\"", - "--arg1=\"hello\" --arg2=\"world\"", - "--arg1=\"aaaa\" --arg2=\"bbbb\"", - "--arg1=\"ab\" --arg2=\"cd\"", - "--arg1=\"13\" --arg2=\"42\"", - "--arg1=\"ACAB\" --arg2=\"XCXY\"" - ], - "hidden_test_results": [ - "true", - "true", - "false", - "false", - "true", - "false", - "true", - "true", - "true", - "true" - ], - "boilerplate": { - "python": "class Solution:\n def isIsomorphic(self, s: str, t: str) -> bool:\n ", - "java": "class Solution {\n public boolean isIsomorphic(String s, String t) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isIsomorphic(string s, string t) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return toLowerCase(result) == toLowerCase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=7yF-U1hLEqQ&pp=ygUbTmVldENvZGUgSXNvbW9ycGhpYyBTdHJpbmdz", - "method_name": "isIsomorphic" - }, - { - "title": "Contains Duplicate II", - "source": "https://leetcode.com/problems/contains-duplicate-ii/", - "description": "

Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) <= k.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,3,1], k = 3\nOutput: true\n
\n\n

Example 2:

\n\n
\nInput: nums = [1,0,1,1], k = 1\nOutput: true\n
\n\n

Example 3:

\n\n
\nInput: nums = [1,2,3,1,2,3], k = 2\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • 0 <= k <= 105
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=[1,2,3,1] --arg2=3", - "--arg1=[1,0,1,1] --arg2=1", - "--arg1=[1,2,3,1,2,3] --arg2=2" - ], - "sample_test_results": [ - "true", - "true", - "false" - ], - "hidden_test_cases": [ - "--arg1=[1,2,3,4,5] --arg2=2", - "--arg1=[1,1] --arg2=1", - "--arg1=[1,2,1] --arg2=0", - "--arg1=[1,2,3,4,1] --arg2=4", - "--arg1=[1,2,3,4,1] --arg2=3", - "--arg1=[-1,-1] --arg2=1", - "--arg1=[1] --arg2=1", - "--arg1=[1,2,3,4,2] --arg2=3", - "--arg1=[1,1,1,1] --arg2=2", - "--arg1=[1,2,1,2] --arg2=2" - ], - "hidden_test_results": [ - "false", - "true", - "false", - "true", - "false", - "true", - "false", - "true", - "true", - "true" - ], - "boilerplate": { - "python": "class Solution:\n def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool:\n ", - "java": "class Solution {\n public boolean containsNearbyDuplicate(int[] nums, int k) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool containsNearbyDuplicate(std::vector& nums, int k) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=ypn0aZ0nrL4&pp=ygUeTmVldENvZGUgQ29udGFpbnMgRHVwbGljYXRlIElJ", - "method_name": "containsNearbyDuplicate" - }, - { - "title": "Summary Ranges", - "source": "https://leetcode.com/problems/summary-ranges/", - "description": "

You are given a sorted unique integer array nums.

\n\n

A range [a,b] is the set of all integers from a to b (inclusive).

\n\n

Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, each element of nums is covered by exactly one of the ranges, and there is no integer x such that x is in one of the ranges but not in nums.

\n\n

Each range [a,b] in the list should be output as:

\n\n
    \n\t
  • "a->b" if a != b
  • \n\t
  • "a" if a == b
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [0,1,2,4,5,7]\nOutput: ["0->2","4->5","7"]\nExplanation: The ranges are:\n[0,2] --> "0->2"\n[4,5] --> "4->5"\n[7,7] --> "7"\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,2,3,4,6,8,9]\nOutput: ["0","2->4","6","8->9"]\nExplanation: The ranges are:\n[0,0] --> "0"\n[2,4] --> "2->4"\n[6,6] --> "6"\n[8,9] --> "8->9"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 20
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n\t
  • All the values of nums are unique.
  • \n\t
  • nums is sorted in ascending order.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=[0,1,2,4,5,7]", - "--arg1=[0,2,3,4,6,8,9]", - "--arg1=[]" - ], - "sample_test_results": [ - "['0->2','4->5','7']", - "['0','2->4','6','8->9']", - "[]" - ], - "hidden_test_cases": [ - "--arg1=[1]", - "--arg1=[1,2]", - "--arg1=[1,3,5,7]", - "--arg1=[1,2,3,4,5]", - "--arg1=[-1,0,1,2]", - "--arg1=[-5,-4,-3,-1,0,2]", - "--arg1=[1,3]", - "--arg1=[1,2,4,6,7,8]", - "--arg1=[0,1,3,5,6,7,9]", - "--arg1=[-2147483648,2147483647]" - ], - "hidden_test_results": [ - "['1']", - "['1->2']", - "['1','3','5','7']", - "['1->5']", - "['-1->2']", - "['-5->-3','-1->0','2']", - "['1','3']", - "['1->2','4','6->8']", - "['0->1','3','5->7','9']", - "['-2147483648','2147483647']" - ], - "boilerplate": { - "python": "class Solution:\n def summaryRanges(self, nums: List[int]) -> List[str]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List summaryRanges(List nums) {\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector summaryRanges(vector& nums) {\n // Implementation goes here\n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "return Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray());", - "cpp": "std::sort(result.begin(), result.end());\nauto evaluated_expected = evaluateStringToVector(expected);\nstd::sort(evaluated_expected.begin(), evaluated_expected.end());\nreturn result == evaluated_expected;" - }, - "explanation": "https://www.youtube.com/watch?v=ZHJDwbfqoa8&pp=ygUXTmVldENvZGUgU3VtbWFyeSBSYW5nZXM%3D", - "method_name": "summaryRanges" - }, - { - "title": "Power of Two", - "source": "https://leetcode.com/problems/power-of-two/", - "description": "

Given an integer n, return true if it is a power of two. Otherwise, return false.

\n\n

An integer n is a power of two, if there exists an integer x such that n == 2x.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 1\nOutput: true\nExplanation: 20 = 1\n
\n\n

Example 2:

\n\n
\nInput: n = 16\nOutput: true\nExplanation: 24 = 16\n
\n\n

Example 3:

\n\n
\nInput: n = 3\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1", - "--arg1=16", - "--arg1=3" - ], - "sample_test_results": [ - "true", - "true", - "false" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=-16", - "--arg1=2", - "--arg1=4", - "--arg1=5", - "--arg1=32", - "--arg1=64", - "--arg1=100", - "--arg1=2147483647", - "--arg1=-2147483648" - ], - "hidden_test_results": [ - "false", - "false", - "true", - "true", - "false", - "true", - "true", - "false", - "false", - "false" - ], - "boilerplate": { - "python": "class Solution:\n def isPowerOfTwo(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean isPowerOfTwo(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isPowerOfTwo(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) == std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" - }, - "explanation": "https://www.youtube.com/watch?v=H2bjttEV4Vc&pp=ygUVTmVldENvZGUgUG93ZXIgb2YgVHdv", - "method_name": "isPowerOfTwo" - }, - { - "title": "Ugly Number", - "source": "https://leetcode.com/problems/ugly-number/", - "description": "

An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.

\n\n

Given an integer n, return true if n is an ugly number.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 6\nOutput: true\nExplanation: 6 = 2 × 3\n
\n\n

Example 2:

\n\n
\nInput: n = 1\nOutput: true\nExplanation: 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5.\n
\n\n

Example 3:

\n\n
\nInput: n = 14\nOutput: false\nExplanation: 14 is not ugly since it includes the prime factor 7.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=6", - "--arg1=1", - "--arg1=14" - ], - "sample_test_results": [ - "true", - "true", - "false" - ], - "hidden_test_cases": [ - "--arg1=8", - "--arg1=0", - "--arg1=-6", - "--arg1=25", - "--arg1=15", - "--arg1=49", - "--arg1=30", - "--arg1=100", - "--arg1=-2147483648", - "--arg1=2147483647" - ], - "hidden_test_results": [ - "true", - "false", - "false", - "true", - "true", - "false", - "true", - "true", - "false", - "false" - ], - "boilerplate": { - "python": "class Solution:\n def isUgly(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean isUgly(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isUgly(int n) {\n\n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=M0Zay1Qr9ws&pp=ygUUTmVldENvZGUgVWdseSBOdW1iZXI%3D", - "method_name": "isUgly" - }, - { - "title": "Word Pattern", - "source": "https://leetcode.com/problems/word-pattern/", - "description": "

Given a pattern and a string s, find if s follows the same pattern.

\n\n

Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. Specifically:

\n\n
    \n\t
  • Each letter in pattern maps to exactly one unique word in s.
  • \n\t
  • Each unique word in s maps to exactly one letter in pattern.
  • \n\t
  • No two letters map to the same word, and no two words map to the same letter.
  • \n
\n\n

 

\n

Example 1:

\n\n
\n

Input: pattern = "abba", s = "dog cat cat dog"

\n\n

Output: true

\n\n

Explanation:

\n\n

The bijection can be established as:

\n\n
    \n\t
  • 'a' maps to "dog".
  • \n\t
  • 'b' maps to "cat".
  • \n
\n
\n\n

Example 2:

\n\n
\n

Input: pattern = "abba", s = "dog cat cat fish"

\n\n

Output: false

\n
\n\n

Example 3:

\n\n
\n

Input: pattern = "aaaa", s = "dog cat cat dog"

\n\n

Output: false

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= pattern.length <= 300
  • \n\t
  • pattern contains only lower-case English letters.
  • \n\t
  • 1 <= s.length <= 3000
  • \n\t
  • s contains only lowercase English letters and spaces ' '.
  • \n\t
  • s does not contain any leading or trailing spaces.
  • \n\t
  • All the words in s are separated by a single space.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=\"abba\" --arg2=\"dog cat cat dog\"", - "--arg1=\"abba\" --arg2=\"dog cat cat fish\"", - "--arg1=\"aaaa\" --arg2=\"dog cat cat dog\"" - ], - "sample_test_results": [ - "true", - "false", - "false" - ], - "hidden_test_cases": [ - "--arg1=\"abc\" --arg2=\"dog cat dog\"", - "--arg1=\"jquery\" --arg2=\"jquery\"", - "--arg1=\"aaa\" --arg2=\"aa aa aa\"", - "--arg1=\"abba\" --arg2=\"dog dog dog dog\"", - "--arg1=\"ab\" --arg2=\"dog cat\"", - "--arg1=\"abc\" --arg2=\"b c a\"", - "--arg1=\"aabb\" --arg2=\"cat cat dog dog\"", - "--arg1=\"abba\" --arg2=\"dog cat cat fish\"", - "--arg1=\"\" --arg2=\"\"", - "--arg1=\"a\" --arg2=\"dog\"" - ], - "hidden_test_results": [ - "false", - "false", - "true", - "false", - "true", - "true", - "true", - "false", - "true", - "true" - ], - "boilerplate": { - "python": "class Solution:\n def wordPattern(self, pattern: str, s: str) -> bool:\n ", - "java": "class Solution {\n public boolean wordPattern(String pattern, String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool wordPattern(const string& pattern, const string& s) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return toLowercase(result) == toLowercase(expected);\n\nstd::string toLowercase(const std::string &input) {\n std::string lowercased = input;\n std::transform(lowercased.begin(), lowercased.end(), lowercased.begin(), ::tolower);\n return lowercased;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=W_akoecmCbM&pp=ygUVTmVldENvZGUgV29yZCBQYXR0ZXJu", - "method_name": "wordPattern" - }, - { - "title": "Nim Game", - "source": "https://leetcode.com/problems/nim-game/", - "description": "

You are playing the following Nim Game with your friend:

\n\n
    \n\t
  • Initially, there is a heap of stones on the table.
  • \n\t
  • You and your friend will alternate taking turns, and you go first.
  • \n\t
  • On each turn, the person whose turn it is will remove 1 to 3 stones from the heap.
  • \n\t
  • The one who removes the last stone is the winner.
  • \n
\n\n

Given n, the number of stones in the heap, return true if you can win the game assuming both you and your friend play optimally, otherwise return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 4\nOutput: false\nExplanation: These are the possible outcomes:\n1. You remove 1 stone. Your friend removes 3 stones, including the last stone. Your friend wins.\n2. You remove 2 stones. Your friend removes 2 stones, including the last stone. Your friend wins.\n3. You remove 3 stones. Your friend removes the last stone. Your friend wins.\nIn all outcomes, your friend wins.\n
\n\n

Example 2:

\n\n
\nInput: n = 1\nOutput: true\n
\n\n

Example 3:

\n\n
\nInput: n = 2\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=4", - "--arg1=1", - "--arg1=2" - ], - "sample_test_results": [ - "false", - "true", - "true" - ], - "hidden_test_cases": [ - "--arg1=3", - "--arg1=5", - "--arg1=6", - "--arg1=7", - "--arg1=8", - "--arg1=9", - "--arg1=10", - "--arg1=100", - "--arg1=1000000", - "--arg1=2147483647" - ], - "hidden_test_results": [ - "true", - "true", - "true", - "true", - "false", - "true", - "true", - "false", - "false", - "true" - ], - "boilerplate": { - "python": "class Solution:\n def canWinNim(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean canWinNim(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool canWinNim(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) ==\n std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" - }, - "explanation": "https://www.youtube.com/watch?v=ndR2buBWVc8&pp=ygURTmVldENvZGUgTmltIEdhbWU%3D", - "method_name": "canWinNim" - }, - { - "title": "Power of Three", - "source": "https://leetcode.com/problems/power-of-three/", - "description": "

Given an integer n, return true if it is a power of three. Otherwise, return false.

\n\n

An integer n is a power of three, if there exists an integer x such that n == 3x.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 27\nOutput: true\nExplanation: 27 = 33\n
\n\n

Example 2:

\n\n
\nInput: n = 0\nOutput: false\nExplanation: There is no x where 3x = 0.\n
\n\n

Example 3:

\n\n
\nInput: n = -1\nOutput: false\nExplanation: There is no x where 3x = (-1).\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=27", - "--arg1=0", - "--arg1=-1" - ], - "sample_test_results": [ - "true", - "false", - "false" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=9", - "--arg1=45", - "--arg1=81", - "--arg1=243", - "--arg1=-3", - "--arg1=2", - "--arg1=99", - "--arg1=19683", - "--arg1=-729" - ], - "hidden_test_results": [ - "true", - "true", - "false", - "true", - "true", - "false", - "false", - "false", - "true", - "false" - ], - "boilerplate": { - "python": "class Solution:\n def isPowerOfThree(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean isPowerOfThree(int n) {\n // Implementation here\n }\n}", - "cpp": "class Solution {\npublic:\n bool isPowerOfThree(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "std::string lowerCase(const std::string& str) {\n std::string lowerStr = str;\n std::transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(), ::tolower);\n return lowerStr;\n}\n\nreturn lowerCase(result) == lowerCase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=M2P2BAFmLlo&pp=ygUXTmVldENvZGUgUG93ZXIgb2YgVGhyZWU%3D", - "method_name": "isPowerOfThree" - }, - { - "title": "Power of Four", - "source": "https://leetcode.com/problems/power-of-four/", - "description": "

Given an integer n, return true if it is a power of four. Otherwise, return false.

\n\n

An integer n is a power of four, if there exists an integer x such that n == 4x.

\n\n

 

\n

Example 1:

\n
Input: n = 16\nOutput: true\n

Example 2:

\n
Input: n = 5\nOutput: false\n

Example 3:

\n
Input: n = 1\nOutput: true\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=16", - "--arg1=5", - "--arg1=1" - ], - "sample_test_results": [ - "true", - "false", - "true" - ], - "hidden_test_cases": [ - "--arg1=4", - "--arg1=64", - "--arg1=8", - "--arg1=256", - "--arg1=-4", - "--arg1=0", - "--arg1=2", - "--arg1=100", - "--arg1=1024", - "--arg1=-1024" - ], - "hidden_test_results": [ - "true", - "true", - "false", - "true", - "false", - "false", - "false", - "false", - "true", - "false" - ], - "boilerplate": { - "python": "class Solution:\n def isPowerOfFour(self, n: int) -> bool:\n ", - "java": "class Solution {\n public boolean isPowerOfFour(int n) {\n\n }\n}", - "cpp": "class Solution {\npublic:\n bool isPowerOfFour(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return to_lowercopy(result) == to_lowercopy(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=qEYZPwnlM0U&pp=ygUWTmVldENvZGUgUG93ZXIgb2YgRm91cg%3D%3D", - "method_name": "isPowerOfFour" - }, - { - "title": "Reverse Vowels of a String", - "source": "https://leetcode.com/problems/reverse-vowels-of-a-string/", - "description": "

Given a string s, reverse only all the vowels in the string and return it.

\n\n

The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once.

\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "IceCreAm"

\n\n

Output: "AceCreIm"

\n\n

Explanation:

\n\n

The vowels in s are ['I', 'e', 'e', 'A']. On reversing the vowels, s becomes "AceCreIm".

\n
\n\n

Example 2:

\n\n
\n

Input: s = "leetcode"

\n\n

Output: "leotcede"

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 3 * 105
  • \n\t
  • s consist of printable ASCII characters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='IceCreAm'", - "--arg1='leetcode'" - ], - "sample_test_results": [ - "'AceCreIm'", - "'leotcede'" - ], - "hidden_test_cases": [ - "--arg1='hello'", - "--arg1='aA'", - "--arg1='race a car'", - "--arg1=''", - "--arg1='xyz'", - "--arg1='AEIOU'", - "--arg1='aeiou'", - "--arg1='. --arg2=!'", - "--arg1='Aa'", - "--arg1='LEetcOde'" - ], - "hidden_test_results": [ - "'holle'", - "'Aa'", - "'raca e car'", - "''", - "'xyz'", - "'UOIEA'", - "'uoiea'", - "'.,!'", - "'aA'", - "'LeOtcedE'" - ], - "boilerplate": { - "python": "class Solution:\n def reverseVowels(self, s: str) -> str:\n ", - "java": "class Solution {\n public String reverseVowels(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string reverseVowels(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=uHYjUMR3Tg8&pp=ygUjTmVldENvZGUgUmV2ZXJzZSBWb3dlbHMgb2YgYSBTdHJpbmc%3D", - "method_name": "reverseVowels" - }, - { - "title": "Intersection of Two Arrays II", - "source": "https://leetcode.com/problems/intersection-of-two-arrays-ii/", - "description": "

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums1 = [1,2,2,1], nums2 = [2,2]\nOutput: [2,2]\n
\n\n

Example 2:

\n\n
\nInput: nums1 = [4,9,5], nums2 = [9,4,9,8,4]\nOutput: [4,9]\nExplanation: [9,4] is also accepted.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums1.length, nums2.length <= 1000
  • \n\t
  • 0 <= nums1[i], nums2[i] <= 1000
  • \n
\n\n

 

\n

Follow up:

\n\n
    \n\t
  • What if the given array is already sorted? How would you optimize your algorithm?
  • \n\t
  • What if nums1's size is small compared to nums2's size? Which algorithm is better?
  • \n\t
  • What if elements of nums2 are stored on disk, and the memory is limited such that you cannot load all elements into the memory at once?
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=[1,2,2,1] --arg2=[2,2]", - "--arg1=[4,9,5] --arg2=[9,4,9,8,4]" - ], - "sample_test_results": [ - "[2,2]", - "[9,4]" - ], - "hidden_test_cases": [ - "--arg1=[1,1,1] --arg2=[1,1]", - "--arg1=[1,2] --arg2=[1,1]", - "--arg1=[1] --arg2=[1]", - "--arg1=[1,2,3] --arg2=[4,5,6]", - "--arg1=[1,2,3,4] --arg2=[1,2,3,4]", - "--arg1=[1,1,1,1] --arg2=[1]", - "--arg1=[] --arg2=[1]", - "--arg1=[1,2,2,3] --arg2=[2,2,2,3]", - "--arg1=[1,2,3,4,5] --arg2=[5,4,3,2,1]", - "--arg1=[1000,1000] --arg2=[1000,1000]" - ], - "hidden_test_results": [ - "[1,1]", - "[1]", - "[1]", - "[]", - "[1,2,3,4]", - "[1]", - "[]", - "[2,2,3]", - "[5,4,3,2,1]", - "[1000,1000]" - ], - "boilerplate": { - "python": "class Solution:\n def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List intersect(int[] nums1, int[] nums2) {\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector intersect(vector& nums1, vector& nums2) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "import java.util.Arrays;\n\nboolean compareFunction(Object result, String expected) {\n Object expectedList = eval(expected); // Assuming eval converts the expected\n return Arrays.equals(Arrays.sort(result), Arrays.sort(expectedList));\n}\n\n// Note: `eval` is a placeholder for your evaluation logic, as Java \n// doesn't provide a direct equivalent for Python's eval. You need \n// to implement conversion of 'expected' from String representation \n// to the required Object format.", - "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedSorted = eval(expected); // ensure eval yields vector of same type\nstd::sort(expectedSorted.begin(), expectedSorted.end());\nreturn result == expectedSorted;" - }, - "explanation": "https://www.youtube.com/watch?v=fwUTXaMom6U&pp=ygUmTmVldENvZGUgSW50ZXJzZWN0aW9uIG9mIFR3byBBcnJheXMgSUk%3D", - "method_name": "intersect" - }, - { - "title": "Valid Perfect Square", - "source": "https://leetcode.com/problems/valid-perfect-square/", - "description": "

Given a positive integer num, return true if num is a perfect square or false otherwise.

\n\n

A perfect square is an integer that is the square of an integer. In other words, it is the product of some integer with itself.

\n\n

You must not use any built-in library function, such as sqrt.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = 16\nOutput: true\nExplanation: We return true because 4 * 4 = 16 and 4 is an integer.\n
\n\n

Example 2:

\n\n
\nInput: num = 14\nOutput: false\nExplanation: We return false because 3.742 * 3.742 = 14 and 3.742 is not an integer.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=16", - "--arg1=14", - "--arg1=1" - ], - "sample_test_results": [ - "true", - "false", - "true" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=4", - "--arg1=9", - "--arg1=25", - "--arg1=26", - "--arg1=100", - "--arg1=2147483647", - "--arg1=808201", - "--arg1=2", - "--arg1=3" - ], - "hidden_test_results": [ - "true", - "true", - "true", - "true", - "false", - "true", - "false", - "true", - "false", - "false" - ], - "boilerplate": { - "python": "class Solution:\n def isPerfectSquare(self, num: int) -> bool:\n ", - "java": "class Solution {\n public boolean isPerfectSquare(int num) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isPerfectSquare(int num) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=Cg_wWPHJ2Sk&pp=ygUdTmVldENvZGUgVmFsaWQgUGVyZmVjdCBTcXVhcmU%3D", - "method_name": "isPerfectSquare" - }, - { - "title": "Find the Difference", - "source": "https://leetcode.com/problems/find-the-difference/", - "description": "

You are given two strings s and t.

\n\n

String t is generated by random shuffling string s and then add one more letter at a random position.

\n\n

Return the letter that was added to t.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abcd", t = "abcde"\nOutput: "e"\nExplanation: 'e' is the letter that was added.\n
\n\n

Example 2:

\n\n
\nInput: s = "", t = "y"\nOutput: "y"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s.length <= 1000
  • \n\t
  • t.length == s.length + 1
  • \n\t
  • s and t consist of lowercase English letters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='abcd' --arg2='abcde'", - "--arg1='' --arg2='y'", - "--arg1='ae' --arg2='aea'" - ], - "sample_test_results": [ - "'e'", - "'y'", - "'a'" - ], - "hidden_test_cases": [ - "--arg1='abcd' --arg2='abcde'", - "--arg1='' --arg2='y'", - "--arg1='a' --arg2='aa'", - "--arg1='ae' --arg2='aea'", - "--arg1='abc' --arg2='cabd'", - "--arg1='xyz' --arg2='xyzz'", - "--arg1='aaa' --arg2='aaaa'", - "--arg1='bb' --arg2='bbb'", - "--arg1='abcd' --arg2='dbcae'", - "--arg1='hello' --arg2='hollae'" - ], - "hidden_test_results": [ - "'e'", - "'y'", - "'a'", - "'a'", - "'d'", - "'z'", - "'a'", - "'b'", - "'e'", - "'a'" - ], - "boilerplate": { - "python": "class Solution:\n def findTheDifference(self, s: str, t: str) -> str:\n ", - "java": "class Solution {\n public char findTheDifference(String s, String t) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n char findTheDifference(string s, string t) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "Object evaluatedExpected = null;\ntry {\n evaluatedExpected = new ScriptEngineManager().getEngineByName(\"JavaScript\").eval(expected);\n} catch (Exception e) {\n return false;\n}\nreturn result.equals(evaluatedExpected);", - "cpp": "#include \n#include \n#include \n#include \n#include \n\nbool evaluateAndCompare(const std::string& result, const std::string& expected) {\n try {\n std::stringstream evaluationStream;\n evaluationStream << expected;\n double evaluatedExpected;\n evaluationStream >> evaluatedExpected;\n\n double resultValue;\n std::stringstream resultStream(result);\n resultStream >> resultValue;\n\n return resultValue == evaluatedExpected;\n } catch (const std::exception& e) {\n std::cerr << \"Error evaluating expression: \" << e.what() << std::endl;\n return false;\n }\n}" - }, - "explanation": "https://www.youtube.com/watch?v=a4wqKR-znBE&pp=ygUcTmVldENvZGUgRmluZCB0aGUgRGlmZmVyZW5jZQ%3D%3D", - "method_name": "findTheDifference" - }, - { - "title": "Is Subsequence", - "source": "https://leetcode.com/problems/is-subsequence/", - "description": "

Given two strings s and t, return true if s is a subsequence of t, or false otherwise.

\n\n

A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not).

\n\n

 

\n

Example 1:

\n
Input: s = \"abc\", t = \"ahbgdc\"\nOutput: true\n

Example 2:

\n
Input: s = \"axc\", t = \"ahbgdc\"\nOutput: false\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s.length <= 100
  • \n\t
  • 0 <= t.length <= 104
  • \n\t
  • s and t consist only of lowercase English letters.
  • \n
\n\n

 

\nFollow up: Suppose there are lots of incoming s, say s1, s2, ..., sk where k >= 109, and you want to check one by one to see if t has its subsequence. In this scenario, how would you change your code?", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='abc' --arg2='ahbgdc'", - "--arg1='axc' --arg2='ahbgdc'", - "--arg1='' --arg2='ahbgdc'" - ], - "sample_test_results": [ - "true", - "false", - "true" - ], - "hidden_test_cases": [ - "--arg1='abc' --arg2='ahbgdc'", - "--arg1='' --arg2=''", - "--arg1='abc' --arg2='abc'", - "--arg1='abc' --arg2='abcd'", - "--arg1='abc' --arg2='acb'", - "--arg1='ab' --arg2='baab'", - "--arg1='leetcode' --arg2='yleets'", - "--arg1='b' --arg2='abc'", - "--arg1='bb' --arg2='ahbgb'", - "--arg1='aaaaaa' --arg2='bbaaaa'" - ], - "hidden_test_results": [ - "true", - "true", - "true", - "true", - "false", - "true", - "false", - "true", - "true", - "false" - ], - "boilerplate": { - "python": "class Solution:\n def isSubsequence(self, s: str, t: str) -> bool:\n ", - "java": "class Solution {\n public boolean isSubsequence(String s, String t) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isSubsequence(string s, string t) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return toLowerCase(result) == toLowerCase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=99RVfqklbCE&pp=ygUXTmVldENvZGUgSXMgU3Vic2VxdWVuY2U%3D", - "method_name": "isSubsequence" - }, - { - "title": "Binary Watch", - "source": "https://leetcode.com/problems/binary-watch/", - "description": "

A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED represents a zero or one, with the least significant bit on the right.

\n\n
    \n\t
  • For example, the below binary watch reads "4:51".
  • \n
\n\n

\"\"

\n\n

Given an integer turnedOn which represents the number of LEDs that are currently on (ignoring the PM), return all possible times the watch could represent. You may return the answer in any order.

\n\n

The hour must not contain a leading zero.

\n\n
    \n\t
  • For example, "01:00" is not valid. It should be "1:00".
  • \n
\n\n

The minute must consist of two digits and may contain a leading zero.

\n\n
    \n\t
  • For example, "10:2" is not valid. It should be "10:02".
  • \n
\n\n

 

\n

Example 1:

\n
Input: turnedOn = 1\nOutput: [\"0:01\",\"0:02\",\"0:04\",\"0:08\",\"0:16\",\"0:32\",\"1:00\",\"2:00\",\"4:00\",\"8:00\"]\n

Example 2:

\n
Input: turnedOn = 9\nOutput: []\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= turnedOn <= 10
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=1", - "--arg1=9", - "--arg1=2" - ], - "sample_test_results": [ - "['0:01','0:02','0:04','0:08','0:16','0:32','1:00','2:00','4:00','8:00']", - "[]", - "['0:03','0:05','0:06','0:09','0:10','0:12','0:17','0:18','0:20','0:24','0:33','0:34','0:36','0:40','0:48','1:01','1:02','1:04','1:08','1:16','1:32','2:01','2:02','2:04','2:08','2:16','2:32','3:00','4:01','4:02','4:04','4:08','4:16','4:32','5:00','6:00','8:01','8:02','8:04','8:08','8:16','8:32','9:00','10:00']" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=1", - "--arg1=2", - "--arg1=3", - "--arg1=4", - "--arg1=5", - "--arg1=6", - "--arg1=7", - "--arg1=8", - "--arg1=9" - ], - "hidden_test_results": [ - "['0:00']", - "['0:01','0:02','0:04','0:08','0:16','0:32','1:00','2:00','4:00','8:00']", - "['0:03','0:05','0:06','0:09','0:10','0:12','0:17','0:18','0:20','0:24','0:33','0:34','0:36','0:40','0:48','1:01','1:02','1:04','1:08','1:16','1:32','2:01','2:02','2:04','2:08','2:16','2:32','3:00','4:01','4:02','4:04','4:08','4:16','4:32','5:00','6:00','8:01','8:02','8:04','8:08','8:16','8:32','9:00','10:00']", - "['0:07','0:11','0:13','0:14','0:19','0:21','0:22','0:25','0:26','0:28','0:35','0:37','0:38','0:41','0:42','0:44','0:49','0:50','0:52','0:56','1:03','1:05','1:06','1:09','1:10','1:12','1:17','1:18','1:20','1:24','1:33','1:34','1:36','1:40','1:48','2:03','2:05','2:06','2:09','2:10','2:12','2:17','2:18','2:20','2:24','2:33','2:34','2:36','2:40','2:48','3:01','3:02','3:04','3:08','3:16','3:32','4:03','4:05','4:06','4:09','4:10','4:12','4:17','4:18','4:20','4:24','4:33','4:34','4:36','4:40','4:48','5:01','5:02','5:04','5:08','5:16','5:32','6:01','6:02','6:04','6:08','6:16','6:32','7:00','8:03','8:05','8:06','8:09','8:10','8:12','8:17','8:18','8:20','8:24','8:33','8:34','8:36','8:40','8:48','9:01','9:02','9:04','9:08','9:16','9:32','10:01','10:02','10:04','10:08','10:16','10:32','11:00']", - "['0:15','0:23','0:27','0:29','0:30','0:39','0:43','0:45','0:46','0:51','0:53','0:54','0:57','0:58','1:07','1:11','1:13','1:14','1:19','1:21','1:22','1:25','1:26','1:28','1:35','1:37','1:38','1:41','1:42','1:44','1:49','1:50','1:52','1:56','2:07','2:11','2:13','2:14','2:19','2:21','2:22','2:25','2:26','2:28','2:35','2:37','2:38','2:41','2:42','2:44','2:49','2:50','2:52','2:56','3:03','3:05','3:06','3:09','3:10','3:12','3:17','3:18','3:20','3:24','3:33','3:34','3:36','3:40','3:48','4:07','4:11','4:13','4:14','4:19','4:21','4:22','4:25','4:26','4:28','4:35','4:37','4:38','4:41','4:42','4:44','4:49','4:50','4:52','4:56','5:03','5:05','5:06','5:09','5:10','5:12','5:17','5:18','5:20','5:24','5:33','5:34','5:36','5:40','5:48','6:03','6:05','6:06','6:09','6:10','6:12','6:17','6:18','6:20','6:24','6:33','6:34','6:36','6:40','6:48','7:01','7:02','7:04','7:08','7:16','7:32','8:07','8:11','8:13','8:14','8:19','8:21','8:22','8:25','8:26','8:28','8:35','8:37','8:38','8:41','8:42','8:44','8:49','8:50','8:52','8:56','9:03','9:05','9:06','9:09','9:10','9:12','9:17','9:18','9:20','9:24','9:33','9:34','9:36','9:40','9:48','10:03','10:05','10:06','10:09','10:10','10:12','10:17','10:18','10:20','10:24','10:33','10:34','10:36','10:40','10:48','11:01','11:02','11:04','11:08','11:16','11:32']", - "['0:31','0:47','0:55','0:59','1:15','1:23','1:27','1:29','1:30','1:39','1:43','1:45','1:46','1:51','1:53','1:54','1:57','1:58','2:15','2:23','2:27','2:29','2:30','2:39','2:43','2:45','2:46','2:51','2:53','2:54','2:57','2:58','3:07','3:11','3:13','3:14','3:19','3:21','3:22','3:25','3:26','3:28','3:35','3:37','3:38','3:41','3:42','3:44','3:49','3:50','3:52','3:56','4:15','4:23','4:27','4:29','4:30','4:39','4:43','4:45','4:46','4:51','4:53','4:54','4:57','4:58','5:07','5:11','5:13','5:14','5:19','5:21','5:22','5:25','5:26','5:28','5:35','5:37','5:38','5:41','5:42','5:44','5:49','5:50','5:52','5:56','6:07','6:11','6:13','6:14','6:19','6:21','6:22','6:25','6:26','6:28','6:35','6:37','6:38','6:41','6:42','6:44','6:49','6:50','6:52','6:56','7:03','7:05','7:06','7:09','7:10','7:12','7:17','7:18','7:20','7:24','7:33','7:34','7:36','7:40','7:48','8:15','8:23','8:27','8:29','8:30','8:39','8:43','8:45','8:46','8:51','8:53','8:54','8:57','8:58','9:07','9:11','9:13','9:14','9:19','9:21','9:22','9:25','9:26','9:28','9:35','9:37','9:38','9:41','9:42','9:44','9:49','9:50','9:52','9:56','10:07','10:11','10:13','10:14','10:19','10:21','10:22','10:25','10:26','10:28','10:35','10:37','10:38','10:41','10:42','10:44','10:49','10:50','10:52','10:56','11:03','11:05','11:06','11:09','11:10','11:12','11:17','11:18','11:20','11:24','11:33','11:34','11:36','11:40','11:48']", - "['1:31','1:47','1:55','1:59','2:31','2:47','2:55','2:59','3:15','3:23','3:27','3:29','3:30','3:39','3:43','3:45','3:46','3:51','3:53','3:54','3:57','3:58','4:31','4:47','4:55','4:59','5:15','5:23','5:27','5:29','5:30','5:39','5:43','5:45','5:46','5:51','5:53','5:54','5:57','5:58','6:15','6:23','6:27','6:29','6:30','6:39','6:43','6:45','6:46','6:51','6:53','6:54','6:57','6:58','7:07','7:11','7:13','7:14','7:19','7:21','7:22','7:25','7:26','7:28','7:35','7:37','7:38','7:41','7:42','7:44','7:49','7:50','7:52','7:56','8:31','8:47','8:55','8:59','9:15','9:23','9:27','9:29','9:30','9:39','9:43','9:45','9:46','9:51','9:53','9:54','9:57','9:58','10:15','10:23','10:27','10:29','10:30','10:39','10:43','10:45','10:46','10:51','10:53','10:54','10:57','10:58','11:07','11:11','11:13','11:14','11:19','11:21','11:22','11:25','11:26','11:28','11:35','11:37','11:38','11:41','11:42','11:44','11:49','11:50','11:52','11:56']", - "['3:31','3:47','3:55','3:59','5:31','5:47','5:55','5:59','6:31','6:47','6:55','6:59','7:15','7:23','7:27','7:29','7:30','7:39','7:43','7:45','7:46','7:51','7:53','7:54','7:57','7:58','9:31','9:47','9:55','9:59','10:31','10:47','10:55','10:59','11:15','11:23','11:27','11:29','11:30','11:39','11:43','11:45','11:46','11:51','11:53','11:54','11:57','11:58']", - "['7:31','7:47','7:55','7:59','11:31','11:47','11:55','11:59']", - "[]" - ], - "boilerplate": { - "python": "class Solution:\n def readBinaryWatch(self, turnedOn: int) -> List[str]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List readBinaryWatch(int turnedOn) {\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector readBinaryWatch(int turnedOn) {\n \n }\n};" - }, - "compare_func": { - "python": "def sorted_list_strings(lst):\n return sorted([str(x) for x in eval(lst)])\n return sorted(result) == sorted_list_strings(expected)", - "java": "boolean compareFunction(String result, String expected) {\n String[] expectedList = evalStrings(expected);\n String[] resultList = evalStrings(result);\n \n Arrays.sort(expectedList);\n Arrays.sort(resultList);\n \n return Arrays.equals(resultList, expectedList);\n}\n\nString[] evalStrings(String input) {\n String parsed = input.replaceAll(\"[\\[\\]\\\"]\", \"\");\n return parsed.split(\", ?\");\n}", - "cpp": "std::vector sortedListStrings(const std::string &lst) {\n // Assuming the input is a properly formatted string representation of a list\n std::stringstream ss(lst);\n std::string token;\n std::vector result; \n \n while(std::getline(ss, token, ',')) {\n // Remove potential leading/trailing spaces and quotes\n token.erase(std::remove_if(token.begin(), token.end(), ::isspace), token.end());\n token.erase(std::remove(token.begin(), token.end(), '\"'), token.end());\n token.erase(std::remove(token.begin(), token.end(), '\\\n'), token.end());\n result.push_back(token);\n }\n \n std::sort(result.begin(), result.end());\n return result;\n}\n\nstd::vector sortedList(const std::vector &lst) {\n std::vector result = lst;\n std::sort(result.begin(), result.end());\n return result;\n}\n\nbool compareFunction(const std::vector &result, const std::string &expected) {\n return sortedList(result) == sortedListStrings(expected);\n}" - }, - "explanation": "https://www.youtube.com/watch?v=0BanwDe6cMY&pp=ygUVTmVldENvZGUgQmluYXJ5IFdhdGNo", - "method_name": "readBinaryWatch" - }, - { - "title": "Convert a Number to Hexadecimal", - "source": "https://leetcode.com/problems/convert-a-number-to-hexadecimal/", - "description": "

Given a 32-bit integer num, return a string representing its hexadecimal representation. For negative integers, two’s complement method is used.

\n\n

All the letters in the answer string should be lowercase characters, and there should not be any leading zeros in the answer except for the zero itself.

\n\n

Note: You are not allowed to use any built-in library method to directly solve this problem.

\n\n

 

\n

Example 1:

\n
Input: num = 26\nOutput: \"1a\"\n

Example 2:

\n
Input: num = -1\nOutput: \"ffffffff\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= num <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=26", - "--arg1=-1", - "--arg1=0" - ], - "sample_test_results": [ - "'1a'", - "'ffffffff'", - "'0'" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=16", - "--arg1=26", - "--arg1=-1", - "--arg1=2147483647", - "--arg1=-2147483648", - "--arg1=100", - "--arg1=-100", - "--arg1=255", - "--arg1=-255" - ], - "hidden_test_results": [ - "'0'", - "'10'", - "'1a'", - "'ffffffff'", - "'7fffffff'", - "'80000000'", - "'64'", - "'ffffff9c'", - "'ff'", - "'ffffff01'" - ], - "boilerplate": { - "python": "class Solution:\n def toHex(self, num: int) -> str:\n ", - "java": "class Solution {\n public String toHex(int num) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string toHex(int num) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "try {\n return result == std::stod(expected);\n} catch (const std::invalid_argument& e) {\n return false;\n}\ncatch (const std::out_of_range& e) {\n return false;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=I1HBykyZvbc&pp=ygUoTmVldENvZGUgQ29udmVydCBhIE51bWJlciB0byBIZXhhZGVjaW1hbA%3D%3D", - "method_name": "toHex" - }, - { - "title": "Longest Palindrome", - "source": "https://leetcode.com/problems/longest-palindrome/", - "description": "

Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.

\n\n

Letters are case sensitive, for example, "Aa" is not considered a palindrome.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abccccdd"\nOutput: 7\nExplanation: One longest palindrome that can be built is "dccaccd", whose length is 7.\n
\n\n

Example 2:

\n\n
\nInput: s = "a"\nOutput: 1\nExplanation: The longest palindrome that can be built is "a", whose length is 1.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 2000
  • \n\t
  • s consists of lowercase and/or uppercase English letters only.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='abccccdd'", - "--arg1='a'", - "--arg1='Aa'" - ], - "sample_test_results": [ - "7", - "1", - "1" - ], - "hidden_test_cases": [ - "--arg1='racecar'", - "--arg1='aaaaaa'", - "--arg1='abcde'", - "--arg1='AAaa'", - "--arg1='aA'", - "--arg1='z'", - "--arg1='abccba'", - "--arg1='aaabbbcccc'", - "--arg1='abcABC'", - "--arg1=''" - ], - "hidden_test_results": [ - "7", - "6", - "1", - "4", - "1", - "1", - "6", - "9", - "1", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def longestPalindrome(self, s: str) -> int:\n ", - "java": "class Solution {\n public int longestPalindrome(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int longestPalindrome(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=_g9jrLuAphs&pp=ygUbTmVldENvZGUgTG9uZ2VzdCBQYWxpbmRyb21l", - "method_name": "longestPalindrome" - }, - { - "title": "Add Strings", - "source": "https://leetcode.com/problems/add-strings/", - "description": "

Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string.

\n\n

You must solve the problem without using any built-in library for handling large integers (such as BigInteger). You must also not convert the inputs to integers directly.

\n\n

 

\n

Example 1:

\n\n
\nInput: num1 = "11", num2 = "123"\nOutput: "134"\n
\n\n

Example 2:

\n\n
\nInput: num1 = "456", num2 = "77"\nOutput: "533"\n
\n\n

Example 3:

\n\n
\nInput: num1 = "0", num2 = "0"\nOutput: "0"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num1.length, num2.length <= 104
  • \n\t
  • num1 and num2 consist of only digits.
  • \n\t
  • num1 and num2 don't have any leading zeros except for the zero itself.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='11' --arg2='123'", - "--arg1='456' --arg2='77'", - "--arg1='0' --arg2='0'" - ], - "sample_test_results": [ - "'134'", - "'533'", - "'0'" - ], - "hidden_test_cases": [ - "--arg1='9' --arg2='1'", - "--arg1='999' --arg2='1'", - "--arg1='1' --arg2='999'", - "--arg1='0' --arg2='1'", - "--arg1='1' --arg2='0'", - "--arg1='999999' --arg2='1'", - "--arg1='123' --arg2='456'", - "--arg1='1000' --arg2='2000'", - "--arg1='9999' --arg2='9999'", - "--arg1='1111' --arg2='9999'" - ], - "hidden_test_results": [ - "'10'", - "'1000'", - "'1000'", - "'1'", - "'1'", - "'1000000'", - "'579'", - "'3000'", - "'19998'", - "'11110'" - ], - "boilerplate": { - "python": "class Solution:\n def addStrings(self, num1: str, num2: str) -> str:\n ", - "java": "class Solution {\n public String addStrings(String num1, String num2) {\n // Implementation will go here\n return null;\n }\n}", - "cpp": "class Solution {\npublic:\n string addStrings(string num1, string num2) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == eval(expected)", - "java": "return result.toString().equals(String.valueOf(eval(expected)));", - "cpp": "#include \n\ncompareFunction(const std::string &result, const std::string &expected) {\n return result == expected;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=jziDtPZJ4fw&pp=ygUUTmVldENvZGUgQWRkIFN0cmluZ3M%3D", - "method_name": "addStrings" - }, - { - "title": "Arranging Coins", - "source": "https://leetcode.com/problems/arranging-coins/", - "description": "

You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete.

\n\n

Given the integer n, return the number of complete rows of the staircase you will build.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: n = 5\nOutput: 2\nExplanation: Because the 3rd row is incomplete, we return 2.\n
\n\n

Example 2:

\n\"\"\n
\nInput: n = 8\nOutput: 3\nExplanation: Because the 4th row is incomplete, we return 3.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=5", - "--arg1=8", - "--arg1=1" - ], - "sample_test_results": [ - "2", - "3", - "1" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=3", - "--arg1=10", - "--arg1=15", - "--arg1=21", - "--arg1=100", - "--arg1=1000", - "--arg1=10000", - "--arg1=2147483647", - "--arg1=6" - ], - "hidden_test_results": [ - "0", - "2", - "4", - "5", - "6", - "13", - "44", - "140", - "65535", - "3" - ], - "boilerplate": { - "python": "class Solution:\n def arrangeCoins(self, n: int) -> int:\n ", - "java": "class Solution {\n public int arrangeCoins(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int arrangeCoins(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.valueOf(result).equals(Integer.valueOf(expected));", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=5rHz_6s2Buw&pp=ygUYTmVldENvZGUgQXJyYW5naW5nIENvaW5z", - "method_name": "arrangeCoins" - }, - { - "title": "Assign Cookies", - "source": "https://leetcode.com/problems/assign-cookies/", - "description": "

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.

\n\n

Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and each cookie j has a size s[j]. If s[j] >= g[i], we can assign the cookie j to the child i, and the child i will be content. Your goal is to maximize the number of your content children and output the maximum number.

\n\n

 

\n

Example 1:

\n\n
\nInput: g = [1,2,3], s = [1,1]\nOutput: 1\nExplanation: You have 3 children and 2 cookies. The greed factors of 3 children are 1, 2, 3. \nAnd even though you have 2 cookies, since their size is both 1, you could only make the child whose greed factor is 1 content.\nYou need to output 1.\n
\n\n

Example 2:

\n\n
\nInput: g = [1,2], s = [1,2,3]\nOutput: 2\nExplanation: You have 2 children and 3 cookies. The greed factors of 2 children are 1, 2. \nYou have 3 cookies and their sizes are big enough to gratify all of the children, \nYou need to output 2.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= g.length <= 3 * 104
  • \n\t
  • 0 <= s.length <= 3 * 104
  • \n\t
  • 1 <= g[i], s[j] <= 231 - 1
  • \n
\n\n

 

\n

Note: This question is the same as 2410: Maximum Matching of Players With Trainers.

\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=[1,2,3] --arg2=[1,1]", - "--arg1=[1,2] --arg2=[1,2,3]", - "--arg1=[1,2,3] --arg2=[]" - ], - "sample_test_results": [ - "1", - "2", - "0" - ], - "hidden_test_cases": [ - "--arg1=[] --arg2=[1,2,3]", - "--arg1=[1,2] --arg2=[1]", - "--arg1=[2] --arg2=[1]", - "--arg1=[1,2,3] --arg2=[1,2,3]", - "--arg1=[10,9,8,7] --arg2=[5,6,7,8]", - "--arg1=[1,1,1] --arg2=[1,1,1]", - "--arg1=[2,3,4,5] --arg2=[1,2,3]", - "--arg1=[1] --arg2=[2]", - "--arg1=[3,4,5] --arg2=[1,2]", - "--arg1=[1,2,3] --arg2=[3]" - ], - "hidden_test_results": [ - "0", - "1", - "0", - "3", - "2", - "3", - "2", - "1", - "0", - "1" - ], - "boilerplate": { - "python": "class Solution:\n def findContentChildren(self, g: List[int], s: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int findContentChildren(List g, List s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int findContentChildren(vector& g, vector& s) {\n\n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=JW8fgvoxPTg&pp=ygUXTmVldENvZGUgQXNzaWduIENvb2tpZXM%3D", - "method_name": "findContentChildren" - }, - { - "title": "Repeated Substring Pattern", - "source": "https://leetcode.com/problems/repeated-substring-pattern/", - "description": "

Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abab"\nOutput: true\nExplanation: It is the substring "ab" twice.\n
\n\n

Example 2:

\n\n
\nInput: s = "aba"\nOutput: false\n
\n\n

Example 3:

\n\n
\nInput: s = "abcabcabcabc"\nOutput: true\nExplanation: It is the substring "abc" four times or the substring "abcabc" twice.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of lowercase English letters.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='abab'", - "--arg1='aba'", - "--arg1='abcabcabcabc'" - ], - "sample_test_results": [ - "true", - "false", - "true" - ], - "hidden_test_cases": [ - "--arg1=''", - "--arg1='a'", - "--arg1='aa'", - "--arg1='aaa'", - "--arg1='aabaaba'", - "--arg1='abaababaab'", - "--arg1='aaaaa'", - "--arg1='abcabc'", - "--arg1='abcabcabc'", - "--arg1='abac'" - ], - "hidden_test_results": [ - "true", - "false", - "true", - "true", - "false", - "true", - "true", - "true", - "true", - "false" - ], - "boilerplate": { - "python": "class Solution:\n def repeatedSubstringPattern(self, s: str) -> bool:\n ", - "java": "class Solution {\n public boolean repeatedSubstringPattern(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool repeatedSubstringPattern(std::string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.equalsIgnoreCase(expected);", - "cpp": "return result.size() == expected.size() && std::equal(result.begin(), result.end(), expected.begin(), [](char a, char b) { return std::tolower(a) == std::tolower(b); });" - }, - "explanation": "https://www.youtube.com/watch?v=2qEmA76Unm4&pp=ygUjTmVldENvZGUgUmVwZWF0ZWQgU3Vic3RyaW5nIFBhdHRlcm4%3D", - "method_name": "repeatedSubstringPattern" - }, - { - "title": "License Key Formatting", - "source": "https://leetcode.com/problems/license-key-formatting/", - "description": "

You are given a license key represented as a string s that consists of only alphanumeric characters and dashes. The string is separated into n + 1 groups by n dashes. You are also given an integer k.

\n\n

We want to reformat the string s such that each group contains exactly k characters, except for the first group, which could be shorter than k but still must contain at least one character. Furthermore, there must be a dash inserted between two groups, and you should convert all lowercase letters to uppercase.

\n\n

Return the reformatted license key.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "5F3Z-2e-9-w", k = 4\nOutput: "5F3Z-2E9W"\nExplanation: The string s has been split into two parts, each part has 4 characters.\nNote that the two extra dashes are not needed and can be removed.\n
\n\n

Example 2:

\n\n
\nInput: s = "2-5g-3-J", k = 2\nOutput: "2-5G-3J"\nExplanation: The string s has been split into three parts, each part has 2 characters except the first part as it could be shorter as mentioned above.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 105
  • \n\t
  • s consists of English letters, digits, and dashes '-'.
  • \n\t
  • 1 <= k <= 104
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1='5F3Z-2e-9-w' --arg2=4", - "--arg1='2-5g-3-J' --arg2=2" - ], - "sample_test_results": [ - "'5F3Z-2E9W'", - "'2-5G-3J'" - ], - "hidden_test_cases": [ - "--arg1='a-a-a-a-' --arg2=1", - "--arg1='---' --arg2=3", - "--arg1='2' --arg2=2", - "--arg1='r' --arg2=1", - "--arg1='5F3Z-2e-9-w-a-b-c-d' --arg2=4", - "--arg1='2-5g-3-J-k-L' --arg2=3", - "--arg1='a-b-c' --arg2=3", - "--arg1='12345' --arg2=1", - "--arg1='ABCD' --arg2=2", - "--arg1='a-1-B-2' --arg2=2" - ], - "hidden_test_results": [ - "'A-A-A-A'", - "''", - "'2'", - "'R'", - "'5F3Z-2E9W-ABCD'", - "'2-5G3-JKL'", - "'ABC'", - "'1-2-3-4-5'", - "'AB-CD'", - "'A1-B2'" - ], - "boilerplate": { - "python": "class Solution:\n def licenseKeyFormatting(self, s: str, k: int) -> str:\n ", - "java": "class Solution {\n public String licenseKeyFormatting(String s, int k) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string licenseKeyFormatting(string s, int k) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=3KMlpe8eZ0E&pp=ygUfTmVldENvZGUgTGljZW5zZSBLZXkgRm9ybWF0dGluZw%3D%3D", - "method_name": "licenseKeyFormatting" - }, - { - "title": "Construct the Rectangle", - "source": "https://leetcode.com/problems/construct-the-rectangle/", - "description": "

A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:

\n\n
    \n\t
  1. The area of the rectangular web page you designed must equal to the given target area.
  2. \n\t
  3. The width W should not be larger than the length L, which means L >= W.
  4. \n\t
  5. The difference between length L and width W should be as small as possible.
  6. \n
\n\n

Return an array [L, W] where L and W are the length and width of the web page you designed in sequence.

\n\n

 

\n

Example 1:

\n\n
\nInput: area = 4\nOutput: [2,2]\nExplanation: The target area is 4, and all the possible ways to construct it are [1,4], [2,2], [4,1]. \nBut according to requirement 2, [1,4] is illegal; according to requirement 3,  [4,1] is not optimal compared to [2,2]. So the length L is 2, and the width W is 2.\n
\n\n

Example 2:

\n\n
\nInput: area = 37\nOutput: [37,1]\n
\n\n

Example 3:

\n\n
\nInput: area = 122122\nOutput: [427,286]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= area <= 107
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=4", - "--arg1=37", - "--arg1=122122" - ], - "sample_test_results": [ - "[2,2]", - "[37,1]", - "[427,286]" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=9", - "--arg1=16", - "--arg1=24", - "--arg1=100", - "--arg1=1000", - "--arg1=10000", - "--arg1=99999", - "--arg1=1000000", - "--arg1=9999999" - ], - "hidden_test_results": [ - "[1,1]", - "[3,3]", - "[4,4]", - "[6,4]", - "[10,10]", - "[40,25]", - "[100,100]", - "[369,271]", - "[1000,1000]", - "[4649,2151]" - ], - "boilerplate": { - "python": "class Solution:\n def constructRectangle(self, area: int) -> List[int]:\n ", - "java": "import java.util.*;\n\nclass Solution {\n public List constructRectangle(int area) {\n List result = new ArrayList<>();\n // Placeholder for the implementation\n return result;\n }\n}", - "cpp": "class Solution {\npublic:\n std::vector constructRectangle(int area) {\n \n }\n};" - }, - "compare_func": { - "python": "expected = eval(expected); return result[0]*result[1] == expected[0]*expected[1] and result[0] >= result[1] and abs(result[0]-result[1]) <= abs(expected[0]-expected[1])", - "java": "return (result[0] * result[1] == expected[0] * expected[1]) && (result[0] >= result[1]) && (Math.abs(result[0] - result[1]) <= Math.abs(expected[0] - expected[1]));", - "cpp": "int expectedValue = std::stoi(expected);\nreturn (result[0] * result[1] == expected[0] * expected[1]) && (result[0] >= result[1]) && (std::abs(result[0] - result[1]) <= std::abs(expected[0] - expected[1]));" - }, - "explanation": "https://www.youtube.com/watch?v=-Lb4SvVyPCM&pp=ygUgTmVldENvZGUgQ29uc3RydWN0IHRoZSBSZWN0YW5nbGU%3D", - "method_name": "constructRectangle" - }, - { - "title": "Teemo Attacking", - "source": "https://leetcode.com/problems/teemo-attacking/", - "description": "

Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly duration seconds. More formally, an attack at second t will mean Ashe is poisoned during the inclusive time interval [t, t + duration - 1]. If Teemo attacks again before the poison effect ends, the timer for it is reset, and the poison effect will end duration seconds after the new attack.

\n\n

You are given a non-decreasing integer array timeSeries, where timeSeries[i] denotes that Teemo attacks Ashe at second timeSeries[i], and an integer duration.

\n\n

Return the total number of seconds that Ashe is poisoned.

\n\n

 

\n

Example 1:

\n\n
\nInput: timeSeries = [1,4], duration = 2\nOutput: 4\nExplanation: Teemo's attacks on Ashe go as follows:\n- At second 1, Teemo attacks, and Ashe is poisoned for seconds 1 and 2.\n- At second 4, Teemo attacks, and Ashe is poisoned for seconds 4 and 5.\nAshe is poisoned for seconds 1, 2, 4, and 5, which is 4 seconds in total.\n
\n\n

Example 2:

\n\n
\nInput: timeSeries = [1,2], duration = 2\nOutput: 3\nExplanation: Teemo's attacks on Ashe go as follows:\n- At second 1, Teemo attacks, and Ashe is poisoned for seconds 1 and 2.\n- At second 2 however, Teemo attacks again and resets the poison timer. Ashe is poisoned for seconds 2 and 3.\nAshe is poisoned for seconds 1, 2, and 3, which is 3 seconds in total.
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= timeSeries.length <= 104
  • \n\t
  • 0 <= timeSeries[i], duration <= 107
  • \n\t
  • timeSeries is sorted in non-decreasing order.
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=[1,4] --arg2=2", - "--arg1=[1,2] --arg2=2" - ], - "sample_test_results": [ - "4", - "3" - ], - "hidden_test_cases": [ - "--arg1=[1] --arg2=1", - "--arg1=[1,2,3,4,5] --arg2=1", - "--arg1=[1,3,5,7,9] --arg2=3", - "--arg1=[1,2,3,4,5] --arg2=5", - "--arg1=[1,10,20,30] --arg2=5", - "--arg1=[1,2,3,100] --arg2=2", - "--arg1=[1,1,1,1] --arg2=2", - "--arg1=[0,1,2] --arg2=1", - "--arg1=[1,5,10] --arg2=2", - "--arg1=[1,3] --arg2=3" - ], - "hidden_test_results": [ - "1", - "5", - "11", - "9", - "20", - "6", - "2", - "3", - "6", - "5" - ], - "boilerplate": { - "python": "class Solution:\n def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:\n ", - "java": "class Solution {\n public int findPoisonedDuration(List timeSeries, int duration) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int findPoisonedDuration(vector& timeSeries, int duration) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=NejSCTIdd5k&pp=ygUYTmVldENvZGUgVGVlbW8gQXR0YWNraW5n", - "method_name": "findPoisonedDuration" - }, - { - "title": "Base 7", - "source": "https://leetcode.com/problems/base-7/", - "description": "

Given an integer num, return a string of its base 7 representation.

\n\n

 

\n

Example 1:

\n
Input: num = 100\nOutput: \"202\"\n

Example 2:

\n
Input: num = -7\nOutput: \"-10\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -107 <= num <= 107
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=100", - "--arg1=-7" - ], - "sample_test_results": [ - "'202'", - "'-10'" - ], - "hidden_test_cases": [ - "--arg1=0", - "--arg1=7", - "--arg1=-49", - "--arg1=1000000", - "--arg1=-1000000", - "--arg1=1", - "--arg1=-1", - "--arg1=49", - "--arg1=999999", - "--arg1=-999999" - ], - "hidden_test_results": [ - "'0'", - "'10'", - "'-100'", - "'11333311'", - "'-11333311'", - "'1'", - "'-1'", - "'100'", - "'11333310'", - "'-11333310'" - ], - "boilerplate": { - "python": "class Solution:\n def convertToBase7(self, num: int) -> str:\n ", - "java": "class Solution {\n public String convertToBase7(int num) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::string convertToBase7(int num) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "return result == std::stod(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=sbmq-efwOsA&pp=ygUPTmVldENvZGUgQmFzZSA3", - "method_name": "convertToBase7" - }, - { - "title": "Perfect Number", - "source": "https://leetcode.com/problems/perfect-number/", - "description": "

A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. A divisor of an integer x is an integer that can divide x evenly.

\n\n

Given an integer n, return true if n is a perfect number, otherwise return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = 28\nOutput: true\nExplanation: 28 = 1 + 2 + 4 + 7 + 14\n1, 2, 4, 7, and 14 are all divisors of 28.\n
\n\n

Example 2:

\n\n
\nInput: num = 7\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num <= 108
  • \n
\n", - "difficulty": "easy", - "sample_test_cases": [ - "--arg1=28", - "--arg1=7" - ], - "sample_test_results": [ - "true", - "false" - ], - "hidden_test_cases": [ - "--arg1=1", - "--arg1=6", - "--arg1=496", - "--arg1=8128", - "--arg1=33550336", - "--arg1=12", - "--arg1=100", - "--arg1=1000", - "--arg1=10000", - "--arg1=100000" - ], - "hidden_test_results": [ - "false", - "true", - "true", - "true", - "true", - "false", - "false", - "false", - "false", - "false" - ], - "boilerplate": { - "python": "class Solution:\n def checkPerfectNumber(self, num: int) -> bool:\n ", - "java": "class Solution {\n public boolean checkPerfectNumber(int num) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool checkPerfectNumber(int num) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::tolower(result) == std::tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=HLZLwjzIVGo&pp=ygUXTmVldENvZGUgUGVyZmVjdCBOdW1iZXI%3D", - "method_name": "checkPerfectNumber" - }, - { - "title": "Zigzag Conversion", - "source": "https://leetcode.com/problems/zigzag-conversion/", - "description": "

The string "PAYPALISHIRING" 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)

\n\n
\nP   A   H   N\nA P L S I I G\nY   I   R\n
\n\n

And then read line by line: "PAHNAPLSIIGYIR"

\n\n

Write the code that will take a string and make this conversion given a number of rows:

\n\n
\nstring convert(string s, int numRows);\n
\n\n

 

\n

Example 1:

\n\n
\nInput: s = "PAYPALISHIRING", numRows = 3\nOutput: "PAHNAPLSIIGYIR"\n
\n\n

Example 2:

\n\n
\nInput: s = "PAYPALISHIRING", numRows = 4\nOutput: "PINALSIGYAHRPI"\nExplanation:\nP     I    N\nA   L S  I G\nY A   H R\nP     I\n
\n\n

Example 3:

\n\n
\nInput: s = "A", numRows = 1\nOutput: "A"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 1000
  • \n\t
  • s consists of English letters (lower-case and upper-case), ',' and '.'.
  • \n\t
  • 1 <= numRows <= 1000
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1='PAYPALISHIRING' --arg2=3", - "--arg1='PAYPALISHIRING' --arg2=4", - "--arg1='A' --arg2=1" - ], - "sample_test_results": [ - "'PAHNAPLSIIGYIR'", - "'PINALSIGYAHRPI'", - "'A'" - ], - "hidden_test_cases": [ - "--arg1='ABCDEF' --arg2=2", - "--arg1='HELLO' --arg2=1", - "--arg1='WORLD' --arg2=5", - "--arg1='TEST.TEST' --arg2=3", - "--arg1='A --arg2=B --arg3=C' --arg4=2", - "--arg1='abcdefghijklmnop' --arg2=4", - "--arg1='ANTHROPIC' --arg2=3", - "--arg1='Testing123' --arg2=2", - "--arg1='' --arg2=1", - "--arg1='AB' --arg2=1" - ], - "hidden_test_results": [ - "'ACEBDF'", - "'HELLO'", - "'WORLD'", - "'T.TETTSSE'", - "'ABC,,'", - "'agmbfhlnceikodjp'", - "'ARCNHOITP'", - "'Tsig2etn13'", - "''", - "'AB'" - ], - "boilerplate": { - "python": "class Solution:\n def convert(self, s: str, numRows: int) -> str:\n ", - "java": "class Solution {\n public String convert(String s, int numRows) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::string convert(std::string s, int numRows) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stol(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=Q2Tw6gcVEwc&pp=ygUaTmVldENvZGUgWmlnemFnIENvbnZlcnNpb24%3D", - "method_name": "convert" - }, - { - "title": "Container With Most Water", - "source": "https://leetcode.com/problems/container-with-most-water/", - "description": "

You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).

\n\n

Find two lines that together with the x-axis form a container, such that the container contains the most water.

\n\n

Return the maximum amount of water a container can store.

\n\n

Notice that you may not slant the container.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: height = [1,8,6,2,5,4,8,3,7]\nOutput: 49\nExplanation: The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49.\n
\n\n

Example 2:

\n\n
\nInput: height = [1,1]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == height.length
  • \n\t
  • 2 <= n <= 105
  • \n\t
  • 0 <= height[i] <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[1,8,6,2,5,4,8,3,7]", - "--arg1=[1,1]" - ], - "sample_test_results": [ - "49", - "1" - ], - "hidden_test_cases": [ - "--arg1=[4,3,2,1,4]", - "--arg1=[1,2,4,3]", - "--arg1=[1,2]", - "--arg1=[1,1,1]", - "--arg1=[2,3,4,5,18,17,6]", - "--arg1=[1,8,100,2,100,4,8,3,7]", - "--arg1=[1,2,3,4,5,6]", - "--arg1=[6,5,4,3,2,1]", - "--arg1=[0,0]", - "--arg1=[10000,1]" - ], - "hidden_test_results": [ - "16", - "4", - "1", - "2", - "17", - "200", - "9", - "9", - "0", - "1" - ], - "boilerplate": { - "python": "class Solution:\n def maxArea(self, height: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int maxArea(List height) {\n\n }\n}", - "cpp": "class Solution {\npublic:\n int maxArea(vector& height) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=UuiTKBwPgAo&pp=ygUiTmVldENvZGUgQ29udGFpbmVyIFdpdGggTW9zdCBXYXRlcg%3D%3D", - "method_name": "maxArea" - }, - { - "title": "3Sum Closest", - "source": "https://leetcode.com/problems/3sum-closest/", - "description": "

Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target.

\n\n

Return the sum of the three integers.

\n\n

You may assume that each input would have exactly one solution.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [-1,2,1,-4], target = 1\nOutput: 2\nExplanation: The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,0,0], target = 1\nOutput: 0\nExplanation: The sum that is closest to the target is 0. (0 + 0 + 0 = 0).\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 3 <= nums.length <= 500
  • \n\t
  • -1000 <= nums[i] <= 1000
  • \n\t
  • -104 <= target <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[-1,2,1,-4] --arg2=1", - "--arg1=[0,0,0] --arg2=1" - ], - "sample_test_results": [ - "2", - "0" - ], - "hidden_test_cases": [ - "--arg1=[1,1,1,0] --arg2=100", - "--arg1=[-1,0,1,2,3] --arg2=1", - "--arg1=[0,0,0,0] --arg2=1", - "--arg1=[-5,-4,-3,-2,-1] --arg2=0", - "--arg1=[1,2,3,4,5] --arg2=10", - "--arg1=[-1,-2,-3,1,2,3] --arg2=0", - "--arg1=[1,1,-1,-1,3] --arg2=-1", - "--arg1=[-100,-50,0,50,100] --arg2=23", - "--arg1=[-1,2,1,-4,3,-3] --arg2=0", - "--arg1=[-1000,1000,1000] --arg2=100" - ], - "hidden_test_results": [ - "3", - "1", - "0", - "-6", - "10", - "0", - "-1", - "0", - "0", - "1000" - ], - "boilerplate": { - "python": "class Solution:\n def threeSumClosest(self, nums: List[int], target: int) -> int:\n ", - "java": "class Solution {\n public int threeSumClosest(int[] nums, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int threeSumClosest(vector& nums, int target) {\n return 0;\n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=PXWT4wzkA6M&pp=ygUVTmVldENvZGUgM1N1bSBDbG9zZXN0", - "method_name": "threeSumClosest" - }, - { - "title": "Search in Rotated Sorted Array", - "source": "https://leetcode.com/problems/search-in-rotated-sorted-array/", - "description": "

There is an integer array nums sorted in ascending order (with distinct values).

\n\n

Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2].

\n\n

Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n
Input: nums = [4,5,6,7,0,1,2], target = 0\nOutput: 4\n

Example 2:

\n
Input: nums = [4,5,6,7,0,1,2], target = 3\nOutput: -1\n

Example 3:

\n
Input: nums = [1], target = 0\nOutput: -1\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 5000
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • All values of nums are unique.
  • \n\t
  • nums is an ascending array that is possibly rotated.
  • \n\t
  • -104 <= target <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[4,5,6,7,0,1,2] --arg2=0", - "--arg1=[4,5,6,7,0,1,2] --arg2=3", - "--arg1=[1] --arg2=0" - ], - "sample_test_results": [ - "4", - "-1", - "-1" - ], - "hidden_test_cases": [ - "--arg1=[3,1] --arg2=1", - "--arg1=[1,3,5] --arg2=3", - "--arg1=[5,1,2,3,4] --arg2=1", - "--arg1=[4,5,6,7,0,1,2] --arg2=5", - "--arg1=[1] --arg2=1", - "--arg1=[1,3] --arg2=3", - "--arg1=[3,5,1] --arg2=3", - "--arg1=[5,1,3] --arg2=5", - "--arg1=[4,5,6,7,8,1,2,3] --arg2=8", - "--arg1=[1,2,3,4,5] --arg2=6" - ], - "hidden_test_results": [ - "1", - "1", - "1", - "1", - "0", - "1", - "0", - "0", - "4", - "-1" - ], - "boilerplate": { - "python": "class Solution:\n def search(self, nums: List[int], target: int) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int search(List nums, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int search(vector& nums, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == int(expected)", - "java": "return Integer.valueOf(result).equals(Integer.valueOf(expected));", - "cpp": "return result == static_cast(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=U8XENwh8Oy8&pp=ygUnTmVldENvZGUgU2VhcmNoIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5", - "method_name": "search" - }, - { - "title": "Find First and Last Position of Element in Sorted Array", - "source": "https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/", - "description": "

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.

\n\n

If target is not found in the array, return [-1, -1].

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n
Input: nums = [5,7,7,8,8,10], target = 8\nOutput: [3,4]\n

Example 2:

\n
Input: nums = [5,7,7,8,8,10], target = 6\nOutput: [-1,-1]\n

Example 3:

\n
Input: nums = [], target = 0\nOutput: [-1,-1]\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • nums is a non-decreasing array.
  • \n\t
  • -109 <= target <= 109
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[5,7,7,8,8,10] --arg2=8", - "--arg1=[5,7,7,8,8,10] --arg2=6", - "--arg1=[] --arg2=0" - ], - "sample_test_results": [ - "(3, 4)", - "(-1, -1)", - "(-1, -1)" - ], - "hidden_test_cases": [ - "--arg1=[1] --arg2=1", - "--arg1=[1,1,1,1] --arg2=1", - "--arg1=[1,2,3,4,5] --arg2=3", - "--arg1=[1,2,2,3,4,4,4] --arg2=4", - "--arg1=[1,1,2] --arg2=2", - "--arg1=[1] --arg2=2", - "--arg1=[1,2,3] --arg2=4", - "--arg1=[1,1,1,2,2,3] --arg2=2", - "--arg1=[1,2,3,3,3,4,5] --arg2=3", - "--arg1=[1,2,3,4,5,5,5,5,6] --arg2=5" - ], - "hidden_test_results": [ - "(0, 0)", - "(0, 3)", - "(2, 2)", - "(4, 6)", - "(2, 2)", - "(-1, -1)", - "(-1, -1)", - "(3, 4)", - "(2, 4)", - "(4, 7)" - ], - "boilerplate": { - "python": "class Solution:\n def searchRange(self, nums: List[int], target: int) -> List[int]:\n ", - "java": "class Solution {\n public int[] searchRange(int[] nums, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n vector searchRange(vector& nums, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "Object eval(String expression);\n\nObject resultVal = eval(result);\nObject expectedVal = eval(expected);\nreturn resultVal.equals(expectedVal);", - "cpp": "try {\n return result == std::stoi(expected);\n} catch (std::invalid_argument& e) {\n return false;\n} catch (std::out_of_range& e) {\n return false;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=4sQL7R5ySUU&pp=ygVATmVldENvZGUgRmluZCBGaXJzdCBhbmQgTGFzdCBQb3NpdGlvbiBvZiBFbGVtZW50IGluIFNvcnRlZCBBcnJheQ%3D%3D", - "method_name": "searchRange" - }, - { - "title": "Count and Say", - "source": "https://leetcode.com/problems/count-and-say/", - "description": "

The count-and-say sequence is a sequence of digit strings defined by the recursive formula:

\n\n
    \n\t
  • countAndSay(1) = "1"
  • \n\t
  • countAndSay(n) is the run-length encoding of countAndSay(n - 1).
  • \n
\n\n

Run-length encoding (RLE) is a string compression method that works by replacing consecutive identical characters (repeated 2 or more times) with the concatenation of the character and the number marking the count of the characters (length of the run). For example, to compress the string "3322251" we replace "33" with "23", replace "222" with "32", replace "5" with "15" and replace "1" with "11". Thus the compressed string becomes "23321511".

\n\n

Given a positive integer n, return the nth element of the count-and-say sequence.

\n\n

 

\n

Example 1:

\n\n
\n

Input: n = 4

\n\n

Output: "1211"

\n\n

Explanation:

\n\n
\ncountAndSay(1) = "1"\ncountAndSay(2) = RLE of "1" = "11"\ncountAndSay(3) = RLE of "11" = "21"\ncountAndSay(4) = RLE of "21" = "1211"\n
\n
\n\n

Example 2:

\n\n
\n

Input: n = 1

\n\n

Output: "1"

\n\n

Explanation:

\n\n

This is the base case.

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 30
  • \n
\n\n

 

\nFollow up: Could you solve it iteratively?", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=4", - "--arg1=1", - "--arg1=5" - ], - "sample_test_results": [ - "'1211'", - "'1'", - "'111221'" - ], - "hidden_test_cases": [ - "--arg1=2", - "--arg1=3", - "--arg1=6", - "--arg1=7", - "--arg1=8", - "--arg1=9", - "--arg1=10", - "--arg1=15", - "--arg1=20", - "--arg1=30" - ], - "hidden_test_results": [ - "'11'", - "'21'", - "'312211'", - "'13112221'", - "'1113213211'", - "'31131211131221'", - "'13211311123113112211'", - "'311311222113111231131112132112311321322112111312211312111322212311322113212221'", - "'11131221131211132221232112111312111213111213211231132132211211131221131211221321123113213221123113112221131112311332211211131221131211132211121312211231131112311211232221121321132132211331121321231231121113112221121321133112132112312321123113112221121113122113121113123112112322111213211322211312113211'", - "'3113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112212211131221121321131211132221123113112221131112311332211211133112111311222112111312211311123113322112111312211312111322212321121113121112133221121321132132211331121321132213211231132132211211131221232112111312212221121123222112311311222113111231133211121321321122111312211312111322211213211321322123211211131211121332211231131122211311123113321112131221123113111231121123222112111331121113112221121113122113111231133221121113122113121113221112131221123113111231121123222112111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321132132211322132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211322113321132211221121332211231131122211311123113321112131221123113111231121113311211131221121321131211132221123113112211121312211231131122211211133112111311222112111312211312111322211213211321223112111311222112132113213221133122211311221122111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321132132211322132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211322113321132211221121332211213211321322113311213212312311211131122211213211331121321123123211231131122211211131221131112311332211213211321223112111311222112132113213221123123211231132132211231131122211311123113322112111312211312111322111213122112311311123112112322211213211321322113312211223113112221121113122113111231133221121321132132211331222113321112131122211332113221122112133221123113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112311332111213122112311311123112112322211322311311222113111231133211121312211231131112311211232221121113122113121113222123211211131221132211131221121321131211132221123113112211121312211231131122113221122112133221121321132132211331121321231231121113121113122122311311222113111231133221121113122113121113221112131221123113111231121123222112132113213221133112132123123112111312211322311211133112111312211213211311123113223112111321322123122113222122211211232221121113122113121113222123211211131211121311121321123113213221121113122123211211131221121311121312211213211321322112311311222113311213212322211211131221131211221321123113213221121113122113121113222112131112131221121321131211132221121321132132211331121321232221123113112221131112311322311211131122211213211331121321122112133221121113122113121113222123112221221321132132211231131122211331121321232221121113122113121113222123211211131211121332211213111213122112132113121113222112132113213221232112111312111213322112132113213221133112132123123112111311222112132113311213211221121332211231131122211311123113321112131221123113112221132231131122211211131221131112311332211213211321223112111311222112132113212221132221222112112322211211131221131211132221232112111312111213111213211231131112311311221122132113213221133112132123222112311311222113111231132231121113112221121321133112132112211213322112111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121311121312211213211312111322211213211321322123211211131211121332211213211321322113311213211322132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321133112132112312321123113112221121113122113111231133221121321132122311211131122211213211321222113222122211211232221123113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112311332111213213211221113122113121113222112132113213221232112111312111213322112132113213221133112132123123112111312211322311211133112111312212221121123222112132113213221133112132123222113223113112221131112311332111213122112311311123112112322211211131221131211132221232112111312111213111213211231132132211211131221131211221321123113213221123113112221131112211322212322211231131122211322111312211312111322211213211321322113311213211331121113122122211211132213211231131122212322211331222113112211'" - ], - "boilerplate": { - "python": "class Solution:\n def countAndSay(self, n: int) -> str:\n ", - "java": "class Solution {\n public String countAndSay(int n) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string countAndSay(int n) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(evaluate(expected));\n// Implement the evaluate(String expression) function to parse and evaluate the expression within expected", - "cpp": "return result == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=iP4RH2zespg&pp=ygUWTmVldENvZGUgQ291bnQgYW5kIFNheQ%3D%3D", - "method_name": "countAndSay" - }, - { - "title": "Combination Sum II", - "source": "https://leetcode.com/problems/combination-sum-ii/", - "description": "

Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target.

\n\n

Each number in candidates may only be used once in the combination.

\n\n

Note: The solution set must not contain duplicate combinations.

\n\n

 

\n

Example 1:

\n\n
\nInput: candidates = [10,1,2,7,6,1,5], target = 8\nOutput: \n[\n[1,1,6],\n[1,2,5],\n[1,7],\n[2,6]\n]\n
\n\n

Example 2:

\n\n
\nInput: candidates = [2,5,2,1,2], target = 5\nOutput: \n[\n[1,2,2],\n[5]\n]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= candidates.length <= 100
  • \n\t
  • 1 <= candidates[i] <= 50
  • \n\t
  • 1 <= target <= 30
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[10,1,2,7,6,1,5] --arg2=8", - "--arg1=[2,5,2,1,2] --arg2=5", - "--arg1=[1,1,1,1,1,1,1] --arg2=3" - ], - "sample_test_results": [ - "[[1,1,6],[1,2,5],[1,7],[2,6]]", - "[[1,2,2],[5]]", - "[[1,1,1]]" - ], - "hidden_test_cases": [ - "--arg1=[1] --arg2=1", - "--arg1=[1,2,3] --arg2=6", - "--arg1=[1,1,1,2,2] --arg2=3", - "--arg1=[10,20,30,40,50] --arg2=60", - "--arg1=[2,2,2,2,2] --arg2=4", - "--arg1=[1,2,3,4,5] --arg2=10", - "--arg1=[1,1,1,1,1,1,1,1,1,1] --arg2=5", - "--arg1=[5,4,3,2,1] --arg2=8", - "--arg1=[10,1,2,7,6,1,5] --arg2=9", - "--arg1=[1,2,2,2,2,2,3] --arg2=7" - ], - "hidden_test_results": [ - "[[1]]", - "[[1,2,3]]", - "[[1,1,1],[1,2]]", - "[[10,20,30],[10,50],[20,40]]", - "[[2,2]]", - "[[1,2,3,4],[1,4,5],[2,3,5]]", - "[[1,1,1,1,1]]", - "[[1,2,5],[1,3,4],[3,5]]", - "[[1,1,2,5],[1,1,7],[1,2,6],[2,7]]", - "[[1,2,2,2],[2,2,3]]" - ], - "boilerplate": { - "python": "class Solution:\n def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:\n ", - "java": "class Solution {\n public List> combinationSum2(List candidates, int target) {\n // code goes here\n return null; // placeholder return value\n }\n}", - "cpp": "class Solution {\npublic:\n vector> combinationSum2(vector& candidates, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted([sorted(x) for x in result]) == eval(expected)", - "java": "Collections.sort(resultSet, new Comparator>() {\n @Override\n public int compare(List a, List b) {\n Collections.sort(a);\n Collections.sort(b);\n return a.equals(b) ? 0 : -1;\n }\n});\nreturn resultSet.equals(expectedSet);", - "cpp": "std::vector> sortNestedVectors(const std::vector>& v) {\n std::vector> sorted_v = v;\n for (auto& vec : sorted_v) {\n std::sort(vec.begin(), vec.end());\n }\n std::sort(sorted_v.begin(), sorted_v.end());\n return sorted_v;\n}\n\nbool compareFunction(const std::vector>& result, const std::string& expected) {\n std::vector> expected_vec;\n // Assuming a function `stringToVector` is defined to convert the string representation to a vector of vectors\n expected_vec = stringToVector(expected);\n return sortNestedVectors(result) == expected_vec;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=FOyRpNUSFeA&pp=ygUbTmVldENvZGUgQ29tYmluYXRpb24gU3VtIElJ", - "method_name": "combinationSum2" - }, - { - "title": "Multiply Strings", - "source": "https://leetcode.com/problems/multiply-strings/", - "description": "

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

\n\n

Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.

\n\n

 

\n

Example 1:

\n
Input: num1 = \"2\", num2 = \"3\"\nOutput: \"6\"\n

Example 2:

\n
Input: num1 = \"123\", num2 = \"456\"\nOutput: \"56088\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num1.length, num2.length <= 200
  • \n\t
  • num1 and num2 consist of digits only.
  • \n\t
  • Both num1 and num2 do not contain any leading zero, except the number 0 itself.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=\"2\" --arg2=\"3\"", - "--arg1=\"123\" --arg2=\"456\"", - "--arg1=\"9999\" --arg2=\"9999\"" - ], - "sample_test_results": [ - "'6'", - "'56088'", - "'99980001'" - ], - "hidden_test_cases": [ - "--arg1=\"0\" --arg2=\"0\"", - "--arg1=\"1\" --arg2=\"1\"", - "--arg1=\"999\" --arg2=\"999\"", - "--arg1=\"1234\" --arg2=\"5678\"", - "--arg1=\"99999\" --arg2=\"99999\"", - "--arg1=\"123456789\" --arg2=\"987654321\"", - "--arg1=\"1000000\" --arg2=\"1000000\"", - "--arg1=\"11111111\" --arg2=\"11111111\"", - "--arg1=\"12345678901234567890\" --arg2=\"12345678901234567890\"", - "--arg1=\"0\" --arg2=\"1234567890\"" - ], - "hidden_test_results": [ - "'0'", - "'1'", - "'998001'", - "'7006652'", - "'9999800001'", - "'121932631112635269'", - "'1000000000000'", - "'123456787654321'", - "'152415787532388367501905199875019052100'", - "'0'" - ], - "boilerplate": { - "python": "class Solution:\n def multiply(self, num1: str, num2: str) -> str:\n ", - "java": "class Solution {\n public String multiply(String num1, String num2) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string multiply(string num1, string num2) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=1vZswirL8Y8&pp=ygUZTmVldENvZGUgTXVsdGlwbHkgU3RyaW5ncw%3D%3D", - "method_name": "multiply" - }, - { - "title": "Jump Game II", - "source": "https://leetcode.com/problems/jump-game-ii/", - "description": "

You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0].

\n\n

Each element nums[i] represents the maximum length of a forward jump from index i. In other words, if you are at nums[i], you can jump to any nums[i + j] where:

\n\n
    \n\t
  • 0 <= j <= nums[i] and
  • \n\t
  • i + j < n
  • \n
\n\n

Return the minimum number of jumps to reach nums[n - 1]. The test cases are generated such that you can reach nums[n - 1].

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [2,3,1,1,4]\nOutput: 2\nExplanation: The minimum number of jumps to reach the last index is 2. Jump 1 step from index 0 to 1, then 3 steps to the last index.\n
\n\n

Example 2:

\n\n
\nInput: nums = [2,3,0,1,4]\nOutput: 2\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 104
  • \n\t
  • 0 <= nums[i] <= 1000
  • \n\t
  • It's guaranteed that you can reach nums[n - 1].
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[2,3,1,1,4]", - "--arg1=[2,3,0,1,4]", - "--arg1=[1,2,3,4,5]" - ], - "sample_test_results": [ - "2", - "2", - "3" - ], - "hidden_test_cases": [ - "--arg1=[1]", - "--arg1=[2,1]", - "--arg1=[1,1,1,1]", - "--arg1=[3,2,1]", - "--arg1=[1,2,1,1,1]", - "--arg1=[5,9,3,2,1,0,2,3,3,1,0,0]", - "--arg1=[1,2,3,4,5]", - "--arg1=[4,1,1,3,1,1,1]", - "--arg1=[1,1,1,1,1,1,1,1,1,1]", - "--arg1=[10,9,8,7,6,5,4,3,2,1]" - ], - "hidden_test_results": [ - "0", - "1", - "3", - "1", - "3", - "3", - "3", - "2", - "9", - "1" - ], - "boilerplate": { - "python": "class Solution:\n def jump(self, nums: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int jump(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int jump(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=dJ7sWiOoK7g&pp=ygUVTmVldENvZGUgSnVtcCBHYW1lIElJ", - "method_name": "jump" - }, - { - "title": "Maximum Subarray", - "source": "https://leetcode.com/problems/maximum-subarray/", - "description": "

Given an integer array nums, find the subarray with the largest sum, and return its sum.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [-2,1,-3,4,-1,2,1,-5,4]\nOutput: 6\nExplanation: The subarray [4,-1,2,1] has the largest sum 6.\n
\n\n

Example 2:

\n\n
\nInput: nums = [1]\nOutput: 1\nExplanation: The subarray [1] has the largest sum 1.\n
\n\n

Example 3:

\n\n
\nInput: nums = [5,4,-1,7,8]\nOutput: 23\nExplanation: The subarray [5,4,-1,7,8] has the largest sum 23.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -104 <= nums[i] <= 104
  • \n
\n\n

 

\n

Follow up: If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle.

\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[-2,1,-3,4,-1,2,1,-5,4]", - "--arg1=[1]", - "--arg1=[5,4,-1,7,8]" - ], - "sample_test_results": [ - "6", - "1", - "23" - ], - "hidden_test_cases": [ - "--arg1=[-1]", - "--arg1=[-2,-1]", - "--arg1=[1,2,3,4,5]", - "--arg1=[-1,-2,-3,-4,-5]", - "--arg1=[1,-1,1,-1,1,-1]", - "--arg1=[-2,1,-3,4,-1,2,1,-5,4]", - "--arg1=[0,0,0,0]", - "--arg1=[-1,0,-2,2]", - "--arg1=[1,-2,3,-4,5,-6,7,-8]", - "--arg1=[-1,-1,2,-1,-1]" - ], - "hidden_test_results": [ - "-1", - "-1", - "15", - "-1", - "1", - "6", - "0", - "2", - "7", - "2" - ], - "boilerplate": { - "python": "class Solution:\n def maxSubArray(self, nums: List[int]) -> int:\n ", - "java": "class Solution {\n public int maxSubArray(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maxSubArray(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=5WZl3MMT0Eg&pp=ygUZTmVldENvZGUgTWF4aW11bSBTdWJhcnJheQ%3D%3D", - "method_name": "maxSubArray" - }, - { - "title": "Spiral Matrix", - "source": "https://leetcode.com/problems/spiral-matrix/", - "description": "

Given an m x n matrix, return all elements of the matrix in spiral order.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [[1,2,3],[4,5,6],[7,8,9]]\nOutput: [1,2,3,6,9,8,7,4,5]\n
\n\n

Example 2:

\n\"\"\n
\nInput: matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]\nOutput: [1,2,3,4,8,12,11,10,9,5,6,7]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == matrix.length
  • \n\t
  • n == matrix[i].length
  • \n\t
  • 1 <= m, n <= 10
  • \n\t
  • -100 <= matrix[i][j] <= 100
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[[1,2,3],[4,5,6],[7,8,9]]", - "--arg1=[[1,2,3,4],[5,6,7,8],[9,10,11,12]]" - ], - "sample_test_results": [ - "[1,2,3,6,9,8,7,4,5]", - "[1,2,3,4,8,12,11,10,9,5,6,7]" - ], - "hidden_test_cases": [ - "--arg1=[[1]]", - "--arg1=[[1,2],[3,4]]", - "--arg1=[[1,2,3]]", - "--arg1=[[1],[2],[3]]", - "--arg1=[[1,2,3,4],[5,6,7,8]]", - "--arg1=[[1,2],[3,4],[5,6]]", - "--arg1=[[]]", - "--arg1=[]", - "--arg1=[[1,2,3],[4,5,6]]", - "--arg1=[[1,2],[3,4],[5,6],[7,8]]" - ], - "hidden_test_results": [ - "[1]", - "[1,2,4,3]", - "[1,2,3]", - "[1,2,3]", - "[1,2,3,4,8,7,6,5]", - "[1,2,4,6,5,3]", - "[]", - "[]", - "[1,2,3,6,5,4]", - "[1,2,4,6,8,7,5,3]" - ], - "boilerplate": { - "python": "class Solution:\n def spiralOrder(self, matrix: List[List[int]]) -> List[int]:\n ", - "java": "import java.util.ArrayList;\nimport java.util.List;\n\nclass Solution {\n public List spiralOrder(int[][] matrix) {\n List result = new ArrayList<>();\n // Implement the logic here\n return result;\n }\n}\n", - "cpp": "class Solution {\npublic:\n vector spiralOrder(vector>& matrix) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=BJnMZNwUk1M&pp=ygUWTmVldENvZGUgU3BpcmFsIE1hdHJpeA%3D%3D", - "method_name": "spiralOrder" - }, - { - "title": "Merge Intervals", - "source": "https://leetcode.com/problems/merge-intervals/", - "description": "

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.

\n\n

 

\n

Example 1:

\n\n
\nInput: intervals = [[1,3],[2,6],[8,10],[15,18]]\nOutput: [[1,6],[8,10],[15,18]]\nExplanation: Since intervals [1,3] and [2,6] overlap, merge them into [1,6].\n
\n\n

Example 2:

\n\n
\nInput: intervals = [[1,4],[4,5]]\nOutput: [[1,5]]\nExplanation: Intervals [1,4] and [4,5] are considered overlapping.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= intervals.length <= 104
  • \n\t
  • intervals[i].length == 2
  • \n\t
  • 0 <= starti <= endi <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[[1,3],[2,6],[8,10],[15,18]]", - "--arg1=[[1,4],[4,5]]" - ], - "sample_test_results": [ - "[[1,6],[8,10],[15,18]]", - "[[1,5]]" - ], - "hidden_test_cases": [ - "--arg1=[[1,4],[0,4]]", - "--arg1=[[1,4],[2,3]]", - "--arg1=[[1,4],[0,0]]", - "--arg1=[[1,4]]", - "--arg1=[[1,4],[5,6]]", - "--arg1=[[1,10],[2,3],[4,5],[6,7],[8,9]]", - "--arg1=[[1,2],[2,3],[3,4],[4,5]]", - "--arg1=[[1,5],[2,3]]", - "--arg1=[[1,4],[1,5]]", - "--arg1=[[1,4],[4,6],[5,7],[6,8]]" - ], - "hidden_test_results": [ - "[[0,4]]", - "[[1,4]]", - "[[0,0],[1,4]]", - "[[1,4]]", - "[[1,4],[5,6]]", - "[[1,10]]", - "[[1,5]]", - "[[1,5]]", - "[[1,5]]", - "[[1,8]]" - ], - "boilerplate": { - "python": "class Solution:\n def merge(self, intervals: List[List[int]]) -> List[List[int]]:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public List> merge(List> intervals) {\n \n return null;\n }\n}", - "cpp": "class Solution {\npublic:\n vector> merge(vector>& intervals) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(sorted(result)) == str(eval(expected))", - "java": "return Arrays.toString(Arrays.stream(result).sorted().toArray()).equals(Arrays.toString(eval(expected)));", - "cpp": "std::string resultStr;\nstd::string expectedStr;\nfor (const auto &elem : result) {\n resultStr += std::to_string(elem) + \",\";\n}\nexpectedStr = expected;\nreturn resultStr == expectedStr;" - }, - "explanation": "https://www.youtube.com/watch?v=44H3cEC2fFM&pp=ygUYTmVldENvZGUgTWVyZ2UgSW50ZXJ2YWxz", - "method_name": "merge" - }, - { - "title": "Insert Interval", - "source": "https://leetcode.com/problems/insert-interval/", - "description": "

You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and intervals is sorted in ascending order by starti. You are also given an interval newInterval = [start, end] that represents the start and end of another interval.

\n\n

Insert newInterval into intervals such that intervals is still sorted in ascending order by starti and intervals still does not have any overlapping intervals (merge overlapping intervals if necessary).

\n\n

Return intervals after the insertion.

\n\n

Note that you don't need to modify intervals in-place. You can make a new array and return it.

\n\n

 

\n

Example 1:

\n\n
\nInput: intervals = [[1,3],[6,9]], newInterval = [2,5]\nOutput: [[1,5],[6,9]]\n
\n\n

Example 2:

\n\n
\nInput: intervals = [[1,2],[3,5],[6,7],[8,10],[12,16]], newInterval = [4,8]\nOutput: [[1,2],[3,10],[12,16]]\nExplanation: Because the new interval [4,8] overlaps with [3,5],[6,7],[8,10].\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= intervals.length <= 104
  • \n\t
  • intervals[i].length == 2
  • \n\t
  • 0 <= starti <= endi <= 105
  • \n\t
  • intervals is sorted by starti in ascending order.
  • \n\t
  • newInterval.length == 2
  • \n\t
  • 0 <= start <= end <= 105
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[[1,3],[6,9]] --arg2=[2,5]", - "--arg1=[[1,2],[3,5],[6,7],[8,10],[12,16]] --arg2=[4,8]" - ], - "sample_test_results": [ - "[[1,5],[6,9]]", - "[[1,2],[3,10],[12,16]]" - ], - "hidden_test_cases": [ - "--arg1=[] --arg2=[5,7]", - "--arg1=[[1,5]] --arg2=[2,3]", - "--arg1=[[1,5]] --arg2=[2,7]", - "--arg1=[[1,5]] --arg2=[6,8]", - "--arg1=[[1,5]] --arg2=[0,3]", - "--arg1=[[3,5],[12,15]] --arg2=[6,6]", - "--arg1=[[1,2],[3,5],[6,7],[8,10],[12,16]] --arg2=[4,8]", - "--arg1=[[1,5]] --arg2=[0,0]", - "--arg1=[[3,5],[12,15]] --arg2=[1,2]", - "--arg1=[[1,5],[6,7]] --arg2=[0,8]" - ], - "hidden_test_results": [ - "[[5,7]]", - "[[1,5]]", - "[[1,7]]", - "[[1,5],[6,8]]", - "[[0,5]]", - "[[3,5],[6,6],[12,15]]", - "[[1,2],[3,10],[12,16]]", - "[[0,0],[1,5]]", - "[[1,2],[3,5],[12,15]]", - "[[0,8]]" - ], - "boilerplate": { - "python": "class Solution:\n def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List> insert(List> intervals, List newInterval) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n vector> insert(vector>& intervals, vector& newInterval) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(sorted(result)) == str(eval(expected))", - "java": "return Arrays.toString(Arrays.stream(result).sorted().toArray()).equals(evalExpected(expected));\n\nString evalExpected(String expected) {\n // Implement a method to evaluate the expected string\n // This may involve parsing the expected notation and constructing an equivalent Java object\n return someConstructedValue;\n}", - "cpp": "#include \n#include \n#include \n\nbool compareFunction(const std::vector& result, const std::string& expected) {\n std::vector sortedResult = result; // Make a copy of result\n std::sort(sortedResult.begin(), sortedResult.end()); // Sort the copy\n \n std::stringstream ss;\n ss << \"[\";\n for(size_t i = 0; i < sortedResult.size(); ++i) {\n ss << sortedResult[i];\n if (i != sortedResult.size() - 1) {\n ss << \", \";\n }\n }\n ss << \"]\";\n\n return ss.str() == expected;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=A8NUOmlwOlM&pp=ygUYTmVldENvZGUgSW5zZXJ0IEludGVydmFs", - "method_name": "insert" - }, - { - "title": "Unique Paths II", - "source": "https://leetcode.com/problems/unique-paths-ii/", - "description": "

You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time.

\n\n

An obstacle and space are marked as 1 or 0 respectively in grid. A path that the robot takes cannot include any square that is an obstacle.

\n\n

Return the number of possible unique paths that the robot can take to reach the bottom-right corner.

\n\n

The testcases are generated so that the answer will be less than or equal to 2 * 109.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: obstacleGrid = [[0,0,0],[0,1,0],[0,0,0]]\nOutput: 2\nExplanation: There is one obstacle in the middle of the 3x3 grid above.\nThere are two ways to reach the bottom-right corner:\n1. Right -> Right -> Down -> Down\n2. Down -> Down -> Right -> Right\n
\n\n

Example 2:

\n\"\"\n
\nInput: obstacleGrid = [[0,1],[0,0]]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == obstacleGrid.length
  • \n\t
  • n == obstacleGrid[i].length
  • \n\t
  • 1 <= m, n <= 100
  • \n\t
  • obstacleGrid[i][j] is 0 or 1.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[[0,0,0],[0,1,0],[0,0,0]]", - "--arg1=[[0,1],[0,0]]" - ], - "sample_test_results": [ - "2", - "1" - ], - "hidden_test_cases": [ - "--arg1=[[0]]", - "--arg1=[[1]]", - "--arg1=[[0,0],[0,1]]", - "--arg1=[[0,0],[1,0]]", - "--arg1=[[0,0,0]]", - "--arg1=[[0],[0],[0]]", - "--arg1=[[1,0]]", - "--arg1=[[0,1],[1,0]]", - "--arg1=[[0,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,0]]", - "--arg1=[[0,0,0],[0,0,0],[0,0,1]]" - ], - "hidden_test_results": [ - "1", - "0", - "0", - "1", - "1", - "1", - "0", - "0", - "4", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:\n ", - "java": "class Solution {\n public int uniquePathsWithObstacles(int[][] obstacleGrid) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int uniquePathsWithObstacles(vector>& obstacleGrid) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=d3UOz7zdE4I&pp=ygUYTmVldENvZGUgVW5pcXVlIFBhdGhzIElJ", - "method_name": "uniquePathsWithObstacles" - }, - { - "title": "Simplify Path", - "source": "https://leetcode.com/problems/simplify-path/", - "description": "

You are given an absolute path for a Unix-style file system, which always begins with a slash '/'. Your task is to transform this absolute path into its simplified canonical path.

\n\n

The rules of a Unix-style file system are as follows:

\n\n
    \n\t
  • A single period '.' represents the current directory.
  • \n\t
  • A double period '..' represents the previous/parent directory.
  • \n\t
  • Multiple consecutive slashes such as '//' and '///' are treated as a single slash '/'.
  • \n\t
  • Any sequence of periods that does not match the rules above should be treated as a valid directory or file name. For example, '...' and '....' are valid directory or file names.
  • \n
\n\n

The simplified canonical path should follow these rules:

\n\n
    \n\t
  • The path must start with a single slash '/'.
  • \n\t
  • Directories within the path must be separated by exactly one slash '/'.
  • \n\t
  • The path must not end with a slash '/', unless it is the root directory.
  • \n\t
  • The path must not have any single or double periods ('.' and '..') used to denote current or parent directories.
  • \n
\n\n

Return the simplified canonical path.

\n\n

 

\n

Example 1:

\n\n
\n

Input: path = "/home/"

\n\n

Output: "/home"

\n\n

Explanation:

\n\n

The trailing slash should be removed.

\n
\n\n

Example 2:

\n\n
\n

Input: path = "/home//foo/"

\n\n

Output: "/home/foo"

\n\n

Explanation:

\n\n

Multiple consecutive slashes are replaced by a single one.

\n
\n\n

Example 3:

\n\n
\n

Input: path = "/home/user/Documents/../Pictures"

\n\n

Output: "/home/user/Pictures"

\n\n

Explanation:

\n\n

A double period ".." refers to the directory up a level (the parent directory).

\n
\n\n

Example 4:

\n\n
\n

Input: path = "/../"

\n\n

Output: "/"

\n\n

Explanation:

\n\n

Going one level up from the root directory is not possible.

\n
\n\n

Example 5:

\n\n
\n

Input: path = "/.../a/../b/c/../d/./"

\n\n

Output: "/.../b/d"

\n\n

Explanation:

\n\n

"..." is a valid name for a directory in this problem.

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= path.length <= 3000
  • \n\t
  • path consists of English letters, digits, period '.', slash '/' or '_'.
  • \n\t
  • path is a valid absolute Unix path.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=\"/home/\"", - "--arg1=\"/home//foo/\"", - "--arg1=\"/home/user/Documents/../Pictures\"", - "--arg1=\"/../\"", - "--arg1=\"/.../a/../b/c/../d/./\"" - ], - "sample_test_results": [ - "'/home'", - "'/home/foo'", - "'/home/user/Pictures'", - "'/'", - "'/.../b/d'" - ], - "hidden_test_cases": [ - "--arg1=\"/a/./b/../../c/\"", - "--arg1=\"/home/\"", - "--arg1=\"/...\"", - "--arg1=\"/..hidden\"", - "--arg1=\"//\"", - "--arg1=\"/a//b////c/d//././/..\"", - "--arg1=\"/abc/...\"", - "--arg1=\"/a/./b/./c/./d/\"", - "--arg1=\"/a/../../b/../c//.//\"", - "--arg1=\"/a//b//./c/d/\"" - ], - "hidden_test_results": [ - "'/c'", - "'/home'", - "'/...'", - "'/..hidden'", - "'/'", - "'/a/b/c'", - "'/abc/...'", - "'/a/b/c/d'", - "'/c'", - "'/a/b/c/d'" - ], - "boilerplate": { - "python": "class Solution:\n def simplifyPath(self, path: str) -> str:\n ", - "java": "class Solution {\n public String simplifyPath(String path) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string simplifyPath(string path) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=qYlHrAKJfyA&pp=ygUWTmVldENvZGUgU2ltcGxpZnkgUGF0aA%3D%3D", - "method_name": "simplifyPath" - }, - { - "title": "Edit Distance", - "source": "https://leetcode.com/problems/edit-distance/", - "description": "

Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.

\n\n

You have the following three operations permitted on a word:

\n\n
    \n\t
  • Insert a character
  • \n\t
  • Delete a character
  • \n\t
  • Replace a character
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: word1 = "horse", word2 = "ros"\nOutput: 3\nExplanation: \nhorse -> rorse (replace 'h' with 'r')\nrorse -> rose (remove 'r')\nrose -> ros (remove 'e')\n
\n\n

Example 2:

\n\n
\nInput: word1 = "intention", word2 = "execution"\nOutput: 5\nExplanation: \nintention -> inention (remove 't')\ninention -> enention (replace 'i' with 'e')\nenention -> exention (replace 'n' with 'x')\nexention -> exection (replace 'n' with 'c')\nexection -> execution (insert 'u')\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= word1.length, word2.length <= 500
  • \n\t
  • word1 and word2 consist of lowercase English letters.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1='horse' --arg2='ros'", - "--arg1='intention' --arg2='execution'", - "--arg1='' --arg2='a'" - ], - "sample_test_results": [ - "3", - "5", - "1" - ], - "hidden_test_cases": [ - "--arg1='' --arg2=''", - "--arg1='a' --arg2=''", - "--arg1='abc' --arg2='abc'", - "--arg1='abcde' --arg2='ace'", - "--arg1='sea' --arg2='eat'", - "--arg1='leetcode' --arg2='practice'", - "--arg1='hello' --arg2='world'", - "--arg1='pneumonoultramicroscopicsilicovolcanoconiosis' --arg2='ultramicroscopically'", - "--arg1='abc' --arg2='def'", - "--arg1='aaa' --arg2='bbb'" - ], - "hidden_test_results": [ - "0", - "1", - "0", - "2", - "2", - "7", - "4", - "27", - "3", - "3" - ], - "boilerplate": { - "python": "class Solution:\n def minDistance(self, word1: str, word2: str) -> int:\n ", - "java": "class Solution {\n public int minDistance(String word1, String word2) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int minDistance(string word1, string word2) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=XYi2-LPrwm4&pp=ygUWTmVldENvZGUgRWRpdCBEaXN0YW5jZQ%3D%3D", - "method_name": "minDistance" - }, - { - "title": "Search a 2D Matrix", - "source": "https://leetcode.com/problems/search-a-2d-matrix/", - "description": "

You are given an m x n integer matrix matrix with the following two properties:

\n\n
    \n\t
  • Each row is sorted in non-decreasing order.
  • \n\t
  • The first integer of each row is greater than the last integer of the previous row.
  • \n
\n\n

Given an integer target, return true if target is in matrix or false otherwise.

\n\n

You must write a solution in O(log(m * n)) time complexity.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3\nOutput: true\n
\n\n

Example 2:

\n\"\"\n
\nInput: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == matrix.length
  • \n\t
  • n == matrix[i].length
  • \n\t
  • 1 <= m, n <= 100
  • \n\t
  • -104 <= matrix[i][j], target <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[[1,3,5,7],[10,11,16,20],[23,30,34,60]] --arg2=3", - "--arg1=[[1,3,5,7],[10,11,16,20],[23,30,34,60]] --arg2=13", - "--arg1=[[1]] --arg2=1" - ], - "sample_test_results": [ - "true", - "false", - "true" - ], - "hidden_test_cases": [ - "--arg1=[[1]] --arg2=2", - "--arg1=[[1,2,3]] --arg2=2", - "--arg1=[[1],[2],[3]] --arg2=2", - "--arg1=[[1,2],[3,4]] --arg2=4", - "--arg1=[[-10,-8],[15,20]] --arg2=-8", - "--arg1=[[1,2,3,4],[5,6,7,8]] --arg2=6", - "--arg1=[[1,2,3],[4,5,6],[7,8,9]] --arg2=9", - "--arg1=[[1]] --arg2=0", - "--arg1=[[1,3,5]] --arg2=5", - "--arg1=[[1],[3],[5]] --arg2=3" - ], - "hidden_test_results": [ - "false", - "true", - "true", - "true", - "true", - "true", - "true", - "false", - "true", - "true" - ], - "boilerplate": { - "python": "class Solution:\n def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public boolean searchMatrix(List> matrix, int target) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool searchMatrix(std::vector>& matrix, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::transform(result.begin(), result.end(), result.begin(), ::tolower) == std::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);" - }, - "explanation": "https://www.youtube.com/watch?v=Ber2pi2C0j0&pp=ygUbTmVldENvZGUgU2VhcmNoIGEgMkQgTWF0cml4", - "method_name": "searchMatrix" - }, - { - "title": "Word Search", - "source": "https://leetcode.com/problems/word-search/", - "description": "

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

\n\n

The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"\nOutput: true\n
\n\n

Example 2:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "SEE"\nOutput: true\n
\n\n

Example 3:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB"\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == board.length
  • \n\t
  • n = board[i].length
  • \n\t
  • 1 <= m, n <= 6
  • \n\t
  • 1 <= word.length <= 15
  • \n\t
  • board and word consists of only lowercase and uppercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you use search pruning to make your solution faster with a larger board?

\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[['A','B','C','E'],['S','F','C','S'],['A','D','E','E']] --arg2='ABCCED'", - "--arg1=[['A','B','C','E'],['S','F','C','S'],['A','D','E','E']] --arg2='SEE'", - "--arg1=[['A','B','C','E'],['S','F','C','S'],['A','D','E','E']] --arg2='ABCB'" - ], - "sample_test_results": [ - "true", - "true", - "false" - ], - "hidden_test_cases": [ - "--arg1=[['A']] --arg2='A'", - "--arg1=[['A','B'],['C','D']] --arg2='ABDC'", - "--arg1=[['A','B']] --arg2='BA'", - "--arg1=[['A','B','C'],['D','E','F']] --arg2='CBA'", - "--arg1=[['A']] --arg2='B'", - "--arg1=[['A','A']] --arg2='AAA'", - "--arg1=[['A','B','C']] --arg2='ABC'", - "--arg1=[['A'],['B'],['C']] --arg2='ABC'", - "--arg1=[['A','B'],['C','D']] --arg2='AC'", - "--arg1=[['A','B','C'],['D','E','F'],['G','H','I']] --arg2='ABCFIHG'" - ], - "hidden_test_results": [ - "true", - "true", - "true", - "true", - "false", - "false", - "true", - "true", - "true", - "true" - ], - "boilerplate": { - "python": "class Solution:\n def exist(self, board: List[List[str]], word: str) -> bool:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public boolean exist(List> board, String word) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool exist(vector>& board, string word) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return toLowerCase(result) == toLowerCase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=pfiQ_PS1g8E&pp=ygUUTmVldENvZGUgV29yZCBTZWFyY2g%3D", - "method_name": "exist" - }, - { - "title": "Subsets II", - "source": "https://leetcode.com/problems/subsets-ii/", - "description": "

Given an integer array nums that may contain duplicates, return all possible subsets (the power set).

\n\n

The solution set must not contain duplicate subsets. Return the solution in any order.

\n\n

 

\n

Example 1:

\n
Input: nums = [1,2,2]\nOutput: [[],[1],[1,2],[1,2,2],[2],[2,2]]\n

Example 2:

\n
Input: nums = [0]\nOutput: [[],[0]]\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 10
  • \n\t
  • -10 <= nums[i] <= 10
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[1,2,2]", - "--arg1=[0]", - "--arg1=[1,1,1]" - ], - "sample_test_results": [ - "[[],[1],[1,2],[1,2,2],[2],[2,2]]", - "[[],[0]]", - "[[],[1],[1,1],[1,1,1]]" - ], - "hidden_test_cases": [ - "--arg1=[1]", - "--arg1=[1,2]", - "--arg1=[1,2,3]", - "--arg1=[2,2,2,2]", - "--arg1=[1,2,2,3]", - "--arg1=[1,1,2,2]", - "--arg1=[3,2,1]", - "--arg1=[-1,0,1]", - "--arg1=[0,0,0]", - "--arg1=[4,4,4,1,4]" - ], - "hidden_test_results": [ - "[[],[1]]", - "[[],[1],[1,2],[2]]", - "[[],[1],[1,2],[1,2,3],[1,3],[2],[2,3],[3]]", - "[[],[2],[2,2],[2,2,2],[2,2,2,2]]", - "[[],[1],[1,2],[1,2,2],[1,2,2,3],[1,2,3],[1,3],[2],[2,2],[2,2,3],[2,3],[3]]", - "[[],[1],[1,1],[1,1,2],[1,1,2,2],[1,2],[1,2,2],[2],[2,2]]", - "[[],[1],[1,2],[1,2,3],[1,3],[2],[2,3],[3]]", - "[[],[-1],[-1,0],[-1,0,1],[-1,1],[0],[0,1],[1]]", - "[[],[0],[0,0],[0,0,0]]", - "[[],[1],[1,4],[1,4,4],[1,4,4,4],[1,4,4,4,4],[4],[4,4],[4,4,4],[4,4,4,4]]" - ], - "boilerplate": { - "python": "class Solution:\n def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:\n ", - "java": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nclass Solution {\n public List> subsetsWithDup(int[] nums) {\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector> subsetsWithDup(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted([sorted(x) for x in result]) == sorted(eval(expected))", - "java": "List> sortedResult = new ArrayList<>();\nfor (List list : result) {\n List sortedList = new ArrayList<>(list);\n Collections.sort(sortedList);\n sortedResult.add(sortedList);\n}\nCollections.sort(sortedResult, new Comparator>() {\n public int compare(List o1, List o2) {\n for (int i = 0; i < Math.min(o1.size(), o2.size()); i++) {\n if (!o1.get(i).equals(o2.get(i))) {\n return o1.get(i) - o2.get(i);\n }\n }\n return o1.size() - o2.size();\n }\n});\n\nList> sortedExpected = new ArrayList<>();\nfor (List list : expected) {\n List sortedList = new ArrayList<>(list);\n Collections.sort(sortedList);\n sortedExpected.add(sortedList);\n}\nCollections.sort(sortedExpected, new Comparator>() {\n public int compare(List o1, List o2) {\n for (int i = 0; i < Math.min(o1.size(), o2.size()); i++) {\n if (!o1.get(i).equals(o2.get(i))) {\n return o1.get(i) - o2.get(i);\n }\n }\n return o1.size() - o2.size();\n }\n});\n\nreturn sortedResult.equals(sortedExpected);", - "cpp": "vector> sortNestedVector(const vector> &vecs) {\n vector> sortedVecs = vecs;\n for (auto &vec : sortedVecs) {\n sort(vec.begin(), vec.end());\n }\n sort(sortedVecs.begin(), sortedVecs.end());\n return sortedVecs;\n}\n\nvector> evalExpected(const string &expected) {\n vector> evalVecs; // This needs to be implemented to match Python's eval behavior\n // Some parsing logic or a mock function would be here to convert `expected` to a vector of vectors\n return evalVecs;\n}\n\ncompareFunction(const vector> &result, const string &expected) {\n vector> sortedResult = sortNestedVector(result);\n vector> sortedExpected = sortNestedVector(evalExpected(expected));\n return sortedResult == sortedExpected;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=Vn2v6ajA7U0&pp=ygUTTmVldENvZGUgU3Vic2V0cyBJSQ%3D%3D", - "method_name": "subsetsWithDup" - }, - { - "title": "Restore IP Addresses", - "source": "https://leetcode.com/problems/restore-ip-addresses/", - "description": "

A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclusive) and cannot have leading zeros.

\n\n
    \n\t
  • For example, "0.1.2.201" and "192.168.1.1" are valid IP addresses, but "0.011.255.245", "192.168.1.312" and "192.168@1.1" are invalid IP addresses.
  • \n
\n\n

Given a string s containing only digits, return all possible valid IP addresses that can be formed by inserting dots into s. You are not allowed to reorder or remove any digits in s. You may return the valid IP addresses in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "25525511135"\nOutput: ["255.255.11.135","255.255.111.35"]\n
\n\n

Example 2:

\n\n
\nInput: s = "0000"\nOutput: ["0.0.0.0"]\n
\n\n

Example 3:

\n\n
\nInput: s = "101023"\nOutput: ["1.0.10.23","1.0.102.3","10.1.0.23","10.10.2.3","101.0.2.3"]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 20
  • \n\t
  • s consists of digits only.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1='25525511135'", - "--arg1='0000'", - "--arg1='101023'" - ], - "sample_test_results": [ - "['255.255.11.135','255.255.111.35']", - "['0.0.0.0']", - "['1.0.10.23','1.0.102.3','10.1.0.23','10.10.2.3','101.0.2.3']" - ], - "hidden_test_cases": [ - "--arg1='1111'", - "--arg1='010010'", - "--arg1='0'", - "--arg1='999999'", - "--arg1='1921680'", - "--arg1='2552551113'", - "--arg1='00001'", - "--arg1='100100'", - "--arg1='12345'", - "--arg1='1111111'" - ], - "hidden_test_results": [ - "['1.1.1.1']", - "['0.10.0.10','0.100.1.0']", - "[]", - "['9.9.99.99','9.99.9.99','9.99.99.9','99.9.9.99','99.9.99.9','99.99.9.9']", - "['1.9.216.80','1.92.16.80','1.92.168.0','19.2.16.80','19.2.168.0','19.21.6.80','19.21.68.0','19.216.8.0','192.1.6.80','192.1.68.0','192.16.8.0']", - "['255.25.51.113','255.255.1.113','255.255.11.13','255.255.111.3']", - "[]", - "['1.0.0.100','10.0.10.0','100.1.0.0']", - "['1.2.3.45','1.2.34.5','1.23.4.5','12.3.4.5']", - "['1.1.11.111','1.1.111.11','1.11.1.111','1.11.11.11','1.11.111.1','1.111.1.11','1.111.11.1','11.1.1.111','11.1.11.11','11.1.111.1','11.11.1.11','11.11.11.1','11.111.1.1','111.1.1.11','111.1.11.1','111.11.1.1']" - ], - "boilerplate": { - "python": "class Solution:\n def restoreIpAddresses(self, s: str) -> List[str]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List restoreIpAddresses(String s) {\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n vector restoreIpAddresses(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray())", - "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedSorted = eval(expected);\nstd::sort(expectedSorted.begin(), expectedSorted.end());\nreturn result == expectedSorted;" - }, - "explanation": "https://www.youtube.com/watch?v=61tN4YEdiTM&pp=ygUdTmVldENvZGUgUmVzdG9yZSBJUCBBZGRyZXNzZXM%3D", - "method_name": "restoreIpAddresses" - }, - { - "title": "Interleaving String", - "source": "https://leetcode.com/problems/interleaving-string/", - "description": "

Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2.

\n\n

An interleaving of two strings s and t is a configuration where s and t are divided into n and m substrings respectively, such that:

\n\n
    \n\t
  • s = s1 + s2 + ... + sn
  • \n\t
  • t = t1 + t2 + ... + tm
  • \n\t
  • |n - m| <= 1
  • \n\t
  • The interleaving is s1 + t1 + s2 + t2 + s3 + t3 + ... or t1 + s1 + t2 + s2 + t3 + s3 + ...
  • \n
\n\n

Note: a + b is the concatenation of strings a and b.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"\nOutput: true\nExplanation: One way to obtain s3 is:\nSplit s1 into s1 = "aa" + "bc" + "c", and s2 into s2 = "dbbc" + "a".\nInterleaving the two splits, we get "aa" + "dbbc" + "bc" + "a" + "c" = "aadbbcbcac".\nSince s3 can be obtained by interleaving s1 and s2, we return true.\n
\n\n

Example 2:

\n\n
\nInput: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc"\nOutput: false\nExplanation: Notice how it is impossible to interleave s2 with any other string to obtain s3.\n
\n\n

Example 3:

\n\n
\nInput: s1 = "", s2 = "", s3 = ""\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s1.length, s2.length <= 100
  • \n\t
  • 0 <= s3.length <= 200
  • \n\t
  • s1, s2, and s3 consist of lowercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you solve it using only O(s2.length) additional memory space?

\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1='aabcc' --arg2='dbbca' --arg3='aadbbcbcac'", - "--arg1='aabcc' --arg2='dbbca' --arg3='aadbbbaccc'", - "--arg1='' --arg2='' --arg3=''" - ], - "sample_test_results": [ - "true", - "false", - "true" - ], - "hidden_test_cases": [ - "--arg1='abc' --arg2='def' --arg3='adbecf'", - "--arg1='a' --arg2='b' --arg3='ab'", - "--arg1='a' --arg2='b' --arg3='ba'", - "--arg1='aa' --arg2='ab' --arg3='aaba'", - "--arg1='aaa' --arg2='bbb' --arg3='ababab'", - "--arg1='' --arg2='abc' --arg3='abc'", - "--arg1='abc' --arg2='' --arg3='abc'", - "--arg1='abc' --arg2='def' --arg3='abcdef'", - "--arg1='aaa' --arg2='aaa' --arg3='aaaaaa'", - "--arg1='abc' --arg2='def' --arg3='abcef'" - ], - "hidden_test_results": [ - "true", - "true", - "true", - "true", - "true", - "true", - "true", - "true", - "true", - "false" - ], - "boilerplate": { - "python": "class Solution:\n def isInterleave(self, s1: str, s2: str, s3: str) -> bool:\n ", - "java": "class Solution {\n public boolean isInterleave(String s1, String s2, String s3) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isInterleave(string s1, string s2, string s3) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return to_lowercase(result) == to_lowercase(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=3Rw3p9LrgvE&pp=ygUcTmVldENvZGUgSW50ZXJsZWF2aW5nIFN0cmluZw%3D%3D", - "method_name": "isInterleave" - }, - { - "title": "Triangle", - "source": "https://leetcode.com/problems/triangle/", - "description": "

Given a triangle array, return the minimum path sum from top to bottom.

\n\n

For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i + 1 on the next row.

\n\n

 

\n

Example 1:

\n\n
\nInput: triangle = [[2],[3,4],[6,5,7],[4,1,8,3]]\nOutput: 11\nExplanation: The triangle looks like:\n   2\n  3 4\n 6 5 7\n4 1 8 3\nThe minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11 (underlined above).\n
\n\n

Example 2:

\n\n
\nInput: triangle = [[-10]]\nOutput: -10\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= triangle.length <= 200
  • \n\t
  • triangle[0].length == 1
  • \n\t
  • triangle[i].length == triangle[i - 1].length + 1
  • \n\t
  • -104 <= triangle[i][j] <= 104
  • \n
\n\n

 

\nFollow up: Could you do this using only O(n) extra space, where n is the total number of rows in the triangle?", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[[2],[3,4],[6,5,7],[4,1,8,3]]", - "--arg1=[[-10]]" - ], - "sample_test_results": [ - "11", - "-10" - ], - "hidden_test_cases": [ - "--arg1=[[1]]", - "--arg1=[[1],[2,3]]", - "--arg1=[[-1],[2,3],[1,-1,3]]", - "--arg1=[[1],[1,2],[1,2,3],[1,2,3,4]]", - "--arg1=[[0],[-1,2],[1,-2,3],[-3,1,-1,2]]", - "--arg1=[[1],[-5,2],[2,-1,3],[1,2,-4,5]]", - "--arg1=[[0],[0,0],[0,0,0]]", - "--arg1=[[1],[-1,-2],[3,-3,1],[-4,5,-6,2]]", - "--arg1=[[10],[-2,-3],[1,2,-1]]", - "--arg1=[[1],[2,1],[3,3,1]]" - ], - "hidden_test_results": [ - "1", - "3", - "0", - "4", - "-4", - "-9", - "0", - "-10", - "6", - "3" - ], - "boilerplate": { - "python": "class Solution:\n def minimumTotal(self, triangle: List[List[int]]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int minimumTotal(List> triangle) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int minimumTotal(vector>& triangle) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=OM1MTokvxs4&pp=ygURTmVldENvZGUgVHJpYW5nbGU%3D", - "method_name": "minimumTotal" - }, - { - "title": "Longest Consecutive Sequence", - "source": "https://leetcode.com/problems/longest-consecutive-sequence/", - "description": "

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.

\n\n

You must write an algorithm that runs in O(n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [100,4,200,1,3,2]\nOutput: 4\nExplanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,3,7,2,5,8,4,6,0,1]\nOutput: 9\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[100,4,200,1,3,2]", - "--arg1=[0,3,7,2,5,8,4,6,0,1]" - ], - "sample_test_results": [ - "4", - "9" - ], - "hidden_test_cases": [ - "--arg1=[]", - "--arg1=[1]", - "--arg1=[1,2,3,4,5]", - "--arg1=[1,3,5,7,9]", - "--arg1=[-5,-4,-3,-2,-1]", - "--arg1=[1,1,1,1,1]", - "--arg1=[1,2,0,1]", - "--arg1=[0,-1,2,-2,3,-3]", - "--arg1=[1000,1,2,3,4,999]", - "--arg1=[5,4,3,2,1,6,7,8,9]" - ], - "hidden_test_results": [ - "0", - "1", - "5", - "1", - "5", - "1", - "3", - "4", - "4", - "9" - ], - "boilerplate": { - "python": "class Solution:\n def longestConsecutive(self, nums: List[int]) -> int:\n ", - "java": "import java.util.List;\nimport java.util.HashSet;\n\nclass Solution {\n public int longestConsecutive(List nums) {\n \n }\n}", - "cpp": "#include \n#include \n\nclass Solution {\npublic:\n int longestConsecutive(std::vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=P6RZZMu_maU&pp=ygUlTmVldENvZGUgTG9uZ2VzdCBDb25zZWN1dGl2ZSBTZXF1ZW5jZQ%3D%3D", - "method_name": "longestConsecutive" - }, - { - "title": "Gas Station", - "source": "https://leetcode.com/problems/gas-station/", - "description": "

There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i].

\n\n

You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from the ith station to its next (i + 1)th station. You begin the journey with an empty tank at one of the gas stations.

\n\n

Given two integer arrays gas and cost, return the starting gas station's index if you can travel around the circuit once in the clockwise direction, otherwise return -1. If there exists a solution, it is guaranteed to be unique.

\n\n

 

\n

Example 1:

\n\n
\nInput: gas = [1,2,3,4,5], cost = [3,4,5,1,2]\nOutput: 3\nExplanation:\nStart at station 3 (index 3) and fill up with 4 unit of gas. Your tank = 0 + 4 = 4\nTravel to station 4. Your tank = 4 - 1 + 5 = 8\nTravel to station 0. Your tank = 8 - 2 + 1 = 7\nTravel to station 1. Your tank = 7 - 3 + 2 = 6\nTravel to station 2. Your tank = 6 - 4 + 3 = 5\nTravel to station 3. The cost is 5. Your gas is just enough to travel back to station 3.\nTherefore, return 3 as the starting index.\n
\n\n

Example 2:

\n\n
\nInput: gas = [2,3,4], cost = [3,4,3]\nOutput: -1\nExplanation:\nYou can't start at station 0 or 1, as there is not enough gas to travel to the next station.\nLet's start at station 2 and fill up with 4 unit of gas. Your tank = 0 + 4 = 4\nTravel to station 0. Your tank = 4 - 3 + 2 = 3\nTravel to station 1. Your tank = 3 - 3 + 3 = 3\nYou cannot travel back to station 2, as it requires 4 unit of gas but you only have 3.\nTherefore, you can't travel around the circuit once no matter where you start.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == gas.length == cost.length
  • \n\t
  • 1 <= n <= 105
  • \n\t
  • 0 <= gas[i], cost[i] <= 104
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[1,2,3,4,5] --arg2=[3,4,5,1,2]", - "--arg1=[2,3,4] --arg2=[3,4,3]" - ], - "sample_test_results": [ - "3", - "-1" - ], - "hidden_test_cases": [ - "--arg1=[1] --arg2=[1]", - "--arg1=[2] --arg2=[1]", - "--arg1=[1,2] --arg2=[2,1]", - "--arg1=[5,1,2,3,4] --arg2=[4,4,1,5,1]", - "--arg1=[4,5,2,6,5,3] --arg2=[3,2,7,3,2,9]", - "--arg1=[1,2,3] --arg2=[2,3,1]", - "--arg1=[3,1,1] --arg2=[1,2,2]", - "--arg1=[5,8,2,8] --arg2=[6,5,6,6]", - "--arg1=[1,1,1] --arg2=[1,1,1]", - "--arg1=[2,0,1] --arg2=[1,1,1]" - ], - "hidden_test_results": [ - "0", - "0", - "1", - "4", - "-1", - "2", - "0", - "3", - "0", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:\n ", - "java": "class Solution {\n public int canCompleteCircuit(int[] gas, int[] cost) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int canCompleteCircuit(vector& gas, vector& cost) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result != null && result.toString().equals(expected);", - "cpp": "std::string compareFunction(const std::string &result, const std::string &expected) {\n return result == expected;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=lJwbPZGo05A&pp=ygUUTmVldENvZGUgR2FzIFN0YXRpb24%3D", - "method_name": "canCompleteCircuit" - }, - { - "title": "Word Break", - "source": "https://leetcode.com/problems/word-break/", - "description": "

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

\n\n

Note that the same word in the dictionary may be reused multiple times in the segmentation.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "leetcode", wordDict = ["leet","code"]\nOutput: true\nExplanation: Return true because "leetcode" can be segmented as "leet code".\n
\n\n

Example 2:

\n\n
\nInput: s = "applepenapple", wordDict = ["apple","pen"]\nOutput: true\nExplanation: Return true because "applepenapple" can be segmented as "apple pen apple".\nNote that you are allowed to reuse a dictionary word.\n
\n\n

Example 3:

\n\n
\nInput: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"]\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 300
  • \n\t
  • 1 <= wordDict.length <= 1000
  • \n\t
  • 1 <= wordDict[i].length <= 20
  • \n\t
  • s and wordDict[i] consist of only lowercase English letters.
  • \n\t
  • All the strings of wordDict are unique.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1='leetcode' --arg2=['leet','code']", - "--arg1='applepenapple' --arg2=['apple','pen']", - "--arg1='catsandog' --arg2=['cats','dog','sand','and','cat']" - ], - "sample_test_results": [ - "true", - "true", - "false" - ], - "hidden_test_cases": [ - "--arg1='a' --arg2=['a']", - "--arg1='ab' --arg2=['a','b']", - "--arg1='cars' --arg2=['car','ca','rs']", - "--arg1='goalspecial' --arg2=['go','goal','goals','special']", - "--arg1='aaaaaaa' --arg2=['aaa','aaaa']", - "--arg1='impossible' --arg2=['imp','possible']", - "--arg1='python' --arg2=['py','thon']", - "--arg1='abcd' --arg2=['ab','abc','cd','abcd']", - "--arg1='helloworld' --arg2=['hello','world','hell','or']", - "--arg1='noway' --arg2=['no','way','now','ay']" - ], - "hidden_test_results": [ - "true", - "true", - "true", - "true", - "true", - "false", - "true", - "true", - "true", - "true" - ], - "boilerplate": { - "python": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> bool:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public boolean wordBreak(String s, List wordDict) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool wordBreak(std::string s, std::vector& wordDict) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=Sx9NNgInc3A&pp=ygUTTmVldENvZGUgV29yZCBCcmVhaw%3D%3D", - "method_name": "wordBreak" - }, - { - "title": "Evaluate Reverse Polish Notation", - "source": "https://leetcode.com/problems/evaluate-reverse-polish-notation/", - "description": "

You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation.

\n\n

Evaluate the expression. Return an integer that represents the value of the expression.

\n\n

Note that:

\n\n
    \n\t
  • The valid operators are '+', '-', '*', and '/'.
  • \n\t
  • Each operand may be an integer or another expression.
  • \n\t
  • The division between two integers always truncates toward zero.
  • \n\t
  • There will not be any division by zero.
  • \n\t
  • The input represents a valid arithmetic expression in a reverse polish notation.
  • \n\t
  • The answer and all the intermediate calculations can be represented in a 32-bit integer.
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: tokens = ["2","1","+","3","*"]\nOutput: 9\nExplanation: ((2 + 1) * 3) = 9\n
\n\n

Example 2:

\n\n
\nInput: tokens = ["4","13","5","/","+"]\nOutput: 6\nExplanation: (4 + (13 / 5)) = 6\n
\n\n

Example 3:

\n\n
\nInput: tokens = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"]\nOutput: 22\nExplanation: ((10 * (6 / ((9 + 3) * -11))) + 17) + 5\n= ((10 * (6 / (12 * -11))) + 17) + 5\n= ((10 * (6 / -132)) + 17) + 5\n= ((10 * 0) + 17) + 5\n= (0 + 17) + 5\n= 17 + 5\n= 22\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= tokens.length <= 104
  • \n\t
  • tokens[i] is either an operator: "+", "-", "*", or "/", or an integer in the range [-200, 200].
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[\"2\",\"1\",\"+\",\"3\",\"*\"]", - "--arg1=[\"4\",\"13\",\"5\",\"/\",\"+\"]", - "--arg1=[\"10\",\"6\",\"9\",\"3\",\"+\",\"-11\",\"*\",\"/\",\"*\",\"17\",\"+\",\"5\",\"+\"]" - ], - "sample_test_results": [ - "9", - "6", - "22" - ], - "hidden_test_cases": [ - "--arg1=[\"1\"]", - "--arg1=[\"2\",\"3\",\"+\"]", - "--arg1=[\"4\",\"5\",\"*\"]", - "--arg1=[\"10\",\"5\",\"/\"]", - "--arg1=[\"15\",\"7\",\"-\"]", - "--arg1=[\"2\",\"1\",\"3\",\"*\",\"+\"]", - "--arg1=[\"-2\",\"3\",\"*\",\"4\",\"+\"]", - "--arg1=[\"10\",\"2\",\"*\",\"3\",\"4\",\"*\",\"+\"]", - "--arg1=[\"5\",\"3\",\"/\",\"2\",\"*\"]", - "--arg1=[\"100\",\"200\",\"+\",\"2\",\"/\"]" - ], - "hidden_test_results": [ - "1", - "5", - "20", - "2", - "8", - "5", - "-2", - "32", - "2", - "150" - ], - "boilerplate": { - "python": "class Solution:\n def evalRPN(self, tokens: List[str]) -> int:\n ", - "java": "import java.util.List;\nimport java.util.Stack;\n\nclass Solution {\n public int evalRPN(List tokens) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int evalRPN(vector& tokens) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return stoi(result) == stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=iu0082c4HDE&pp=ygUpTmVldENvZGUgRXZhbHVhdGUgUmV2ZXJzZSBQb2xpc2ggTm90YXRpb24%3D", - "method_name": "evalRPN" - }, - { - "title": "Reverse Words in a String", - "source": "https://leetcode.com/problems/reverse-words-in-a-string/", - "description": "

Given an input string s, reverse the order of the words.

\n\n

A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space.

\n\n

Return a string of the words in reverse order concatenated by a single space.

\n\n

Note that s may contain leading or trailing spaces or multiple spaces between two words. The returned string should only have a single space separating the words. Do not include any extra spaces.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "the sky is blue"\nOutput: "blue is sky the"\n
\n\n

Example 2:

\n\n
\nInput: s = "  hello world  "\nOutput: "world hello"\nExplanation: Your reversed string should not contain leading or trailing spaces.\n
\n\n

Example 3:

\n\n
\nInput: s = "a good   example"\nOutput: "example good a"\nExplanation: You need to reduce multiple spaces between two words to a single space in the reversed string.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s contains English letters (upper-case and lower-case), digits, and spaces ' '.
  • \n\t
  • There is at least one word in s.
  • \n
\n\n

 

\n

Follow-up: If the string data type is mutable in your language, can you solve it in-place with O(1) extra space?

\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=\"the sky is blue\"", - "--arg1=\" hello world \"", - "--arg1=\"a good example\"" - ], - "sample_test_results": [ - "'blue is sky the'", - "'world hello'", - "'example good a'" - ], - "hidden_test_cases": [ - "--arg1=\"hello\"", - "--arg1=\" spaces \"", - "--arg1=\"first second third\"", - "--arg1=\" multiple spaces here \"", - "--arg1=\"1 2 3 4 5\"", - "--arg1=\"a\"", - "--arg1=\" start end \"", - "--arg1=\"comma, no space\"", - "--arg1=\"mixed Case woRDs\"", - "--arg1=\" lots of spaces \"" - ], - "hidden_test_results": [ - "'hello'", - "'spaces'", - "'third second first'", - "'here spaces multiple'", - "'5 4 3 2 1'", - "'a'", - "'end start'", - "'space comma,no'", - "'woRDs Case mixed'", - "'spaces of lots'" - ], - "boilerplate": { - "python": "class Solution:\n def reverseWords(self, s: str) -> str:\n ", - "java": "class Solution {\n public String reverseWords(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n string reverseWords(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=7kUEwiwwnlA&pp=ygUiTmVldENvZGUgUmV2ZXJzZSBXb3JkcyBpbiBhIFN0cmluZw%3D%3D", - "method_name": "reverseWords" - }, - { - "title": "Find Minimum in Rotated Sorted Array", - "source": "https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/", - "description": "

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:

\n\n
    \n\t
  • [4,5,6,7,0,1,2] if it was rotated 4 times.
  • \n\t
  • [0,1,2,4,5,6,7] if it was rotated 7 times.
  • \n
\n\n

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

\n\n

Given the sorted rotated array nums of unique elements, return the minimum element of this array.

\n\n

You must write an algorithm that runs in O(log n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [3,4,5,1,2]\nOutput: 1\nExplanation: The original array was [1,2,3,4,5] rotated 3 times.\n
\n\n

Example 2:

\n\n
\nInput: nums = [4,5,6,7,0,1,2]\nOutput: 0\nExplanation: The original array was [0,1,2,4,5,6,7] and it was rotated 4 times.\n
\n\n

Example 3:

\n\n
\nInput: nums = [11,13,15,17]\nOutput: 11\nExplanation: The original array was [11,13,15,17] and it was rotated 4 times. \n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == nums.length
  • \n\t
  • 1 <= n <= 5000
  • \n\t
  • -5000 <= nums[i] <= 5000
  • \n\t
  • All the integers of nums are unique.
  • \n\t
  • nums is sorted and rotated between 1 and n times.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[3,4,5,1,2]", - "--arg1=[4,5,6,7,0,1,2]", - "--arg1=[11,13,15,17]" - ], - "sample_test_results": [ - "1", - "0", - "11" - ], - "hidden_test_cases": [ - "--arg1=[45,19,22,27,32,36,41]", - "--arg1=[-29]", - "--arg1=[29,30,35,38,41,46,50,54,59,61,63,68,20,22,26]", - "--arg1=[56,16,19,23,26,31,34,35,36,37,41,44,46,49,51]", - "--arg1=[11,16,19,21,26,30,35,37,41,-3,-2,0,5,6,7]", - "--arg1=[43,47,29,30,35,40,41]", - "--arg1=[14,19,20,25,28,29,-1,2,6,9]", - "--arg1=[14,19,20,25,28,29,-1,2,6,9]", - "--arg1=[31,33,29,30]", - "--arg1=[47,48,52,14,18,23,26,29,34,39,44]" - ], - "hidden_test_results": [ - "19", - "-29", - "20", - "16", - "-3", - "29", - "-1", - "-1", - "29", - "14" - ], - "boilerplate": { - "python": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int findMin(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int findMin(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=nIVW4P8b1VA&pp=ygUtTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5", - "method_name": "findMin" - }, - { - "title": "Find Peak Element", - "source": "https://leetcode.com/problems/find-peak-element/", - "description": "

A peak element is an element that is strictly greater than its neighbors.

\n\n

Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks.

\n\n

You may imagine that nums[-1] = nums[n] = -∞. In other words, an element is always considered to be strictly greater than a neighbor that is outside the array.

\n\n

You must write an algorithm that runs in O(log n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,3,1]\nOutput: 2\nExplanation: 3 is a peak element and your function should return the index number 2.
\n\n

Example 2:

\n\n
\nInput: nums = [1,2,1,3,5,6,4]\nOutput: 5\nExplanation: Your function can return either index number 1 where the peak element is 2, or index number 5 where the peak element is 6.
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 1000
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n\t
  • nums[i] != nums[i + 1] for all valid i.
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[1,2,3,1]", - "--arg1=[1,2,1,3,5,6,4]" - ], - "sample_test_results": [ - "2", - "5" - ], - "hidden_test_cases": [ - "--arg1=[1]", - "--arg1=[1,2]", - "--arg1=[2,1]", - "--arg1=[1,2,3]", - "--arg1=[3,2,1]", - "--arg1=[1,3,2,4,5]", - "--arg1=[5,4,3,2,1]", - "--arg1=[1,5,3,7,4]", - "--arg1=[1,2,3,4,3]", - "--arg1=[3,1,4,5,2]" - ], - "hidden_test_results": [ - "0", - "1", - "0", - "2", - "0", - "4", - "0", - "3", - "3", - "3" - ], - "boilerplate": { - "python": "class Solution:\n def findPeakElement(self, nums: List[int]) -> int:\n ", - "java": "class Solution {\n public int findPeakElement(int[] nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int findPeakElement(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "import java.util.function.Function;\n\npublic class Solution {\n public static boolean compareFunction(String result, Function evalFunction, String expected) {\n try {\n return result.equals(evalFunction.apply(expected).toString());\n } catch (Exception e) {\n e.printStackTrace();\n return false;\n }\n }\n}", - "cpp": "return result == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=kMzJy9es7Hc&pp=ygUaTmVldENvZGUgRmluZCBQZWFrIEVsZW1lbnQ%3D", - "method_name": "findPeakElement" - }, - { - "title": "Maximum Gap", - "source": "https://leetcode.com/problems/maximum-gap/", - "description": "

Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the array contains less than two elements, return 0.

\n\n

You must write an algorithm that runs in linear time and uses linear extra space.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [3,6,9,1]\nOutput: 3\nExplanation: The sorted form of the array is [1,3,6,9], either (3,6) or (6,9) has the maximum difference 3.\n
\n\n

Example 2:

\n\n
\nInput: nums = [10]\nOutput: 0\nExplanation: The array contains less than 2 elements, therefore return 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • 0 <= nums[i] <= 109
  • \n
\n", - "difficulty": "medium", - "sample_test_cases": [ - "--arg1=[3,6,9,1]", - "--arg1=[10]" - ], - "sample_test_results": [ - "3", - "0" - ], - "hidden_test_cases": [ - "--arg1=[1,2,3,4]", - "--arg1=[1,10]", - "--arg1=[1,1,1,1]", - "--arg1=[1,3,100]", - "--arg1=[1]", - "--arg1=[1,5,2,8,3]", - "--arg1=[87,53,100,1]", - "--arg1=[1000,1,500,2]", - "--arg1=[1,10000,1,10000]", - "--arg1=[1,2,3,5,6,7,8,9,10,100]" - ], - "hidden_test_results": [ - "1", - "9", - "0", - "97", - "0", - "3", - "52", - "500", - "9999", - "90" - ], - "boilerplate": { - "python": "class Solution:\n def maximumGap(self, nums: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int maximumGap(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maximumGap(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=imCKT3T2Oao&pp=ygUUTmVldENvZGUgTWF4aW11bSBHYXA%3D", - "method_name": "maximumGap" - }, - { - "title": "Median of Two Sorted Arrays", - "source": "https://leetcode.com/problems/median-of-two-sorted-arrays/", - "description": "

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

\n\n

The overall run time complexity should be O(log (m+n)).

\n\n

 

\n

Example 1:

\n\n
\nInput: nums1 = [1,3], nums2 = [2]\nOutput: 2.00000\nExplanation: merged array = [1,2,3] and median is 2.\n
\n\n

Example 2:

\n\n
\nInput: nums1 = [1,2], nums2 = [3,4]\nOutput: 2.50000\nExplanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • nums1.length == m
  • \n\t
  • nums2.length == n
  • \n\t
  • 0 <= m <= 1000
  • \n\t
  • 0 <= n <= 1000
  • \n\t
  • 1 <= m + n <= 2000
  • \n\t
  • -106 <= nums1[i], nums2[i] <= 106
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=[1,3] --arg2=[2]", - "--arg1=[1,2] --arg2=[3,4]", - "--arg1=[] --arg2=[1]" - ], - "sample_test_results": [ - "2", - "2.5", - "1" - ], - "hidden_test_cases": [ - "--arg1=[1] --arg2=[1]", - "--arg1=[1,2,3,4,5] --arg2=[]", - "--arg1=[] --arg2=[1,2,3,4,5]", - "--arg1=[1] --arg2=[2,3,4,5,6]", - "--arg1=[1,2,3,4,5] --arg2=[6]", - "--arg1=[1,3,5,7] --arg2=[2,4,6,8]", - "--arg1=[1,1,1,1] --arg2=[1,1,1,1]", - "--arg1=[-1,0,1] --arg2=[-2,2]", - "--arg1=[10000] --arg2=[-10000]", - "--arg1=[1,2] --arg2=[1,2,3]" - ], - "hidden_test_results": [ - "1.0", - "3", - "3", - "3.5", - "3.5", - "4.5", - "1.0", - "0", - "0.0", - "2" - ], - "boilerplate": { - "python": "class Solution:\n def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:\n ", - "java": "class Solution {\n public double findMedianSortedArrays(int[] nums1, int[] nums2) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n double findMedianSortedArrays(vector& nums1, vector& nums2) {\n \n }\n};" - }, - "compare_func": { - "python": "return abs(float(result) - float(expected)) < 0.00001", - "java": "return Math.abs(Double.parseDouble(result) - Double.parseDouble(expected)) < 0.00001;", - "cpp": "return std::fabs(static_cast(result) - static_cast(expected)) < 0.00001;" - }, - "explanation": "https://www.youtube.com/watch?v=q6IEA26hvXc&pp=ygUkTmVldENvZGUgTWVkaWFuIG9mIFR3byBTb3J0ZWQgQXJyYXlz", - "method_name": "findMedianSortedArrays" - }, - { - "title": "First Missing Positive", - "source": "https://leetcode.com/problems/first-missing-positive/", - "description": "

Given an unsorted integer array nums. Return the smallest positive integer that is not present in nums.

\n\n

You must implement an algorithm that runs in O(n) time and uses O(1) auxiliary space.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,0]\nOutput: 3\nExplanation: The numbers in the range [1,2] are all in the array.\n
\n\n

Example 2:

\n\n
\nInput: nums = [3,4,-1,1]\nOutput: 2\nExplanation: 1 is in the array but 2 is missing.\n
\n\n

Example 3:

\n\n
\nInput: nums = [7,8,9,11,12]\nOutput: 1\nExplanation: The smallest positive integer 1 is missing.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=[1,2,0]", - "--arg1=[3,4,-1,1]", - "--arg1=[7,8,9,11,12]" - ], - "sample_test_results": [ - "3", - "2", - "1" - ], - "hidden_test_cases": [ - "--arg1=[1]", - "--arg1=[1,1]", - "--arg1=[-1,-2,-3]", - "--arg1=[1,2,3,4,5]", - "--arg1=[2]", - "--arg1=[1,2,4]", - "--arg1=[1,1,1,1,1]", - "--arg1=[2147483647]", - "--arg1=[-2147483648]", - "--arg1=[1,2,3,3,3]" - ], - "hidden_test_results": [ - "2", - "2", - "1", - "6", - "1", - "3", - "2", - "1", - "1", - "4" - ], - "boilerplate": { - "python": "class Solution:\n def firstMissingPositive(self, nums: List[int]) -> int:\n ", - "java": "class Solution {\n public int firstMissingPositive(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int firstMissingPositive(vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=8g78yfzMlao&pp=ygUfTmVldENvZGUgRmlyc3QgTWlzc2luZyBQb3NpdGl2ZQ%3D%3D", - "method_name": "firstMissingPositive" - }, - { - "title": "Permutation Sequence", - "source": "https://leetcode.com/problems/permutation-sequence/", - "description": "

The set [1, 2, 3, ..., n] contains a total of n! unique permutations.

\n\n

By listing and labeling all of the permutations in order, we get the following sequence for n = 3:

\n\n
    \n\t
  1. "123"
  2. \n\t
  3. "132"
  4. \n\t
  5. "213"
  6. \n\t
  7. "231"
  8. \n\t
  9. "312"
  10. \n\t
  11. "321"
  12. \n
\n\n

Given n and k, return the kth permutation sequence.

\n\n

 

\n

Example 1:

\n
Input: n = 3, k = 3\nOutput: \"213\"\n

Example 2:

\n
Input: n = 4, k = 9\nOutput: \"2314\"\n

Example 3:

\n
Input: n = 3, k = 1\nOutput: \"123\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 9
  • \n\t
  • 1 <= k <= n!
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=3 --arg2=3", - "--arg1=4 --arg2=9", - "--arg1=3 --arg2=1" - ], - "sample_test_results": [ - "'213'", - "'2314'", - "'123'" - ], - "hidden_test_cases": [ - "--arg1=1 --arg2=1", - "--arg1=2 --arg2=1", - "--arg1=2 --arg2=2", - "--arg1=3 --arg2=6", - "--arg1=4 --arg2=1", - "--arg1=4 --arg2=24", - "--arg1=5 --arg2=5", - "--arg1=6 --arg2=720", - "--arg1=7 --arg2=1", - "--arg1=8 --arg2=40320" - ], - "hidden_test_results": [ - "'1'", - "'12'", - "'21'", - "'321'", - "'1234'", - "'4321'", - "'12534'", - "'654321'", - "'1234567'", - "'87654321'" - ], - "boilerplate": { - "python": "class Solution:\n def getPermutation(self, n: int, k: int) -> str:\n ", - "java": "class Solution {\n public String getPermutation(int n, int k) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::string getPermutation(int n, int k) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "#include \n#include \n#include // For numeric comparisons, if required\n\nbool compareFunction(const std::string& result, const std::string& expected) {\n std::istringstream resultStream(result);\n std::istringstream expectedStream(expected);\n \n // Assuming the result and expected values are of the same type (e.g., integers, doubles, etc.)\n double resultValue, expectedValue;\n resultStream >> resultValue;\n expectedStream >> expectedValue;\n \n // For numerical comparisons considering the floating-point precision\n return std::abs(resultValue - expectedValue) < 1e-9;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=W9SIlE2jhBQ&pp=ygUdTmVldENvZGUgUGVybXV0YXRpb24gU2VxdWVuY2U%3D", - "method_name": "getPermutation" - }, - { - "title": "Text Justification", - "source": "https://leetcode.com/problems/text-justification/", - "description": "

Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified.

\n\n

You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces ' ' when necessary so that each line has exactly maxWidth characters.

\n\n

Extra spaces between words should be distributed as evenly as possible. If the number of spaces on a line does not divide evenly between words, the empty slots on the left will be assigned more spaces than the slots on the right.

\n\n

For the last line of text, it should be left-justified, and no extra space is inserted between words.

\n\n

Note:

\n\n
    \n\t
  • A word is defined as a character sequence consisting of non-space characters only.
  • \n\t
  • Each word's length is guaranteed to be greater than 0 and not exceed maxWidth.
  • \n\t
  • The input array words contains at least one word.
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: words = ["This", "is", "an", "example", "of", "text", "justification."], maxWidth = 16\nOutput:\n[\n   "This    is    an",\n   "example  of text",\n   "justification.  "\n]
\n\n

Example 2:

\n\n
\nInput: words = ["What","must","be","acknowledgment","shall","be"], maxWidth = 16\nOutput:\n[\n  "What   must   be",\n  "acknowledgment  ",\n  "shall be        "\n]\nExplanation: Note that the last line is "shall be    " instead of "shall     be", because the last line must be left-justified instead of fully-justified.\nNote that the second line is also left-justified because it contains only one word.
\n\n

Example 3:

\n\n
\nInput: words = ["Science","is","what","we","understand","well","enough","to","explain","to","a","computer.","Art","is","everything","else","we","do"], maxWidth = 20\nOutput:\n[\n  "Science  is  what we",\n  "understand      well",\n  "enough to explain to",\n  "a  computer.  Art is",\n  "everything  else  we",\n  "do                  "\n]
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= words.length <= 300
  • \n\t
  • 1 <= words[i].length <= 20
  • \n\t
  • words[i] consists of only English letters and symbols.
  • \n\t
  • 1 <= maxWidth <= 100
  • \n\t
  • words[i].length <= maxWidth
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=['This','is','an','example','of','text','justification.'] --arg2=16", - "--arg1=['What','must','be','acknowledgment','shall','be'] --arg2=16", - "--arg1=['Science','is','what','we','understand','well','enough','to','explain','to','a','computer.','Art','is','everything','else','we','do'] --arg2=20" - ], - "sample_test_results": [ - "['This is an','example of text','justification. ']", - "['What must be','acknowledgment ','shall be ']", - "['Science is what we','understand well','enough to explain to','a computer. Art is','everything else we','do ']" - ], - "hidden_test_cases": [ - "--arg1=['a'] --arg2=1", - "--arg1=['a','b','c'] --arg2=1", - "--arg1=['hello'] --arg2=10", - "--arg1=['a','b','c','d'] --arg2=3", - "--arg1=['This','is','a','test'] --arg2=4", - "--arg1=['ab','cd','ef'] --arg2=10", - "--arg1=['a','b'] --arg2=4", - "--arg1=['word'] --arg2=5", - "--arg1=['a','b','c','d','e'] --arg2=3", - "--arg1=['Hello','World'] --arg2=12" - ], - "hidden_test_results": [ - "['a']", - "['a','b','c']", - "['hello ']", - "['a b','c d']", - "['This','is a','test']", - "['ab cd ef ']", - "['a b ']", - "['word ']", - "['a b','c d','e ']", - "['Hello World ']" - ], - "boilerplate": { - "python": "class Solution:\n def fullJustify(self, words: List[str], maxWidth: int) -> List[str]:\n ", - "java": "class Solution {\n public List fullJustify(List words, int maxWidth) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n vector fullJustify(vector& words, int maxWidth) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoll(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=TzMl4Z7pVh8&pp=ygUbTmVldENvZGUgVGV4dCBKdXN0aWZpY2F0aW9u", - "method_name": "fullJustify" - }, - { - "title": "Minimum Window Substring", - "source": "https://leetcode.com/problems/minimum-window-substring/", - "description": "

Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string "".

\n\n

The testcases will be generated such that the answer is unique.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "ADOBECODEBANC", t = "ABC"\nOutput: "BANC"\nExplanation: The minimum window substring "BANC" includes 'A', 'B', and 'C' from string t.\n
\n\n

Example 2:

\n\n
\nInput: s = "a", t = "a"\nOutput: "a"\nExplanation: The entire string s is the minimum window.\n
\n\n

Example 3:

\n\n
\nInput: s = "a", t = "aa"\nOutput: ""\nExplanation: Both 'a's from t must be included in the window.\nSince the largest window of s only has one 'a', return empty string.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == s.length
  • \n\t
  • n == t.length
  • \n\t
  • 1 <= m, n <= 105
  • \n\t
  • s and t consist of uppercase and lowercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you find an algorithm that runs in O(m + n) time?

\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1='ADOBECODEBANC' --arg2='ABC'", - "--arg1='a' --arg2='a'", - "--arg1='a' --arg2='aa'" - ], - "sample_test_results": [ - "'BANC'", - "'a'", - "''" - ], - "hidden_test_cases": [ - "--arg1='a' --arg2='b'", - "--arg1='ab' --arg2='a'", - "--arg1='ABCDEFG' --arg2='AC'", - "--arg1='aaaaaaa' --arg2='a'", - "--arg1='ADOBECODEBANC' --arg2='ABBC'", - "--arg1='this is a test string' --arg2='tist'", - "--arg1='ADOBECODEBANC' --arg2='ABCDE'", - "--arg1='aaabbaaba' --arg2='abb'", - "--arg1='abc' --arg2='cba'", - "--arg1='bba' --arg2='ab'" - ], - "hidden_test_results": [ - "''", - "'a'", - "'ABC'", - "'a'", - "'BECODEBA'", - "'t stri'", - "'ADOBEC'", - "'abb'", - "'abc'", - "'ba'" - ], - "boilerplate": { - "python": "class Solution:\n def minWindow(self, s: str, t: str) -> str:\n ", - "java": "class Solution {\n public String minWindow(String s, String t) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::string minWindow(std::string s, std::string t) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=jSto0O4AJbM&pp=ygUhTmVldENvZGUgTWluaW11bSBXaW5kb3cgU3Vic3RyaW5n", - "method_name": "minWindow" - }, - { - "title": "Largest Rectangle in Histogram", - "source": "https://leetcode.com/problems/largest-rectangle-in-histogram/", - "description": "

Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: heights = [2,1,5,6,2,3]\nOutput: 10\nExplanation: The above is a histogram where width of each bar is 1.\nThe largest rectangle is shown in the red area, which has an area = 10 units.\n
\n\n

Example 2:

\n\"\"\n
\nInput: heights = [2,4]\nOutput: 4\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= heights.length <= 105
  • \n\t
  • 0 <= heights[i] <= 104
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=[2,1,5,6,2,3]", - "--arg1=[2,4]" - ], - "sample_test_results": [ - "10", - "4" - ], - "hidden_test_cases": [ - "--arg1=[2,1,2]", - "--arg1=[1]", - "--arg1=[0]", - "--arg1=[1,1,1,1]", - "--arg1=[2,1,2,3,1]", - "--arg1=[5,4,3,2,1]", - "--arg1=[1,2,3,4,5]", - "--arg1=[2,2,2,2]", - "--arg1=[1,2,3,4,5,4,3,2,1]", - "--arg1=[0,0,0]" - ], - "hidden_test_results": [ - "3", - "1", - "0", - "4", - "5", - "9", - "9", - "8", - "15", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def largestRectangleArea(self, heights: List[int]) -> int:\n ", - "java": "class Solution {\n public int largestRectangleArea(int[] heights) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int largestRectangleArea(vector& heights) {\n // \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=zx5Sw9130L0&pp=ygUnTmVldENvZGUgTGFyZ2VzdCBSZWN0YW5nbGUgaW4gSGlzdG9ncmFt", - "method_name": "largestRectangleArea" - }, - { - "title": "Maximal Rectangle", - "source": "https://leetcode.com/problems/maximal-rectangle/", - "description": "

Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]\nOutput: 6\nExplanation: The maximal rectangle is shown in the above picture.\n
\n\n

Example 2:

\n\n
\nInput: matrix = [["0"]]\nOutput: 0\n
\n\n

Example 3:

\n\n
\nInput: matrix = [["1"]]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • rows == matrix.length
  • \n\t
  • cols == matrix[i].length
  • \n\t
  • 1 <= row, cols <= 200
  • \n\t
  • matrix[i][j] is '0' or '1'.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=[[\"1\",\"0\",\"1\",\"0\",\"0\"],[\"1\",\"0\",\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\",\"1\",\"1\"],[\"1\",\"0\",\"0\",\"1\",\"0\"]]", - "--arg1=[[\"0\"]]", - "--arg1=[[\"1\"]]" - ], - "sample_test_results": [ - "6", - "0", - "1" - ], - "hidden_test_cases": [ - "--arg1=[[\"1\",\"1\"],[\"1\",\"1\"]]", - "--arg1=[[\"0\",\"0\"],[\"0\",\"0\"]]", - "--arg1=[[\"1\"],[\"1\"]]", - "--arg1=[[\"1\",\"0\"],[\"1\",\"0\"]]", - "--arg1=[[\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\"]]", - "--arg1=[[\"1\",\"0\",\"1\"],[\"0\",\"1\",\"0\"],[\"1\",\"0\",\"1\"]]", - "--arg1=[[\"0\",\"1\"],[\"1\",\"0\"]]", - "--arg1=[[\"1\",\"1\",\"1\"],[\"1\",\"0\",\"1\"],[\"1\",\"1\",\"1\"]]", - "--arg1=[[\"1\"],[\"1\"],[\"1\"]]", - "--arg1=[[\"0\",\"0\",\"0\"],[\"0\",\"0\",\"0\"]]" - ], - "hidden_test_results": [ - "4", - "0", - "2", - "2", - "9", - "1", - "1", - "3", - "3", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def maximalRectangle(self, matrix: List[List[str]]) -> int:\n ", - "java": "class Solution {\n public int maximalRectangle(char[][] matrix) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maximalRectangle(vector>& matrix) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=tOylVCugy9k&pp=ygUaTmVldENvZGUgTWF4aW1hbCBSZWN0YW5nbGU%3D", - "method_name": "maximalRectangle" - }, - { - "title": "Scramble String", - "source": "https://leetcode.com/problems/scramble-string/", - "description": "

We can scramble a string s to get a string t using the following algorithm:

\n\n
    \n\t
  1. If the length of the string is 1, stop.
  2. \n\t
  3. If the length of the string is > 1, do the following:\n\t
      \n\t\t
    • Split the string into two non-empty substrings at a random index, i.e., if the string is s, divide it to x and y where s = x + y.
    • \n\t\t
    • Randomly decide to swap the two substrings or to keep them in the same order. i.e., after this step, s may become s = x + y or s = y + x.
    • \n\t\t
    • Apply step 1 recursively on each of the two substrings x and y.
    • \n\t
    \n\t
  4. \n
\n\n

Given two strings s1 and s2 of the same length, return true if s2 is a scrambled string of s1, otherwise, return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: s1 = "great", s2 = "rgeat"\nOutput: true\nExplanation: One possible scenario applied on s1 is:\n"great" --> "gr/eat" // divide at random index.\n"gr/eat" --> "gr/eat" // random decision is not to swap the two substrings and keep them in order.\n"gr/eat" --> "g/r / e/at" // apply the same algorithm recursively on both substrings. divide at random index each of them.\n"g/r / e/at" --> "r/g / e/at" // random decision was to swap the first substring and to keep the second substring in the same order.\n"r/g / e/at" --> "r/g / e/ a/t" // again apply the algorithm recursively, divide "at" to "a/t".\n"r/g / e/ a/t" --> "r/g / e/ a/t" // random decision is to keep both substrings in the same order.\nThe algorithm stops now, and the result string is "rgeat" which is s2.\nAs one possible scenario led s1 to be scrambled to s2, we return true.\n
\n\n

Example 2:

\n\n
\nInput: s1 = "abcde", s2 = "caebd"\nOutput: false\n
\n\n

Example 3:

\n\n
\nInput: s1 = "a", s2 = "a"\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • s1.length == s2.length
  • \n\t
  • 1 <= s1.length <= 30
  • \n\t
  • s1 and s2 consist of lowercase English letters.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=\"great\" --arg2=\"rgeat\"", - "--arg1=\"abcde\" --arg2=\"caebd\"", - "--arg1=\"a\" --arg2=\"a\"" - ], - "sample_test_results": [ - "true", - "false", - "true" - ], - "hidden_test_cases": [ - "--arg1=\"ab\" --arg2=\"ba\"", - "--arg1=\"abc\" --arg2=\"bac\"", - "--arg1=\"abc\" --arg2=\"cab\"", - "--arg1=\"abb\" --arg2=\"bba\"", - "--arg1=\"aaab\" --arg2=\"abaa\"", - "--arg1=\"abcd\" --arg2=\"bdac\"", - "--arg1=\"abcde\" --arg2=\"badce\"", - "--arg1=\"abc\" --arg2=\"acb\"", - "--arg1=\"abcdbdacbdac\" --arg2=\"bdacabcdbdac\"", - "--arg1=\"xstjzkfpkggnhjzkpfjoguxvkbuopi\" --arg2=\"xbouipkvxugojfpkzjhnggkpfzjts\"" - ], - "hidden_test_results": [ - "true", - "true", - "true", - "true", - "true", - "false", - "true", - "true", - "true", - "false" - ], - "boilerplate": { - "python": "class Solution:\n def isScramble(self, s1: str, s2: str) -> bool:\n ", - "java": "class Solution {\n public boolean isScramble(String s1, String s2) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n bool isScramble(string s1, string s2) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=MDmZm_aVDF8&pp=ygUYTmVldENvZGUgU2NyYW1ibGUgU3RyaW5n", - "method_name": "isScramble" - }, - { - "title": "Distinct Subsequences", - "source": "https://leetcode.com/problems/distinct-subsequences/", - "description": "

Given two strings s and t, return the number of distinct subsequences of s which equals t.

\n\n

The test cases are generated so that the answer fits on a 32-bit signed integer.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "rabbbit", t = "rabbit"\nOutput: 3\nExplanation:\nAs shown below, there are 3 ways you can generate "rabbit" from s.\nrabbbit\nrabbbit\nrabbbit\n
\n\n

Example 2:

\n\n
\nInput: s = "babgbag", t = "bag"\nOutput: 5\nExplanation:\nAs shown below, there are 5 ways you can generate "bag" from s.\nbabgbag\nbabgbag\nbabgbag\nbabgbag\nbabgbag
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length, t.length <= 1000
  • \n\t
  • s and t consist of English letters.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=\"rabbbit\" --arg2=\"rabbit\"", - "--arg1=\"babgbag\" --arg2=\"bag\"" - ], - "sample_test_results": [ - "3", - "5" - ], - "hidden_test_cases": [ - "--arg1=\"a\" --arg2=\"a\"", - "--arg1=\"aa\" --arg2=\"a\"", - "--arg1=\"aaa\" --arg2=\"aa\"", - "--arg1=\"abc\" --arg2=\"abc\"", - "--arg1=\"abcde\" --arg2=\"ace\"", - "--arg1=\"aabb\" --arg2=\"ab\"", - "--arg1=\"xslledayhxhadmctrliaxqpokyezcfhzaskeykchkmhpyjipxtsuljkwkovmvelvwxzwieeuqnjozrfwmzsylcwvsthnxujvrkszqwtglewkycikdaiocglwzukwovsghkhyidevhbgffoqkpabthmqihcfxxzdejletqjoxmwftlxfcxgxgvpperwbqvhxgsbbkmphyomtbjzdjhcrcsggleiczpbfjcgtpycpmrjnckslrwduqlccqmgrdhxolfjafmsrfdghnatexyanldrdpxvvgujsztuffoymrfteholgonuaqndinadtumnuhkboyzaqguwqijwxxszngextfcozpetyownmyneehdwqmtpjloztswmzzdzqhuoxrblppqvyvsqhnhryvqsqogpnlqfulurexdtovqpqkfxxnqykgscxaskmksivoazlducanrqxynxlgvwonalpsyddqmaemcrrwvrjmjjnygyebwtqxehrclwsxzylbqexnxjcgspeynlbmetlkacnnbhmaizbadynajpibepbuacggxrqavfnwpcwxbzxfymhjcslghmajrirqzjqxpgtgisfjreqrqabssobbadmtmdknmakdigjqyqcruujlwmfoagrckdwyiglviyyrekjealvvigiesnvuumxgsveadrxlpwetioxibtdjblowblqvzpbrmhupyrdophjxvhgzclidzybajuxllacyhyphssvhcffxonysahvzhzbttyeeyiefhunbokiqrpqfcoxdxvefugapeevdoakxwzykmhbdytjbhigffkmbqmqxsoaiomgmmgwapzdosorcxxhejvgajyzdmzlcntqbapbpofdjtulstuzdrffafedufqwsknumcxbschdybosxkrabyfdejgyozwillcxpcaiehlelczioskqtptzaczobvyojdlyflilvwqgyrqmjaeepydrcchfyftjighntqzoo\" --arg2=\"rwmimatmhydhbujebqehjprarwfkoebcxxqfktayaaeheys\"", - "--arg1=\"aaaaaaaaaa\" --arg2=\"aaaaaaa\"", - "--arg1=\"abcdef\" --arg2=\"xyz\"", - "--arg1=\"wbyhqihmwwux\" --arg2=\"byhwu\"" - ], - "hidden_test_results": [ - "1", - "2", - "3", - "1", - "1", - "4", - "1456742400", - "120", - "0", - "4" - ], - "boilerplate": { - "python": "class Solution:\n def numDistinct(self, s: str, t: str) -> int:\n ", - "java": "class Solution {\n public int numDistinct(String s, String t) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int numDistinct(std::string s, std::string t) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=-RDzMJ33nx8&pp=ygUeTmVldENvZGUgRGlzdGluY3QgU3Vic2VxdWVuY2Vz", - "method_name": "numDistinct" - }, - { - "title": "Best Time to Buy and Sell Stock III", - "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/", - "description": "

You are given an array prices where prices[i] is the price of a given stock on the ith day.

\n\n

Find the maximum profit you can achieve. You may complete at most two transactions.

\n\n

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

\n\n

 

\n

Example 1:

\n\n
\nInput: prices = [3,3,5,0,0,3,1,4]\nOutput: 6\nExplanation: Buy on day 4 (price = 0) and sell on day 6 (price = 3), profit = 3-0 = 3.\nThen buy on day 7 (price = 1) and sell on day 8 (price = 4), profit = 4-1 = 3.
\n\n

Example 2:

\n\n
\nInput: prices = [1,2,3,4,5]\nOutput: 4\nExplanation: Buy on day 1 (price = 1) and sell on day 5 (price = 5), profit = 5-1 = 4.\nNote that you cannot buy on day 1, buy on day 2 and sell them later, as you are engaging multiple transactions at the same time. You must sell before buying again.\n
\n\n

Example 3:

\n\n
\nInput: prices = [7,6,4,3,1]\nOutput: 0\nExplanation: In this case, no transaction is done, i.e. max profit = 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= prices.length <= 105
  • \n\t
  • 0 <= prices[i] <= 105
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=[3,3,5,0,0,3,1,4]", - "--arg1=[1,2,3,4,5]", - "--arg1=[7,6,4,3,1]" - ], - "sample_test_results": [ - "6", - "4", - "0" - ], - "hidden_test_cases": [ - "--arg1=[1]", - "--arg1=[1,2]", - "--arg1=[2,1]", - "--arg1=[1,2,4,2,5,7,2,4,9,0]", - "--arg1=[0,0,0,0]", - "--arg1=[1,2,3,4,5,4,3,2,1]", - "--arg1=[3,2,6,5,0,3]", - "--arg1=[1,4,5,7,6,3,2,9]", - "--arg1=[8,3,6,2,8,8,8,4,2,0,7,2,9,4,9]", - "--arg1=[1,2,4,2,5,7,2,4,9,0,9]" - ], - "hidden_test_results": [ - "0", - "1", - "0", - "13", - "0", - "4", - "7", - "13", - "15", - "17" - ], - "boilerplate": { - "python": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", - "java": "class Solution {\n public int maxProfit(List prices) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maxProfit(vector& prices) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=37s1_xBiqH0&pp=ygUsTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJSUk%3D", - "method_name": "maxProfit" - }, - { - "title": "Word Ladder", - "source": "https://leetcode.com/problems/word-ladder/", - "description": "

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that:

\n\n
    \n\t
  • Every adjacent pair of words differs by a single letter.
  • \n\t
  • Every si for 1 <= i <= k is in wordList. Note that beginWord does not need to be in wordList.
  • \n\t
  • sk == endWord
  • \n
\n\n

Given two words, beginWord and endWord, and a dictionary wordList, return the number of words in the shortest transformation sequence from beginWord to endWord, or 0 if no such sequence exists.

\n\n

 

\n

Example 1:

\n\n
\nInput: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]\nOutput: 5\nExplanation: One shortest transformation sequence is "hit" -> "hot" -> "dot" -> "dog" -> cog", which is 5 words long.\n
\n\n

Example 2:

\n\n
\nInput: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"]\nOutput: 0\nExplanation: The endWord "cog" is not in wordList, therefore there is no valid transformation sequence.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= beginWord.length <= 10
  • \n\t
  • endWord.length == beginWord.length
  • \n\t
  • 1 <= wordList.length <= 5000
  • \n\t
  • wordList[i].length == beginWord.length
  • \n\t
  • beginWord, endWord, and wordList[i] consist of lowercase English letters.
  • \n\t
  • beginWord != endWord
  • \n\t
  • All the words in wordList are unique.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1='hit' --arg2='cog' --arg3=['hot','dot','dog','lot','log','cog']", - "--arg1='hit' --arg2='cog' --arg3=['hot','dot','dog','lot','log']", - "--arg1='lost' --arg2='cost' --arg3=['most','cost','lost']" - ], - "sample_test_results": [ - "5", - "0", - "2" - ], - "hidden_test_cases": [ - "--arg1='hit' --arg2='dog' --arg3=['hot','dot','dog']", - "--arg1='cat' --arg2='rat' --arg3=['hat','rat','cat']", - "--arg1='a' --arg2='c' --arg3=['a','b','c']", - "--arg1='red' --arg2='tax' --arg3=['ted','tex','red','tax','tad']", - "--arg1='log' --arg2='dog' --arg3=['fog','fig','dig','dog','log']", - "--arg1='abc' --arg2='def' --arg3=['abf','acf','aef','def']", - "--arg1='hot' --arg2='dog' --arg3=['hot','dog']", - "--arg1='hit' --arg2='cog' --arg3=[]", - "--arg1='cat' --arg2='cat' --arg3=['cat']", - "--arg1='hit' --arg2='hat' --arg3=['hat','hot']" - ], - "hidden_test_results": [ - "4", - "2", - "2", - "4", - "2", - "4", - "0", - "0", - "2", - "2" - ], - "boilerplate": { - "python": "class Solution:\n def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:\n ", - "java": "class Solution {\n public int ladderLength(String beginWord, String endWord, List wordList) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int ladderLength(string beginWord, string endWord, vector& wordList) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=h9iTnkgv05E&pp=ygUUTmVldENvZGUgV29yZCBMYWRkZXI%3D", - "method_name": "ladderLength" - }, - { - "title": "Candy", - "source": "https://leetcode.com/problems/candy/", - "description": "

There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings.

\n\n

You are giving candies to these children subjected to the following requirements:

\n\n
    \n\t
  • Each child must have at least one candy.
  • \n\t
  • Children with a higher rating get more candies than their neighbors.
  • \n
\n\n

Return the minimum number of candies you need to have to distribute the candies to the children.

\n\n

 

\n

Example 1:

\n\n
\nInput: ratings = [1,0,2]\nOutput: 5\nExplanation: You can allocate to the first, second and third child with 2, 1, 2 candies respectively.\n
\n\n

Example 2:

\n\n
\nInput: ratings = [1,2,2]\nOutput: 4\nExplanation: You can allocate to the first, second and third child with 1, 2, 1 candies respectively.\nThe third child gets 1 candy because it satisfies the above two conditions.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == ratings.length
  • \n\t
  • 1 <= n <= 2 * 104
  • \n\t
  • 0 <= ratings[i] <= 2 * 104
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=[1,0,2]", - "--arg1=[1,2,2]", - "--arg1=[1,3,2,2,1]" - ], - "sample_test_results": [ - "5", - "4", - "7" - ], - "hidden_test_cases": [ - "--arg1=[1,2,3,4,5]", - "--arg1=[5,4,3,2,1]", - "--arg1=[1,1,1,1,1]", - "--arg1=[1,3,4,5,2]", - "--arg1=[1,2,87,87,87,2,1]", - "--arg1=[1,2,2,3,1,2]", - "--arg1=[0]", - "--arg1=[1,0,1,0,1]", - "--arg1=[2,0,1,0,2]", - "--arg1=[1,6,10,8,7,3,2]" - ], - "hidden_test_results": [ - "15", - "15", - "5", - "11", - "13", - "9", - "1", - "8", - "8", - "18" - ], - "boilerplate": { - "python": "class Solution:\n def candy(self, ratings: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int candy(List ratings) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int candy(vector& ratings) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=1IzCRCcK17A&pp=ygUOTmVldENvZGUgQ2FuZHk%3D", - "method_name": "candy" - }, - { - "title": "Word Break II", - "source": "https://leetcode.com/problems/word-break-ii/", - "description": "

Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order.

\n\n

Note that the same word in the dictionary may be reused multiple times in the segmentation.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "catsanddog", wordDict = ["cat","cats","and","sand","dog"]\nOutput: ["cats and dog","cat sand dog"]\n
\n\n

Example 2:

\n\n
\nInput: s = "pineapplepenapple", wordDict = ["apple","pen","applepen","pine","pineapple"]\nOutput: ["pine apple pen apple","pineapple pen apple","pine applepen apple"]\nExplanation: Note that you are allowed to reuse a dictionary word.\n
\n\n

Example 3:

\n\n
\nInput: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"]\nOutput: []\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 20
  • \n\t
  • 1 <= wordDict.length <= 1000
  • \n\t
  • 1 <= wordDict[i].length <= 10
  • \n\t
  • s and wordDict[i] consist of only lowercase English letters.
  • \n\t
  • All the strings of wordDict are unique.
  • \n\t
  • Input is generated in a way that the length of the answer doesn't exceed 105.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1='catsanddog' --arg2=['cat','cats','and','sand','dog']", - "--arg1='pineapplepenapple' --arg2=['apple','pen','applepen','pine','pineapple']", - "--arg1='catsandog' --arg2=['cats','dog','sand','and','cat']" - ], - "sample_test_results": [ - "['cat sand dog','cats and dog']", - "['pine apple pen apple','pine applepen apple','pineapple pen apple']", - "[]" - ], - "hidden_test_cases": [ - "--arg1='leetcode' --arg2=['leet','code']", - "--arg1='applepenapple' --arg2=['apple','pen']", - "--arg1='a' --arg2=['a']", - "--arg1='aaaa' --arg2=['a','aa','aaa']", - "--arg1='cars' --arg2=['car','ca','rs']", - "--arg1='bb' --arg2=['a','b','bbb']", - "--arg1='catsanddogs' --arg2=['cats','cat','and','sand','dog','dogs']", - "--arg1='ab' --arg2=['a','b']", - "--arg1='impossible' --arg2=['imp','possible']", - "--arg1='aaa' --arg2=['a','aa']" - ], - "hidden_test_results": [ - "['leet code']", - "['apple pen apple']", - "['a']", - "['a a a a','a a aa','a aa a','a aaa','aa a a','aa aa','aaa a']", - "['ca rs']", - "['b b']", - "['cat sand dogs','cats and dogs']", - "['a b']", - "[]", - "['a a a','a aa','aa a']" - ], - "boilerplate": { - "python": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> List[str]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List wordBreak(String s, List wordDict) {\n // Your code here\n return new ArrayList<>();\n }\n}", - "cpp": "class Solution {\npublic:\n std::vector wordBreak(std::string s, const std::vector& wordDict) {\n \n }\n};" - }, - "compare_func": { - "python": "def normalize(s): return sorted([x.strip() for x in eval(s)])\n return normalize(str(result)) == normalize(expected)", - "java": "import java.util.List;\nimport java.util.Arrays;\nimport java.util.stream.Collectors;\n\npublic class Solution {\n public boolean compareFunction(String result, String expected) {\n List normalize(String s) {\n return Arrays.stream(s.split(\",\"))\n .map(String::strip)\n .sorted()\n .collect(Collectors.toList());\n }\n\n return normalize(result).equals(normalize(expected));\n }\n}", - "cpp": "bool compareFunction(string result, string expected) {\n // Function to normalize and evaluate a string expression\n auto normalize = [](const string& s) -> vector {\n string trimmed;\n vector elements;\n stringstream ss(eval(s));\n while (getline(ss, trimmed, ',')) {\n trimmed.erase(trimmed.find_last_not_of(' ') + 1); // Trim right\n trimmed.erase(0, trimmed.find_first_not_of(' ')); // Trim left\n elements.push_back(trimmed);\n }\n sort(elements.begin(), elements.end());\n return elements;\n };\n return normalize(result) == normalize(expected);\n}" - }, - "explanation": "https://www.youtube.com/watch?v=QgLKdluDo08&pp=ygUWTmVldENvZGUgV29yZCBCcmVhayBJSQ%3D%3D", - "method_name": "wordBreak" - }, - { - "title": "Find Minimum in Rotated Sorted Array II", - "source": "https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/", - "description": "

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become:

\n\n
    \n\t
  • [4,5,6,7,0,1,4] if it was rotated 4 times.
  • \n\t
  • [0,1,4,4,5,6,7] if it was rotated 7 times.
  • \n
\n\n

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

\n\n

Given the sorted rotated array nums that may contain duplicates, return the minimum element of this array.

\n\n

You must decrease the overall operation steps as much as possible.

\n\n

 

\n

Example 1:

\n
Input: nums = [1,3,5]\nOutput: 1\n

Example 2:

\n
Input: nums = [2,2,2,0,1]\nOutput: 0\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • n == nums.length
  • \n\t
  • 1 <= n <= 5000
  • \n\t
  • -5000 <= nums[i] <= 5000
  • \n\t
  • nums is sorted and rotated between 1 and n times.
  • \n
\n\n

 

\n

Follow up: This problem is similar to Find Minimum in Rotated Sorted Array, but nums may contain duplicates. Would this affect the runtime complexity? How and why?

\n\n

 

\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=[1,3,5]", - "--arg1=[2,2,2,0,1]", - "--arg1=[3,1,3]" - ], - "sample_test_results": [ - "1", - "0", - "1" - ], - "hidden_test_cases": [ - "--arg1=[1,1,1,1,1]", - "--arg1=[3,3,1,3]", - "--arg1=[2,2,2,0,1,2]", - "--arg1=[4,5,6,7,0,1,2]", - "--arg1=[1,1,1,0,1]", - "--arg1=[3,4,5,1,2]", - "--arg1=[5,1,2,3,4]", - "--arg1=[2,2,2,2,2,2]", - "--arg1=[3,1,1,1,1]", - "--arg1=[4,4,5,5,6,6,7,0]" - ], - "hidden_test_results": [ - "1", - "1", - "0", - "0", - "0", - "1", - "1", - "2", - "1", - "0" - ], - "boilerplate": { - "python": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", - "java": "class Solution {\n public int findMin(List nums) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int findMin(std::vector& nums) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=oUnF7o88_Xc&pp=ygUwTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5IElJ", - "method_name": "findMin" - }, - { - "title": "Best Time to Buy and Sell Stock IV", - "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/", - "description": "

You are given an integer array prices where prices[i] is the price of a given stock on the ith day, and an integer k.

\n\n

Find the maximum profit you can achieve. You may complete at most k transactions: i.e. you may buy at most k times and sell at most k times.

\n\n

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

\n\n

 

\n

Example 1:

\n\n
\nInput: k = 2, prices = [2,4,1]\nOutput: 2\nExplanation: Buy on day 1 (price = 2) and sell on day 2 (price = 4), profit = 4-2 = 2.\n
\n\n

Example 2:

\n\n
\nInput: k = 2, prices = [3,2,6,5,0,3]\nOutput: 7\nExplanation: Buy on day 2 (price = 2) and sell on day 3 (price = 6), profit = 6-2 = 4. Then buy on day 5 (price = 0) and sell on day 6 (price = 3), profit = 3-0 = 3.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= k <= 100
  • \n\t
  • 1 <= prices.length <= 1000
  • \n\t
  • 0 <= prices[i] <= 1000
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=2 --arg2=[2,4,1]", - "--arg1=2 --arg2=[3,2,6,5,0,3]", - "--arg1=1 --arg2=[1,2]" - ], - "sample_test_results": [ - "2", - "7", - "1" - ], - "hidden_test_cases": [ - "--arg1=2 --arg2=[1,2,4,2,5,7,2,4,9,0]", - "--arg1=1 --arg2=[7,1,5,3,6,4]", - "--arg1=3 --arg2=[3,3,5,0,0,3,1,4]", - "--arg1=4 --arg2=[1,2,3,4,5]", - "--arg1=2 --arg2=[1,4,5,7,6,3,2,1]", - "--arg1=3 --arg2=[1]", - "--arg1=1 --arg2=[7,6,5,4,3,2]", - "--arg1=2 --arg2=[1,2,3,4,5,6]", - "--arg1=5 --arg2=[3,2,6,5,0,3,1,4]", - "--arg1=2 --arg2=[2,1,4,5,2,9,7]" - ], - "hidden_test_results": [ - "13", - "5", - "8", - "4", - "6", - "0", - "0", - "5", - "10", - "11" - ], - "boilerplate": { - "python": "class Solution:\n def maxProfit(self, k: int, prices: List[int]) -> int:\n ", - "java": "import java.util.List;\n\nclass Solution {\n public int maxProfit(int k, List prices) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int maxProfit(int k, vector& prices) {\n \n }\n};" - }, - "compare_func": { - "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "std::to_string(result) == expected" - }, - "explanation": "https://www.youtube.com/watch?v=NshLjAWa03c&pp=ygUrTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJVg%3D%3D", - "method_name": "maxProfit" - }, - { - "title": "The Skyline Problem", - "source": "https://leetcode.com/problems/the-skyline-problem/", - "description": "

A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of all the buildings, return the skyline formed by these buildings collectively.

\n\n

The geometric information of each building is given in the array buildings where buildings[i] = [lefti, righti, heighti]:

\n\n
    \n\t
  • lefti is the x coordinate of the left edge of the ith building.
  • \n\t
  • righti is the x coordinate of the right edge of the ith building.
  • \n\t
  • heighti is the height of the ith building.
  • \n
\n\n

You may assume all buildings are perfect rectangles grounded on an absolutely flat surface at height 0.

\n\n

The skyline should be represented as a list of "key points" sorted by their x-coordinate in the form [[x1,y1],[x2,y2],...]. Each key point is the left endpoint of some horizontal segment in the skyline except the last point in the list, which always has a y-coordinate 0 and is used to mark the skyline's termination where the rightmost building ends. Any ground between the leftmost and rightmost buildings should be part of the skyline's contour.

\n\n

Note: There must be no consecutive horizontal lines of equal height in the output skyline. For instance, [...,[2 3],[4 5],[7 5],[11 5],[12 7],...] is not acceptable; the three lines of height 5 should be merged into one in the final output as such: [...,[2 3],[4 5],[12 7],...]

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: buildings = [[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]\nOutput: [[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]\nExplanation:\nFigure A shows the buildings of the input.\nFigure B shows the skyline formed by those buildings. The red points in figure B represent the key points in the output list.\n
\n\n

Example 2:

\n\n
\nInput: buildings = [[0,2,3],[2,5,3]]\nOutput: [[0,3],[5,0]]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= buildings.length <= 104
  • \n\t
  • 0 <= lefti < righti <= 231 - 1
  • \n\t
  • 1 <= heighti <= 231 - 1
  • \n\t
  • buildings is sorted by lefti in non-decreasing order.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=[[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]", - "--arg1=[[0,2,3],[2,5,3]]" - ], - "sample_test_results": [ - "[[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]", - "[[0,3],[5,0]]" - ], - "hidden_test_cases": [ - "--arg1=[[1,5,11],[2,7,6],[3,9,13],[12,16,7],[14,25,3],[19,22,18],[23,29,13],[24,28,4]]", - "--arg1=[[1,2,1],[1,2,2],[1,2,3]]", - "--arg1=[[1,10,10]]", - "--arg1=[[1,5,3],[2,4,4]]", - "--arg1=[[1,5,11],[2,3,13]]", - "--arg1=[[0,3,3],[1,5,3],[2,4,3]]", - "--arg1=[[2,4,70],[3,8,30],[6,100,41],[7,15,70],[10,30,102],[15,25,76],[60,80,91],[70,90,72],[85,120,59]]", - "--arg1=[[1,20,1],[1,21,2],[1,22,3]]", - "--arg1=[[0,5,7],[5,10,7],[5,10,12],[10,15,7],[15,20,7],[15,20,12],[20,25,7]]", - "--arg1=[[1,2,1]]" - ], - "hidden_test_results": [ - "[[1,11],[3,13],[9,0],[12,7],[16,3],[19,18],[22,3],[23,13],[29,0]]", - "[[1,3],[2,0]]", - "[[1,10],[10,0]]", - "[[1,3],[2,4],[4,3],[5,0]]", - "[[1,11],[2,13],[3,11],[5,0]]", - "[[0,3],[5,0]]", - "[[2,70],[4,30],[6,41],[7,70],[10,102],[30,41],[60,91],[80,72],[90,59],[120,0]]", - "[[1,3],[22,0]]", - "[[0,7],[5,12],[10,7],[15,12],[20,7],[25,0]]", - "[[1,1],[2,0]]" - ], - "boilerplate": { - "python": "class Solution:\n def getSkyline(self, buildings: List[List[int]]) -> List[List[int]]:\n ", - "java": "class Solution {\n public List> getSkyline(List> buildings) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n vector> getSkyline(vector>& buildings) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(expected);", - "cpp": "return result == std::stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=XhzHXj7wrwo&pp=ygUcTmVldENvZGUgVGhlIFNreWxpbmUgUHJvYmxlbQ%3D%3D", - "method_name": "getSkyline" - }, - { - "title": "Basic Calculator", - "source": "https://leetcode.com/problems/basic-calculator/", - "description": "

Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation.

\n\n

Note: You are not allowed to use any built-in function which evaluates strings as mathematical expressions, such as eval().

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "1 + 1"\nOutput: 2\n
\n\n

Example 2:

\n\n
\nInput: s = " 2-1 + 2 "\nOutput: 3\n
\n\n

Example 3:

\n\n
\nInput: s = "(1+(4+5+2)-3)+(6+8)"\nOutput: 23\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 3 * 105
  • \n\t
  • s consists of digits, '+', '-', '(', ')', and ' '.
  • \n\t
  • s represents a valid expression.
  • \n\t
  • '+' is not used as a unary operation (i.e., "+1" and "+(2 + 3)" is invalid).
  • \n\t
  • '-' could be used as a unary operation (i.e., "-1" and "-(2 + 3)" is valid).
  • \n\t
  • There will be no two consecutive operators in the input.
  • \n\t
  • Every number and running calculation will fit in a signed 32-bit integer.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=\"1 + 1\"", - "--arg1=\" 2-1 + 2 \"", - "--arg1=\"(1+(4+5+2)-3)+(6+8)\"" - ], - "sample_test_results": [ - "2", - "3", - "23" - ], - "hidden_test_cases": [ - "--arg1=\"2147483647\"", - "--arg1=\"1 + (2 + 3)\"", - "--arg1=\"-(2 + 3)\"", - "--arg1=\"(1+(4+5+2)-3)+(6+8)\"", - "--arg1=\"2-4-(8+2-6+(8+4-(1)+8-10))\"", - "--arg1=\"(5-(1+(5)))\"", - "--arg1=\"(-2)+3\"", - "--arg1=\"1-(-2)\"", - "--arg1=\"1+2-3+(4+5-6)\"", - "--arg1=\"(7)-(0)+(4)\"" - ], - "hidden_test_results": [ - "2147483647", - "6", - "-5", - "23", - "-15", - "-1", - "1", - "3", - "3", - "11" - ], - "boilerplate": { - "python": "class Solution:\n def calculate(self, s: str) -> int:\n ", - "java": "class Solution {\n public int calculate(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n int calculate(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return stoi(result) == stoi(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=zsJ-J08Qgdk&pp=ygUZTmVldENvZGUgQmFzaWMgQ2FsY3VsYXRvcg%3D%3D", - "method_name": "calculate" - }, - { - "title": "Sliding Window Maximum", - "source": "https://leetcode.com/problems/sliding-window-maximum/", - "description": "

You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.

\n\n

Return the max sliding window.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,3,-1,-3,5,3,6,7], k = 3\nOutput: [3,3,5,5,6,7]\nExplanation: \nWindow position                Max\n---------------               -----\n[1  3  -1] -3  5  3  6  7       3\n 1 [3  -1  -3] 5  3  6  7       3\n 1  3 [-1  -3  5] 3  6  7       5\n 1  3  -1 [-3  5  3] 6  7       5\n 1  3  -1  -3 [5  3  6] 7       6\n 1  3  -1  -3  5 [3  6  7]      7\n
\n\n

Example 2:

\n\n
\nInput: nums = [1], k = 1\nOutput: [1]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • 1 <= k <= nums.length
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=[1,3,-1,-3,5,3,6,7] --arg2=3", - "--arg1=[1] --arg2=1" - ], - "sample_test_results": [ - "[3,3,5,5,6,7]", - "[1]" - ], - "hidden_test_cases": [ - "--arg1=[1,3,1,2,0,5] --arg2=3", - "--arg1=[7,2,4] --arg2=2", - "--arg1=[1,-1] --arg2=1", - "--arg1=[1,2,3,4,5] --arg2=5", - "--arg1=[1,2,3,4,5,6] --arg2=1", - "--arg1=[-7,-8,7,5,7,1,6,0] --arg2=4", - "--arg1=[1,1,1,1] --arg2=2", - "--arg1=[4,2,0,-1,3,5] --arg2=3", - "--arg1=[-1,-2,-3,-4] --arg2=2", - "--arg1=[1,2,3,2,1] --arg2=3" - ], - "hidden_test_results": [ - "[3,3,2,5]", - "[7,4]", - "[1,-1]", - "[5]", - "[1,2,3,4,5,6]", - "[7,7,7,7,7]", - "[1,1,1]", - "[4,2,3,5]", - "[-1,-2,-3]", - "[3,3,3]" - ], - "boilerplate": { - "python": "class Solution:\n def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:\n ", - "java": "class Solution {\n public List maxSlidingWindow(List nums, int k) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n std::vector maxSlidingWindow(std::vector& nums, int k) {\n \n }\n};" - }, - "compare_func": { - "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == eval(expected);" - }, - "explanation": "https://www.youtube.com/watch?v=DfljaUwZsOk&pp=ygUfTmVldENvZGUgU2xpZGluZyBXaW5kb3cgTWF4aW11bQ%3D%3D", - "method_name": "maxSlidingWindow" - }, - { - "title": "Expression Add Operators", - "source": "https://leetcode.com/problems/expression-add-operators/", - "description": "

Given a string num that contains only digits and an integer target, return all possibilities to insert the binary operators '+', '-', and/or '*' between the digits of num so that the resultant expression evaluates to the target value.

\n\n

Note that operands in the returned expressions should not contain leading zeros.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = "123", target = 6\nOutput: ["1*2*3","1+2+3"]\nExplanation: Both "1*2*3" and "1+2+3" evaluate to 6.\n
\n\n

Example 2:

\n\n
\nInput: num = "232", target = 8\nOutput: ["2*3+2","2+3*2"]\nExplanation: Both "2*3+2" and "2+3*2" evaluate to 8.\n
\n\n

Example 3:

\n\n
\nInput: num = "3456237490", target = 9191\nOutput: []\nExplanation: There are no expressions that can be created from "3456237490" to evaluate to 9191.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num.length <= 10
  • \n\t
  • num consists of only digits.
  • \n\t
  • -231 <= target <= 231 - 1
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=\"123\" --arg2=6", - "--arg1=\"232\" --arg2=8", - "--arg1=\"3456237490\" --arg2=9191" - ], - "sample_test_results": [ - "['1+2+3','1*2*3']", - "['2+3*2','2*3+2']", - "[]" - ], - "hidden_test_cases": [ - "--arg1=\"123\" --arg2=6", - "--arg1=\"232\" --arg2=8", - "--arg1=\"105\" --arg2=5", - "--arg1=\"00\" --arg2=0", - "--arg1=\"3456237490\" --arg2=9191", - "--arg1=\"1000000009\" --arg2=9", - "--arg1=\"2147483648\" --arg2=-2147483648", - "--arg1=\"999999999\" --arg2=999999999", - "--arg1=\"01\" --arg2=1", - "--arg1=\"1234\" --arg2=11" - ], - "hidden_test_results": [ - "['1+2+3','1*2*3']", - "['2+3*2','2*3+2']", - "['1*0+5','10-5']", - "['0+0','0-0','0*0']", - "[]", - "['1*0+0+0+0+0+0+0+0+9','1*0+0+0+0+0+0+0-0+9','1*0+0+0+0+0+0+0*0+9','1*0+0+0+0+0+0-0+0+9','1*0+0+0+0+0+0-0-0+9','1*0+0+0+0+0+0-0*0+9','1*0+0+0+0+0+0*0+0+9','1*0+0+0+0+0+0*0-0+9','1*0+0+0+0+0+0*0*0+9','1*0+0+0+0+0-0+0+0+9','1*0+0+0+0+0-0+0-0+9','1*0+0+0+0+0-0+0*0+9','1*0+0+0+0+0-0-0+0+9','1*0+0+0+0+0-0-0-0+9','1*0+0+0+0+0-0-0*0+9','1*0+0+0+0+0-0*0+0+9','1*0+0+0+0+0-0*0-0+9','1*0+0+0+0+0-0*0*0+9','1*0+0+0+0+0*0+0+0+9','1*0+0+0+0+0*0+0-0+9','1*0+0+0+0+0*0+0*0+9','1*0+0+0+0+0*0-0+0+9','1*0+0+0+0+0*0-0-0+9','1*0+0+0+0+0*0-0*0+9','1*0+0+0+0+0*0*0+0+9','1*0+0+0+0+0*0*0-0+9','1*0+0+0+0+0*0*0*0+9','1*0+0+0+0-0+0+0+0+9','1*0+0+0+0-0+0+0-0+9','1*0+0+0+0-0+0+0*0+9','1*0+0+0+0-0+0-0+0+9','1*0+0+0+0-0+0-0-0+9','1*0+0+0+0-0+0-0*0+9','1*0+0+0+0-0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','1*0+0+0-0*0+0+0-0+9','1*0+0+0-0*0+0+0*0+9','1*0+0+0-0*0+0-0+0+9','1*0+0+0-0*0+0-0-0+9','1*0+0+0-0*0+0-0*0+9','1*0+0+0-0*0+0*0+0+9','1*0+0+0-0*0+0*0-0+9','1*0+0+0-0*0+0*0*0+9','1*0+0+0-0*0-0+0+0+9','1*0+0+0-0*0-0+0-0+9','1*0+0+0-0*0-0+0*0+9','1*0+0+0-0*0-0-0+0+9','1*0+0+0-0*0-0-0-0+9','1*0+0+0-0*0-0-0*0+9','1*0+0+0-0*0-0*0+0+9','1*0+0+0-0*0-0*0-0+9','1*0+0+0-0*0-0*0*0+9','1*0+0+0-0*0*0+0+0+9','1*0+0+0-0*0*0+0-0+9','1*0+0+0-0*0*0+0*0+9','1*0+0+0-0*0*0-0+0+9','1*0+0+0-0*0*0-0-0+9','1*0+0+0-0*0*0-0*0+9','1*0+0+0-0*0*0*0+0+9','1*0+0+0-0*0*0*0-0+9','1*0+0+0-0*0*0*0*0+9','1*0+0+0*0+0+0+0+0+9','1*0+0+0*0+0+0+0-0+9','1*0+0+0*0+0+0+0*0+9','1*0+0+0*0+0+0-0+0+9','1*0+0+0*0+0+0-0-0+9','1*0+0+0*0+0+0-0*0+9','1*0+0+0*0+0+0*0+0+9','1*0+0+0*0+0+0*0-0+9','1*0+0+0*0+0+0*0*0+9','1*0+0+0*0+0-0+0+0+9','1*0+0+0*0+0-0+0-0+9','1*0+0+0*0+0-0+0*0+9','1*0+0+0*0+0-0-0+0+9','1*0+0+0*0+0-0-0-0+9','1*0+0+0*0+0-0-0*0+9','1*0+0+0*0+0-0*0+0+9','1*0+0+0*0+0-0*0-0+9','1*0+0+0*0+0-0*0*0+9','1*0+0+0*0+0*0+0+0+9','1*0+0+0*0+0*0+0-0+9','1*0+0+0*0+0*0+0*0+9','1*0+0+0*0+0*0-0+0+9','1*0+0+0*0+0*0-0-0+9','1*0+0+0*0+0*0-0*0+9','1*0+0+0*0+0*0*0+0+9','1*0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','1*0+0-0-0*0-0-0*0+9','1*0+0-0-0*0-0*0+0+9','1*0+0-0-0*0-0*0-0+9','1*0+0-0-0*0-0*0*0+9','1*0+0-0-0*0*0+0+0+9','1*0+0-0-0*0*0+0-0+9','1*0+0-0-0*0*0+0*0+9','1*0+0-0-0*0*0-0+0+9','1*0+0-0-0*0*0-0-0+9','1*0+0-0-0*0*0-0*0+9','1*0+0-0-0*0*0*0+0+9','1*0+0-0-0*0*0*0-0+9','1*0+0-0-0*0*0*0*0+9','1*0+0-0*0+0+0+0+0+9','1*0+0-0*0+0+0+0-0+9','1*0+0-0*0+0+0+0*0+9','1*0+0-0*0+0+0-0+0+9','1*0+0-0*0+0+0-0-0+9','1*0+0-0*0+0+0-0*0+9','1*0+0-0*0+0+0*0+0+9','1*0+0-0*0+0+0*0-0+9','1*0+0-0*0+0+0*0*0+9','1*0+0-0*0+0-0+0+0+9','1*0+0-0*0+0-0+0-0+9','1*0+0-0*0+0-0+0*0+9','1*0+0-0*0+0-0-0+0+9','1*0+0-0*0+0-0-0-0+9','1*0+0-0*0+0-0-0*0+9','1*0+0-0*0+0-0*0+0+9','1*0+0-0*0+0-0*0-0+9','1*0+0-0*0+0-0*0*0+9','1*0+0-0*0+0*0+0+0+9','1*0+0-0*0+0*0+0-0+9','1*0+0-0*0+0*0+0*0+9','1*0+0-0*0+0*0-0+0+9','1*0+0-0*0+0*0-0-0+9','1*0+0-0*0+0*0-0*0+9','1*0+0-0*0+0*0*0+0+9','1*0+0-0*0+0*0*0-0+9','1*0+0-0*0+0*0*0*0+9','1*0+0-0*0-0+0+0+0+9','1*0+0-0*0-0+0+0-0+9','1*0+0-0*0-0+0+0*0+9','1*0+0-0*0-0+0-0+0+9','1*0+0-0*0-0+0-0-0+9','1*0+0-0*0-0+0-0*0+9','1*0+0-0*0-0+0*0+0+9','1*0+0-0*0-0+0*0-0+9','1*0+0-0*0-0+0*0*0+9','1*0+0-0*0-0-0+0+0+9','1*0+0-0*0-0-0+0-0+9','1*0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','1*0+0*0*0+0+0+0+0+9','1*0+0*0*0+0+0+0-0+9','1*0+0*0*0+0+0+0*0+9','1*0+0*0*0+0+0-0+0+9','1*0+0*0*0+0+0-0-0+9','1*0+0*0*0+0+0-0*0+9','1*0+0*0*0+0+0*0+0+9','1*0+0*0*0+0+0*0-0+9','1*0+0*0*0+0+0*0*0+9','1*0+0*0*0+0-0+0+0+9','1*0+0*0*0+0-0+0-0+9','1*0+0*0*0+0-0+0*0+9','1*0+0*0*0+0-0-0+0+9','1*0+0*0*0+0-0-0-0+9','1*0+0*0*0+0-0-0*0+9','1*0+0*0*0+0-0*0+0+9','1*0+0*0*0+0-0*0-0+9','1*0+0*0*0+0-0*0*0+9','1*0+0*0*0+0*0+0+0+9','1*0+0*0*0+0*0+0-0+9','1*0+0*0*0+0*0+0*0+9','1*0+0*0*0+0*0-0+0+9','1*0+0*0*0+0*0-0-0+9','1*0+0*0*0+0*0-0*0+9','1*0+0*0*0+0*0*0+0+9','1*0+0*0*0+0*0*0-0+9','1*0+0*0*0+0*0*0*0+9','1*0+0*0*0-0+0+0+0+9','1*0+0*0*0-0+0+0-0+9','1*0+0*0*0-0+0+0*0+9','1*0+0*0*0-0+0-0+0+9','1*0+0*0*0-0+0-0-0+9','1*0+0*0*0-0+0-0*0+9','1*0+0*0*0-0+0*0+0+9','1*0+0*0*0-0+0*0-0+9','1*0+0*0*0-0+0*0*0+9','1*0+0*0*0-0-0+0+0+9','1*0+0*0*0-0-0+0-0+9','1*0+0*0*0-0-0+0*0+9','1*0+0*0*0-0-0-0+0+9','1*0+0*0*0-0-0-0-0+9','1*0+0*0*0-0-0-0*0+9','1*0+0*0*0-0-0*0+0+9','1*0+0*0*0-0-0*0-0+9','1*0+0*0*0-0-0*0*0+9','1*0+0*0*0-0*0+0+0+9','1*0+0*0*0-0*0+0-0+9','1*0+0*0*0-0*0+0*0+9','1*0+0*0*0-0*0-0+0+9','1*0+0*0*0-0*0-0-0+9','1*0+0*0*0-0*0-0*0+9','1*0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','1*0-0+0*0+0-0-0-0+9','1*0-0+0*0+0-0-0*0+9','1*0-0+0*0+0-0*0+0+9','1*0-0+0*0+0-0*0-0+9','1*0-0+0*0+0-0*0*0+9','1*0-0+0*0+0*0+0+0+9','1*0-0+0*0+0*0+0-0+9','1*0-0+0*0+0*0+0*0+9','1*0-0+0*0+0*0-0+0+9','1*0-0+0*0+0*0-0-0+9','1*0-0+0*0+0*0-0*0+9','1*0-0+0*0+0*0*0+0+9','1*0-0+0*0+0*0*0-0+9','1*0-0+0*0+0*0*0*0+9','1*0-0+0*0-0+0+0+0+9','1*0-0+0*0-0+0+0-0+9','1*0-0+0*0-0+0+0*0+9','1*0-0+0*0-0+0-0+0+9','1*0-0+0*0-0+0-0-0+9','1*0-0+0*0-0+0-0*0+9','1*0-0+0*0-0+0*0+0+9','1*0-0+0*0-0+0*0-0+9','1*0-0+0*0-0+0*0*0+9','1*0-0+0*0-0-0+0+0+9','1*0-0+0*0-0-0+0-0+9','1*0-0+0*0-0-0+0*0+9','1*0-0+0*0-0-0-0+0+9','1*0-0+0*0-0-0-0-0+9','1*0-0+0*0-0-0-0*0+9','1*0-0+0*0-0-0*0+0+9','1*0-0+0*0-0-0*0-0+9','1*0-0+0*0-0-0*0*0+9','1*0-0+0*0-0*0+0+0+9','1*0-0+0*0-0*0+0-0+9','1*0-0+0*0-0*0+0*0+9','1*0-0+0*0-0*0-0+0+9','1*0-0+0*0-0*0-0-0+9','1*0-0+0*0-0*0-0*0+9','1*0-0+0*0-0*0*0+0+9','1*0-0+0*0-0*0*0-0+9','1*0-0+0*0-0*0*0*0+9','1*0-0+0*0*0+0+0+0+9','1*0-0+0*0*0+0+0-0+9','1*0-0+0*0*0+0+0*0+9','1*0-0+0*0*0+0-0+0+9','1*0-0+0*0*0+0-0-0+9','1*0-0+0*0*0+0-0*0+9','1*0-0+0*0*0+0*0+0+9','1*0-0+0*0*0+0*0-0+9','1*0-0+0*0*0+0*0*0+9','1*0-0+0*0*0-0+0+0+9','1*0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','1*0-0-0*0+0*0*0*0+9','1*0-0-0*0-0+0+0+0+9','1*0-0-0*0-0+0+0-0+9','1*0-0-0*0-0+0+0*0+9','1*0-0-0*0-0+0-0+0+9','1*0-0-0*0-0+0-0-0+9','1*0-0-0*0-0+0-0*0+9','1*0-0-0*0-0+0*0+0+9','1*0-0-0*0-0+0*0-0+9','1*0-0-0*0-0+0*0*0+9','1*0-0-0*0-0-0+0+0+9','1*0-0-0*0-0-0+0-0+9','1*0-0-0*0-0-0+0*0+9','1*0-0-0*0-0-0-0+0+9','1*0-0-0*0-0-0-0-0+9','1*0-0-0*0-0-0-0*0+9','1*0-0-0*0-0-0*0+0+9','1*0-0-0*0-0-0*0-0+9','1*0-0-0*0-0-0*0*0+9','1*0-0-0*0-0*0+0+0+9','1*0-0-0*0-0*0+0-0+9','1*0-0-0*0-0*0+0*0+9','1*0-0-0*0-0*0-0+0+9','1*0-0-0*0-0*0-0-0+9','1*0-0-0*0-0*0-0*0+9','1*0-0-0*0-0*0*0+0+9','1*0-0-0*0-0*0*0-0+9','1*0-0-0*0-0*0*0*0+9','1*0-0-0*0*0+0+0+0+9','1*0-0-0*0*0+0+0-0+9','1*0-0-0*0*0+0+0*0+9','1*0-0-0*0*0+0-0+0+9','1*0-0-0*0*0+0-0-0+9','1*0-0-0*0*0+0-0*0+9','1*0-0-0*0*0+0*0+0+9','1*0-0-0*0*0+0*0-0+9','1*0-0-0*0*0+0*0*0+9','1*0-0-0*0*0-0+0+0+9','1*0-0-0*0*0-0+0-0+9','1*0-0-0*0*0-0+0*0+9','1*0-0-0*0*0-0-0+0+9','1*0-0-0*0*0-0-0-0+9','1*0-0-0*0*0-0-0*0+9','1*0-0-0*0*0-0*0+0+9','1*0-0-0*0*0-0*0-0+9','1*0-0-0*0*0-0*0*0+9','1*0-0-0*0*0*0+0+0+9','1*0-0-0*0*0*0+0-0+9','1*0-0-0*0*0*0+0*0+9','1*0-0-0*0*0*0-0+0+9','1*0-0-0*0*0*0-0-0+9','1*0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','1*0-0*0*0-0-0-0+0+9','1*0-0*0*0-0-0-0-0+9','1*0-0*0*0-0-0-0*0+9','1*0-0*0*0-0-0*0+0+9','1*0-0*0*0-0-0*0-0+9','1*0-0*0*0-0-0*0*0+9','1*0-0*0*0-0*0+0+0+9','1*0-0*0*0-0*0+0-0+9','1*0-0*0*0-0*0+0*0+9','1*0-0*0*0-0*0-0+0+9','1*0-0*0*0-0*0-0-0+9','1*0-0*0*0-0*0-0*0+9','1*0-0*0*0-0*0*0+0+9','1*0-0*0*0-0*0*0-0+9','1*0-0*0*0-0*0*0*0+9','1*0-0*0*0*0+0+0+0+9','1*0-0*0*0*0+0+0-0+9','1*0-0*0*0*0+0+0*0+9','1*0-0*0*0*0+0-0+0+9','1*0-0*0*0*0+0-0-0+9','1*0-0*0*0*0+0-0*0+9','1*0-0*0*0*0+0*0+0+9','1*0-0*0*0*0+0*0-0+9','1*0-0*0*0*0+0*0*0+9','1*0-0*0*0*0-0+0+0+9','1*0-0*0*0*0-0+0-0+9','1*0-0*0*0*0-0+0*0+9','1*0-0*0*0*0-0-0+0+9','1*0-0*0*0*0-0-0-0+9','1*0-0*0*0*0-0-0*0+9','1*0-0*0*0*0-0*0+0+9','1*0-0*0*0*0-0*0-0+9','1*0-0*0*0*0-0*0*0+9','1*0-0*0*0*0*0+0+0+9','1*0-0*0*0*0*0+0-0+9','1*0-0*0*0*0*0+0*0+9','1*0-0*0*0*0*0-0+0+9','1*0-0*0*0*0*0-0-0+9','1*0-0*0*0*0*0-0*0+9','1*0-0*0*0*0*0*0+0+9','1*0-0*0*0*0*0*0-0+9','1*0-0*0*0*0*0*0*0+9','1*0*0+0+0+0+0+0+0+9','1*0*0+0+0+0+0+0-0+9','1*0*0+0+0+0+0+0*0+9','1*0*0+0+0+0+0-0+0+9','1*0*0+0+0+0+0-0-0+9','1*0*0+0+0+0+0-0*0+9','1*0*0+0+0+0+0*0+0+9','1*0*0+0+0+0+0*0-0+9','1*0*0+0+0+0+0*0*0+9','1*0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','1*0*0+0*0-0*0*0-0+9','1*0*0+0*0-0*0*0*0+9','1*0*0+0*0*0+0+0+0+9','1*0*0+0*0*0+0+0-0+9','1*0*0+0*0*0+0+0*0+9','1*0*0+0*0*0+0-0+0+9','1*0*0+0*0*0+0-0-0+9','1*0*0+0*0*0+0-0*0+9','1*0*0+0*0*0+0*0+0+9','1*0*0+0*0*0+0*0-0+9','1*0*0+0*0*0+0*0*0+9','1*0*0+0*0*0-0+0+0+9','1*0*0+0*0*0-0+0-0+9','1*0*0+0*0*0-0+0*0+9','1*0*0+0*0*0-0-0+0+9','1*0*0+0*0*0-0-0-0+9','1*0*0+0*0*0-0-0*0+9','1*0*0+0*0*0-0*0+0+9','1*0*0+0*0*0-0*0-0+9','1*0*0+0*0*0-0*0*0+9','1*0*0+0*0*0*0+0+0+9','1*0*0+0*0*0*0+0-0+9','1*0*0+0*0*0*0+0*0+9','1*0*0+0*0*0*0-0+0+9','1*0*0+0*0*0*0-0-0+9','1*0*0+0*0*0*0-0*0+9','1*0*0+0*0*0*0*0+0+9','1*0*0+0*0*0*0*0-0+9','1*0*0+0*0*0*0*0*0+9','1*0*0-0+0+0+0+0+0+9','1*0*0-0+0+0+0+0-0+9','1*0*0-0+0+0+0+0*0+9','1*0*0-0+0+0+0-0+0+9','1*0*0-0+0+0+0-0-0+9','1*0*0-0+0+0+0-0*0+9','1*0*0-0+0+0+0*0+0+9','1*0*0-0+0+0+0*0-0+9','1*0*0-0+0+0+0*0*0+9','1*0*0-0+0+0-0+0+0+9','1*0*0-0+0+0-0+0-0+9','1*0*0-0+0+0-0+0*0+9','1*0*0-0+0+0-0-0+0+9','1*0*0-0+0+0-0-0-0+9','1*0*0-0+0+0-0-0*0+9','1*0*0-0+0+0-0*0+0+9','1*0*0-0+0+0-0*0-0+9','1*0*0-0+0+0-0*0*0+9','1*0*0-0+0+0*0+0+0+9','1*0*0-0+0+0*0+0-0+9','1*0*0-0+0+0*0+0*0+9','1*0*0-0+0+0*0-0+0+9','1*0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','1*0*0-0*0*0-0+0*0+9','1*0*0-0*0*0-0-0+0+9','1*0*0-0*0*0-0-0-0+9','1*0*0-0*0*0-0-0*0+9','1*0*0-0*0*0-0*0+0+9','1*0*0-0*0*0-0*0-0+9','1*0*0-0*0*0-0*0*0+9','1*0*0-0*0*0*0+0+0+9','1*0*0-0*0*0*0+0-0+9','1*0*0-0*0*0*0+0*0+9','1*0*0-0*0*0*0-0+0+9','1*0*0-0*0*0*0-0-0+9','1*0*0-0*0*0*0-0*0+9','1*0*0-0*0*0*0*0+0+9','1*0*0-0*0*0*0*0-0+9','1*0*0-0*0*0*0*0*0+9','1*0*0*0+0+0+0+0+0+9','1*0*0*0+0+0+0+0-0+9','1*0*0*0+0+0+0+0*0+9','1*0*0*0+0+0+0-0+0+9','1*0*0*0+0+0+0-0-0+9','1*0*0*0+0+0+0-0*0+9','1*0*0*0+0+0+0*0+0+9','1*0*0*0+0+0+0*0-0+9','1*0*0*0+0+0+0*0*0+9','1*0*0*0+0+0-0+0+0+9','1*0*0*0+0+0-0+0-0+9','1*0*0*0+0+0-0+0*0+9','1*0*0*0+0+0-0-0+0+9','1*0*0*0+0+0-0-0-0+9','1*0*0*0+0+0-0-0*0+9','1*0*0*0+0+0-0*0+0+9','1*0*0*0+0+0-0*0-0+9','1*0*0*0+0+0-0*0*0+9','1*0*0*0+0+0*0+0+0+9','1*0*0*0+0+0*0+0-0+9','1*0*0*0+0+0*0+0*0+9','1*0*0*0+0+0*0-0+0+9','1*0*0*0+0+0*0-0-0+9','1*0*0*0+0+0*0-0*0+9','1*0*0*0+0+0*0*0+0+9','1*0*0*0+0+0*0*0-0+9','1*0*0*0+0+0*0*0*0+9','1*0*0*0+0-0+0+0+0+9','1*0*0*0+0-0+0+0-0+9','1*0*0*0+0-0+0+0*0+9','1*0*0*0+0-0+0-0+0+9','1*0*0*0+0-0+0-0-0+9','1*0*0*0+0-0+0-0*0+9','1*0*0*0+0-0+0*0+0+9','1*0*0*0+0-0+0*0-0+9','1*0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','1*0*0*0*0*0*0*0+0+9','1*0*0*0*0*0*0*0-0+9','1*0*0*0*0*0*0*0*0+9','10*0+0+0+0+0+0+0+9','10*0+0+0+0+0+0-0+9','10*0+0+0+0+0+0*0+9','10*0+0+0+0+0-0+0+9','10*0+0+0+0+0-0-0+9','10*0+0+0+0+0-0*0+9','10*0+0+0+0+0*0+0+9','10*0+0+0+0+0*0-0+9','10*0+0+0+0+0*0*0+9','10*0+0+0+0-0+0+0+9','10*0+0+0+0-0+0-0+9','10*0+0+0+0-0+0*0+9','10*0+0+0+0-0-0+0+9','10*0+0+0+0-0-0-0+9','10*0+0+0+0-0-0*0+9','10*0+0+0+0-0*0+0+9','10*0+0+0+0-0*0-0+9','10*0+0+0+0-0*0*0+9','10*0+0+0+0*0+0+0+9','10*0+0+0+0*0+0-0+9','10*0+0+0+0*0+0*0+9','10*0+0+0+0*0-0+0+9','10*0+0+0+0*0-0-0+9','10*0+0+0+0*0-0*0+9','10*0+0+0+0*0*0+0+9','10*0+0+0+0*0*0-0+9','10*0+0+0+0*0*0*0+9','10*0+0+0-0+0+0+0+9','10*0+0+0-0+0+0-0+9','10*0+0+0-0+0+0*0+9','10*0+0+0-0+0-0+0+9','10*0+0+0-0+0-0-0+9','10*0+0+0-0+0-0*0+9','10*0+0+0-0+0*0+0+9','10*0+0+0-0+0*0-0+9','10*0+0+0-0+0*0*0+9','10*0+0+0-0-0+0+0+9','10*0+0+0-0-0+0-0+9','10*0+0+0-0-0+0*0+9','10*0+0+0-0-0-0+0+9','10*0+0+0-0-0-0-0+9','10*0+0+0-0-0-0*0+9','10*0+0+0-0-0*0+0+9','10*0+0+0-0-0*0-0+9','10*0+0+0-0-0*0*0+9','10*0+0+0-0*0+0+0+9','10*0+0+0-0*0+0-0+9','10*0+0+0-0*0+0*0+9','10*0+0+0-0*0-0+0+9','10*0+0+0-0*0-0-0+9','10*0+0+0-0*0-0*0+9','10*0+0+0-0*0*0+0+9','10*0+0+0-0*0*0-0+9','10*0+0+0-0*0*0*0+9','10*0+0+0*0+0+0+0+9','10*0+0+0*0+0+0-0+9','10*0+0+0*0+0+0*0+9','10*0+0+0*0+0-0+0+9','10*0+0+0*0+0-0-0+9','10*0+0+0*0+0-0*0+9','10*0+0+0*0+0*0+0+9','10*0+0+0*0+0*0-0+9','10*0+0+0*0+0*0*0+9','10*0+0+0*0-0+0+0+9','10*0+0+0*0-0+0-0+9','10*0+0+0*0-0+0*0+9','10*0+0+0*0-0-0+0+9','10*0+0+0*0-0-0-0+9','10*0+0+0*0-0-0*0+9','10*0+0+0*0-0*0+0+9','10*0+0+0*0-0*0-0+9','10*0+0+0*0-0*0*0+9','10*0+0+0*0*0+0+0+9','10*0+0+0*0*0+0-0+9','10*0+0+0*0*0+0*0+9','10*0+0+0*0*0-0+0+9','10*0+0+0*0*0-0-0+9','10*0+0+0*0*0-0*0+9','10*0+0+0*0*0*0+0+9','10*0+0+0*0*0*0-0+9','10*0+0+0*0*0*0*0+9','10*0+0-0+0+0+0+0+9','10*0+0-0+0+0+0-0+9','10*0+0-0+0+0+0*0+9','10*0+0-0+0+0-0+0+9','10*0+0-0+0+0-0-0+9','10*0+0-0+0+0-0*0+9','10*0+0-0+0+0*0+0+9','10*0+0-0+0+0*0-0+9','10*0+0-0+0+0*0*0+9','10*0+0-0+0-0+0+0+9','10*0+0-0+0-0+0-0+9','10*0+0-0+0-0+0*0+9','10*0+0-0+0-0-0+0+9','10*0+0-0+0-0-0-0+9','10*0+0-0+0-0-0*0+9','10*0+0-0+0-0*0+0+9','10*0+0-0+0-0*0-0+9','10*0+0-0+0-0*0*0+9','10*0+0-0+0*0+0+0+9','10*0+0-0+0*0+0-0+9','10*0+0-0+0*0+0*0+9','10*0+0-0+0*0-0+0+9','10*0+0-0+0*0-0-0+9','10*0+0-0+0*0-0*0+9','10*0+0-0+0*0*0+0+9','10*0+0-0+0*0*0-0+9','10*0+0-0+0*0*0*0+9','10*0+0-0-0+0+0+0+9','10*0+0-0-0+0+0-0+9','10*0+0-0-0+0+0*0+9','10*0+0-0-0+0-0+0+9','10*0+0-0-0+0-0-0+9','10*0+0-0-0+0-0*0+9','10*0+0-0-0+0*0+0+9','10*0+0-0-0+0*0-0+9','10*0+0-0-0+0*0*0+9','10*0+0-0-0-0+0+0+9','10*0+0-0-0-0+0-0+9','10*0+0-0-0-0+0*0+9','10*0+0-0-0-0-0+0+9','10*0+0-0-0-0-0-0+9','10*0+0-0-0-0-0*0+9','10*0+0-0-0-0*0+0+9','10*0+0-0-0-0*0-0+9','10*0+0-0-0-0*0*0+9','10*0+0-0-0*0+0+0+9','10*0+0-0-0*0+0-0+9','10*0+0-0-0*0+0*0+9','10*0+0-0-0*0-0+0+9','10*0+0-0-0*0-0-0+9','10*0+0-0-0*0-0*0+9','10*0+0-0-0*0*0+0+9','10*0+0-0-0*0*0-0+9','10*0+0-0-0*0*0*0+9','10*0+0-0*0+0+0+0+9','10*0+0-0*0+0+0-0+9','10*0+0-0*0+0+0*0+9','10*0+0-0*0+0-0+0+9','10*0+0-0*0+0-0-0+9','10*0+0-0*0+0-0*0+9','10*0+0-0*0+0*0+0+9','10*0+0-0*0+0*0-0+9','10*0+0-0*0+0*0*0+9','10*0+0-0*0-0+0+0+9','10*0+0-0*0-0+0-0+9','10*0+0-0*0-0+0*0+9','10*0+0-0*0-0-0+0+9','10*0+0-0*0-0-0-0+9','10*0+0-0*0-0-0*0+9','10*0+0-0*0-0*0+0+9','10*0+0-0*0-0*0-0+9','10*0+0-0*0-0*0*0+9','10*0+0-0*0*0+0+0+9','10*0+0-0*0*0+0-0+9','10*0+0-0*0*0+0*0+9','10*0+0-0*0*0-0+0+9','10*0+0-0*0*0-0-0+9','10*0+0-0*0*0-0*0+9','10*0+0-0*0*0*0+0+9','10*0+0-0*0*0*0-0+9','10*0+0-0*0*0*0*0+9','10*0+0*0+0+0+0+0+9','10*0+0*0+0+0+0-0+9','10*0+0*0+0+0+0*0+9','10*0+0*0+0+0-0+0+9','10*0+0*0+0+0-0-0+9','10*0+0*0+0+0-0*0+9','10*0+0*0+0+0*0+0+9','10*0+0*0+0+0*0-0+9','10*0+0*0+0+0*0*0+9','10*0+0*0+0-0+0+0+9','10*0+0*0+0-0+0-0+9','10*0+0*0+0-0+0*0+9','10*0+0*0+0-0-0+0+9','10*0+0*0+0-0-0-0+9','10*0+0*0+0-0-0*0+9','10*0+0*0+0-0*0+0+9','10*0+0*0+0-0*0-0+9','10*0+0*0+0-0*0*0+9','10*0+0*0+0*0+0+0+9','10*0+0*0+0*0+0-0+9','10*0+0*0+0*0+0*0+9','10*0+0*0+0*0-0+0+9','10*0+0*0+0*0-0-0+9','10*0+0*0+0*0-0*0+9','10*0+0*0+0*0*0+0+9','10*0+0*0+0*0*0-0+9','10*0+0*0+0*0*0*0+9','10*0+0*0-0+0+0+0+9','10*0+0*0-0+0+0-0+9','10*0+0*0-0+0+0*0+9','10*0+0*0-0+0-0+0+9','10*0+0*0-0+0-0-0+9','10*0+0*0-0+0-0*0+9','10*0+0*0-0+0*0+0+9','10*0+0*0-0+0*0-0+9','10*0+0*0-0+0*0*0+9','10*0+0*0-0-0+0+0+9','10*0+0*0-0-0+0-0+9','10*0+0*0-0-0+0*0+9','10*0+0*0-0-0-0+0+9','10*0+0*0-0-0-0-0+9','10*0+0*0-0-0-0*0+9','10*0+0*0-0-0*0+0+9','10*0+0*0-0-0*0-0+9','10*0+0*0-0-0*0*0+9','10*0+0*0-0*0+0+0+9','10*0+0*0-0*0+0-0+9','10*0+0*0-0*0+0*0+9','10*0+0*0-0*0-0+0+9','10*0+0*0-0*0-0-0+9','10*0+0*0-0*0-0*0+9','10*0+0*0-0*0*0+0+9','10*0+0*0-0*0*0-0+9','10*0+0*0-0*0*0*0+9','10*0+0*0*0+0+0+0+9','10*0+0*0*0+0+0-0+9','10*0+0*0*0+0+0*0+9','10*0+0*0*0+0-0+0+9','10*0+0*0*0+0-0-0+9','10*0+0*0*0+0-0*0+9','10*0+0*0*0+0*0+0+9','10*0+0*0*0+0*0-0+9','10*0+0*0*0+0*0*0+9','10*0+0*0*0-0+0+0+9','10*0+0*0*0-0+0-0+9','10*0+0*0*0-0+0*0+9','10*0+0*0*0-0-0+0+9','10*0+0*0*0-0-0-0+9','10*0+0*0*0-0-0*0+9','10*0+0*0*0-0*0+0+9','10*0+0*0*0-0*0-0+9','10*0+0*0*0-0*0*0+9','10*0+0*0*0*0+0+0+9','10*0+0*0*0*0+0-0+9','10*0+0*0*0*0+0*0+9','10*0+0*0*0*0-0+0+9','10*0+0*0*0*0-0-0+9','10*0+0*0*0*0-0*0+9','10*0+0*0*0*0*0+0+9','10*0+0*0*0*0*0-0+9','10*0+0*0*0*0*0*0+9','10*0-0+0+0+0+0+0+9','10*0-0+0+0+0+0-0+9','10*0-0+0+0+0+0*0+9','10*0-0+0+0+0-0+0+9','10*0-0+0+0+0-0-0+9','10*0-0+0+0+0-0*0+9','10*0-0+0+0+0*0+0+9','10*0-0+0+0+0*0-0+9','10*0-0+0+0+0*0*0+9','10*0-0+0+0-0+0+0+9','10*0-0+0+0-0+0-0+9','10*0-0+0+0-0+0*0+9','10*0-0+0+0-0-0+0+9','10*0-0+0+0-0-0-0+9','10*0-0+0+0-0-0*0+9','10*0-0+0+0-0*0+0+9','10*0-0+0+0-0*0-0+9','10*0-0+0+0-0*0*0+9','10*0-0+0+0*0+0+0+9','10*0-0+0+0*0+0-0+9','10*0-0+0+0*0+0*0+9','10*0-0+0+0*0-0+0+9','10*0-0+0+0*0-0-0+9','10*0-0+0+0*0-0*0+9','10*0-0+0+0*0*0+0+9','10*0-0+0+0*0*0-0+9','10*0-0+0+0*0*0*0+9','10*0-0+0-0+0+0+0+9','10*0-0+0-0+0+0-0+9','10*0-0+0-0+0+0*0+9','10*0-0+0-0+0-0+0+9','10*0-0+0-0+0-0-0+9','10*0-0+0-0+0-0*0+9','10*0-0+0-0+0*0+0+9','10*0-0+0-0+0*0-0+9','10*0-0+0-0+0*0*0+9','10*0-0+0-0-0+0+0+9','10*0-0+0-0-0+0-0+9','10*0-0+0-0-0+0*0+9','10*0-0+0-0-0-0+0+9','10*0-0+0-0-0-0-0+9','10*0-0+0-0-0-0*0+9','10*0-0+0-0-0*0+0+9','10*0-0+0-0-0*0-0+9','10*0-0+0-0-0*0*0+9','10*0-0+0-0*0+0+0+9','10*0-0+0-0*0+0-0+9','10*0-0+0-0*0+0*0+9','10*0-0+0-0*0-0+0+9','10*0-0+0-0*0-0-0+9','10*0-0+0-0*0-0*0+9','10*0-0+0-0*0*0+0+9','10*0-0+0-0*0*0-0+9','10*0-0+0-0*0*0*0+9','10*0-0+0*0+0+0+0+9','10*0-0+0*0+0+0-0+9','10*0-0+0*0+0+0*0+9','10*0-0+0*0+0-0+0+9','10*0-0+0*0+0-0-0+9','10*0-0+0*0+0-0*0+9','10*0-0+0*0+0*0+0+9','10*0-0+0*0+0*0-0+9','10*0-0+0*0+0*0*0+9','10*0-0+0*0-0+0+0+9','10*0-0+0*0-0+0-0+9','10*0-0+0*0-0+0*0+9','10*0-0+0*0-0-0+0+9','10*0-0+0*0-0-0-0+9','10*0-0+0*0-0-0*0+9','10*0-0+0*0-0*0+0+9','10*0-0+0*0-0*0-0+9','10*0-0+0*0-0*0*0+9','10*0-0+0*0*0+0+0+9','10*0-0+0*0*0+0-0+9','10*0-0+0*0*0+0*0+9','10*0-0+0*0*0-0+0+9','10*0-0+0*0*0-0-0+9','10*0-0+0*0*0-0*0+9','10*0-0+0*0*0*0+0+9','10*0-0+0*0*0*0-0+9','10*0-0+0*0*0*0*0+9','10*0-0-0+0+0+0+0+9','10*0-0-0+0+0+0-0+9','10*0-0-0+0+0+0*0+9','10*0-0-0+0+0-0+0+9','10*0-0-0+0+0-0-0+9','10*0-0-0+0+0-0*0+9','10*0-0-0+0+0*0+0+9','10*0-0-0+0+0*0-0+9','10*0-0-0+0+0*0*0+9','10*0-0-0+0-0+0+0+9','10*0-0-0+0-0+0-0+9','10*0-0-0+0-0+0*0+9','10*0-0-0+0-0-0+0+9','10*0-0-0+0-0-0-0+9','10*0-0-0+0-0-0*0+9','10*0-0-0+0-0*0+0+9','10*0-0-0+0-0*0-0+9','10*0-0-0+0-0*0*0+9','10*0-0-0+0*0+0+0+9','10*0-0-0+0*0+0-0+9','10*0-0-0+0*0+0*0+9','10*0-0-0+0*0-0+0+9','10*0-0-0+0*0-0-0+9','10*0-0-0+0*0-0*0+9','10*0-0-0+0*0*0+0+9','10*0-0-0+0*0*0-0+9','10*0-0-0+0*0*0*0+9','10*0-0-0-0+0+0+0+9','10*0-0-0-0+0+0-0+9','10*0-0-0-0+0+0*0+9','10*0-0-0-0+0-0+0+9','10*0-0-0-0+0-0-0+9','10*0-0-0-0+0-0*0+9','10*0-0-0-0+0*0+0+9','10*0-0-0-0+0*0-0+9','10*0-0-0-0+0*0*0+9','10*0-0-0-0-0+0+0+9','10*0-0-0-0-0+0-0+9','10*0-0-0-0-0+0*0+9','10*0-0-0-0-0-0+0+9','10*0-0-0-0-0-0-0+9','10*0-0-0-0-0-0*0+9','10*0-0-0-0-0*0+0+9','10*0-0-0-0-0*0-0+9','10*0-0-0-0-0*0*0+9','10*0-0-0-0*0+0+0+9','10*0-0-0-0*0+0-0+9','10*0-0-0-0*0+0*0+9','10*0-0-0-0*0-0+0+9','10*0-0-0-0*0-0-0+9','10*0-0-0-0*0-0*0+9','10*0-0-0-0*0*0+0+9','10*0-0-0-0*0*0-0+9','10*0-0-0-0*0*0*0+9','10*0-0-0*0+0+0+0+9','10*0-0-0*0+0+0-0+9','10*0-0-0*0+0+0*0+9','10*0-0-0*0+0-0+0+9','10*0-0-0*0+0-0-0+9','10*0-0-0*0+0-0*0+9','10*0-0-0*0+0*0+0+9','10*0-0-0*0+0*0-0+9','10*0-0-0*0+0*0*0+9','10*0-0-0*0-0+0+0+9','10*0-0-0*0-0+0-0+9','10*0-0-0*0-0+0*0+9','10*0-0-0*0-0-0+0+9','10*0-0-0*0-0-0-0+9','10*0-0-0*0-0-0*0+9','10*0-0-0*0-0*0+0+9','10*0-0-0*0-0*0-0+9','10*0-0-0*0-0*0*0+9','10*0-0-0*0*0+0+0+9','10*0-0-0*0*0+0-0+9','10*0-0-0*0*0+0*0+9','10*0-0-0*0*0-0+0+9','10*0-0-0*0*0-0-0+9','10*0-0-0*0*0-0*0+9','10*0-0-0*0*0*0+0+9','10*0-0-0*0*0*0-0+9','10*0-0-0*0*0*0*0+9','10*0-0*0+0+0+0+0+9','10*0-0*0+0+0+0-0+9','10*0-0*0+0+0+0*0+9','10*0-0*0+0+0-0+0+9','10*0-0*0+0+0-0-0+9','10*0-0*0+0+0-0*0+9','10*0-0*0+0+0*0+0+9','10*0-0*0+0+0*0-0+9','10*0-0*0+0+0*0*0+9','10*0-0*0+0-0+0+0+9','10*0-0*0+0-0+0-0+9','10*0-0*0+0-0+0*0+9','10*0-0*0+0-0-0+0+9','10*0-0*0+0-0-0-0+9','10*0-0*0+0-0-0*0+9','10*0-0*0+0-0*0+0+9','10*0-0*0+0-0*0-0+9','10*0-0*0+0-0*0*0+9','10*0-0*0+0*0+0+0+9','10*0-0*0+0*0+0-0+9','10*0-0*0+0*0+0*0+9','10*0-0*0+0*0-0+0+9','10*0-0*0+0*0-0-0+9','10*0-0*0+0*0-0*0+9','10*0-0*0+0*0*0+0+9','10*0-0*0+0*0*0-0+9','10*0-0*0+0*0*0*0+9','10*0-0*0-0+0+0+0+9','10*0-0*0-0+0+0-0+9','10*0-0*0-0+0+0*0+9','10*0-0*0-0+0-0+0+9','10*0-0*0-0+0-0-0+9','10*0-0*0-0+0-0*0+9','10*0-0*0-0+0*0+0+9','10*0-0*0-0+0*0-0+9','10*0-0*0-0+0*0*0+9','10*0-0*0-0-0+0+0+9','10*0-0*0-0-0+0-0+9','10*0-0*0-0-0+0*0+9','10*0-0*0-0-0-0+0+9','10*0-0*0-0-0-0-0+9','10*0-0*0-0-0-0*0+9','10*0-0*0-0-0*0+0+9','10*0-0*0-0-0*0-0+9','10*0-0*0-0-0*0*0+9','10*0-0*0-0*0+0+0+9','10*0-0*0-0*0+0-0+9','10*0-0*0-0*0+0*0+9','10*0-0*0-0*0-0+0+9','10*0-0*0-0*0-0-0+9','10*0-0*0-0*0-0*0+9','10*0-0*0-0*0*0+0+9','10*0-0*0-0*0*0-0+9','10*0-0*0-0*0*0*0+9','10*0-0*0*0+0+0+0+9','10*0-0*0*0+0+0-0+9','10*0-0*0*0+0+0*0+9','10*0-0*0*0+0-0+0+9','10*0-0*0*0+0-0-0+9','10*0-0*0*0+0-0*0+9','10*0-0*0*0+0*0+0+9','10*0-0*0*0+0*0-0+9','10*0-0*0*0+0*0*0+9','10*0-0*0*0-0+0+0+9','10*0-0*0*0-0+0-0+9','10*0-0*0*0-0+0*0+9','10*0-0*0*0-0-0+0+9','10*0-0*0*0-0-0-0+9','10*0-0*0*0-0-0*0+9','10*0-0*0*0-0*0+0+9','10*0-0*0*0-0*0-0+9','10*0-0*0*0-0*0*0+9','10*0-0*0*0*0+0+0+9','10*0-0*0*0*0+0-0+9','10*0-0*0*0*0+0*0+9','10*0-0*0*0*0-0+0+9','10*0-0*0*0*0-0-0+9','10*0-0*0*0*0-0*0+9','10*0-0*0*0*0*0+0+9','10*0-0*0*0*0*0-0+9','10*0-0*0*0*0*0*0+9','10*0*0+0+0+0+0+0+9','10*0*0+0+0+0+0-0+9','10*0*0+0+0+0+0*0+9','10*0*0+0+0+0-0+0+9','10*0*0+0+0+0-0-0+9','10*0*0+0+0+0-0*0+9','10*0*0+0+0+0*0+0+9','10*0*0+0+0+0*0-0+9','10*0*0+0+0+0*0*0+9','10*0*0+0+0-0+0+0+9','10*0*0+0+0-0+0-0+9','10*0*0+0+0-0+0*0+9','10*0*0+0+0-0-0+0+9','10*0*0+0+0-0-0-0+9','10*0*0+0+0-0-0*0+9','10*0*0+0+0-0*0+0+9','10*0*0+0+0-0*0-0+9','10*0*0+0+0-0*0*0+9','10*0*0+0+0*0+0+0+9','10*0*0+0+0*0+0-0+9','10*0*0+0+0*0+0*0+9','10*0*0+0+0*0-0+0+9','10*0*0+0+0*0-0-0+9','10*0*0+0+0*0-0*0+9','10*0*0+0+0*0*0+0+9','10*0*0+0+0*0*0-0+9','10*0*0+0+0*0*0*0+9','10*0*0+0-0+0+0+0+9','10*0*0+0-0+0+0-0+9','10*0*0+0-0+0+0*0+9','10*0*0+0-0+0-0+0+9','10*0*0+0-0+0-0-0+9','10*0*0+0-0+0-0*0+9','10*0*0+0-0+0*0+0+9','10*0*0+0-0+0*0-0+9','10*0*0+0-0+0*0*0+9','10*0*0+0-0-0+0+0+9','10*0*0+0-0-0+0-0+9','10*0*0+0-0-0+0*0+9','10*0*0+0-0-0-0+0+9','10*0*0+0-0-0-0-0+9','10*0*0+0-0-0-0*0+9','10*0*0+0-0-0*0+0+9','10*0*0+0-0-0*0-0+9','10*0*0+0-0-0*0*0+9','10*0*0+0-0*0+0+0+9','10*0*0+0-0*0+0-0+9','10*0*0+0-0*0+0*0+9','10*0*0+0-0*0-0+0+9','10*0*0+0-0*0-0-0+9','10*0*0+0-0*0-0*0+9','10*0*0+0-0*0*0+0+9','10*0*0+0-0*0*0-0+9','10*0*0+0-0*0*0*0+9','10*0*0+0*0+0+0+0+9','10*0*0+0*0+0+0-0+9','10*0*0+0*0+0+0*0+9','10*0*0+0*0+0-0+0+9','10*0*0+0*0+0-0-0+9','10*0*0+0*0+0-0*0+9','10*0*0+0*0+0*0+0+9','10*0*0+0*0+0*0-0+9','10*0*0+0*0+0*0*0+9','10*0*0+0*0-0+0+0+9','10*0*0+0*0-0+0-0+9','10*0*0+0*0-0+0*0+9','10*0*0+0*0-0-0+0+9','10*0*0+0*0-0-0-0+9','10*0*0+0*0-0-0*0+9','10*0*0+0*0-0*0+0+9','10*0*0+0*0-0*0-0+9','10*0*0+0*0-0*0*0+9','10*0*0+0*0*0+0+0+9','10*0*0+0*0*0+0-0+9','10*0*0+0*0*0+0*0+9','10*0*0+0*0*0-0+0+9','10*0*0+0*0*0-0-0+9','10*0*0+0*0*0-0*0+9','10*0*0+0*0*0*0+0+9','10*0*0+0*0*0*0-0+9','10*0*0+0*0*0*0*0+9','10*0*0-0+0+0+0+0+9','10*0*0-0+0+0+0-0+9','10*0*0-0+0+0+0*0+9','10*0*0-0+0+0-0+0+9','10*0*0-0+0+0-0-0+9','10*0*0-0+0+0-0*0+9','10*0*0-0+0+0*0+0+9','10*0*0-0+0+0*0-0+9','10*0*0-0+0+0*0*0+9','10*0*0-0+0-0+0+0+9','10*0*0-0+0-0+0-0+9','10*0*0-0+0-0+0*0+9','10*0*0-0+0-0-0+0+9','10*0*0-0+0-0-0-0+9','10*0*0-0+0-0-0*0+9','10*0*0-0+0-0*0+0+9','10*0*0-0+0-0*0-0+9','10*0*0-0+0-0*0*0+9','10*0*0-0+0*0+0+0+9','10*0*0-0+0*0+0-0+9','10*0*0-0+0*0+0*0+9','10*0*0-0+0*0-0+0+9','10*0*0-0+0*0-0-0+9','10*0*0-0+0*0-0*0+9','10*0*0-0+0*0*0+0+9','10*0*0-0+0*0*0-0+9','10*0*0-0+0*0*0*0+9','10*0*0-0-0+0+0+0+9','10*0*0-0-0+0+0-0+9','10*0*0-0-0+0+0*0+9','10*0*0-0-0+0-0+0+9','10*0*0-0-0+0-0-0+9','10*0*0-0-0+0-0*0+9','10*0*0-0-0+0*0+0+9','10*0*0-0-0+0*0-0+9','10*0*0-0-0+0*0*0+9','10*0*0-0-0-0+0+0+9','10*0*0-0-0-0+0-0+9','10*0*0-0-0-0+0*0+9','10*0*0-0-0-0-0+0+9','10*0*0-0-0-0-0-0+9','10*0*0-0-0-0-0*0+9','10*0*0-0-0-0*0+0+9','10*0*0-0-0-0*0-0+9','10*0*0-0-0-0*0*0+9','10*0*0-0-0*0+0+0+9','10*0*0-0-0*0+0-0+9','10*0*0-0-0*0+0*0+9','10*0*0-0-0*0-0+0+9','10*0*0-0-0*0-0-0+9','10*0*0-0-0*0-0*0+9','10*0*0-0-0*0*0+0+9','10*0*0-0-0*0*0-0+9','10*0*0-0-0*0*0*0+9','10*0*0-0*0+0+0+0+9','10*0*0-0*0+0+0-0+9','10*0*0-0*0+0+0*0+9','10*0*0-0*0+0-0+0+9','10*0*0-0*0+0-0-0+9','10*0*0-0*0+0-0*0+9','10*0*0-0*0+0*0+0+9','10*0*0-0*0+0*0-0+9','10*0*0-0*0+0*0*0+9','10*0*0-0*0-0+0+0+9','10*0*0-0*0-0+0-0+9','10*0*0-0*0-0+0*0+9','10*0*0-0*0-0-0+0+9','10*0*0-0*0-0-0-0+9','10*0*0-0*0-0-0*0+9','10*0*0-0*0-0*0+0+9','10*0*0-0*0-0*0-0+9','10*0*0-0*0-0*0*0+9','10*0*0-0*0*0+0+0+9','10*0*0-0*0*0+0-0+9','10*0*0-0*0*0+0*0+9','10*0*0-0*0*0-0+0+9','10*0*0-0*0*0-0-0+9','10*0*0-0*0*0-0*0+9','10*0*0-0*0*0*0+0+9','10*0*0-0*0*0*0-0+9','10*0*0-0*0*0*0*0+9','10*0*0*0+0+0+0+0+9','10*0*0*0+0+0+0-0+9','10*0*0*0+0+0+0*0+9','10*0*0*0+0+0-0+0+9','10*0*0*0+0+0-0-0+9','10*0*0*0+0+0-0*0+9','10*0*0*0+0+0*0+0+9','10*0*0*0+0+0*0-0+9','10*0*0*0+0+0*0*0+9','10*0*0*0+0-0+0+0+9','10*0*0*0+0-0+0-0+9','10*0*0*0+0-0+0*0+9','10*0*0*0+0-0-0+0+9','10*0*0*0+0-0-0-0+9','10*0*0*0+0-0-0*0+9','10*0*0*0+0-0*0+0+9','10*0*0*0+0-0*0-0+9','10*0*0*0+0-0*0*0+9','10*0*0*0+0*0+0+0+9','10*0*0*0+0*0+0-0+9','10*0*0*0+0*0+0*0+9','10*0*0*0+0*0-0+0+9','10*0*0*0+0*0-0-0+9','10*0*0*0+0*0-0*0+9','10*0*0*0+0*0*0+0+9','10*0*0*0+0*0*0-0+9','10*0*0*0+0*0*0*0+9','10*0*0*0-0+0+0+0+9','10*0*0*0-0+0+0-0+9','10*0*0*0-0+0+0*0+9','10*0*0*0-0+0-0+0+9','10*0*0*0-0+0-0-0+9','10*0*0*0-0+0-0*0+9','10*0*0*0-0+0*0+0+9','10*0*0*0-0+0*0-0+9','10*0*0*0-0+0*0*0+9','10*0*0*0-0-0+0+0+9','10*0*0*0-0-0+0-0+9','10*0*0*0-0-0+0*0+9','10*0*0*0-0-0-0+0+9','10*0*0*0-0-0-0-0+9','10*0*0*0-0-0-0*0+9','10*0*0*0-0-0*0+0+9','10*0*0*0-0-0*0-0+9','10*0*0*0-0-0*0*0+9','10*0*0*0-0*0+0+0+9','10*0*0*0-0*0+0-0+9','10*0*0*0-0*0+0*0+9','10*0*0*0-0*0-0+0+9','10*0*0*0-0*0-0-0+9','10*0*0*0-0*0-0*0+9','10*0*0*0-0*0*0+0+9','10*0*0*0-0*0*0-0+9','10*0*0*0-0*0*0*0+9','10*0*0*0*0+0+0+0+9','10*0*0*0*0+0+0-0+9','10*0*0*0*0+0+0*0+9','10*0*0*0*0+0-0+0+9','10*0*0*0*0+0-0-0+9','10*0*0*0*0+0-0*0+9','10*0*0*0*0+0*0+0+9','10*0*0*0*0+0*0-0+9','10*0*0*0*0+0*0*0+9','10*0*0*0*0-0+0+0+9','10*0*0*0*0-0+0-0+9','10*0*0*0*0-0+0*0+9','10*0*0*0*0-0-0+0+9','10*0*0*0*0-0-0-0+9','10*0*0*0*0-0-0*0+9','10*0*0*0*0-0*0+0+9','10*0*0*0*0-0*0-0+9','10*0*0*0*0-0*0*0+9','10*0*0*0*0*0+0+0+9','10*0*0*0*0*0+0-0+9','10*0*0*0*0*0+0*0+9','10*0*0*0*0*0-0+0+9','10*0*0*0*0*0-0-0+9','10*0*0*0*0*0-0*0+9','10*0*0*0*0*0*0+0+9','10*0*0*0*0*0*0-0+9','10*0*0*0*0*0*0*0+9','100*0+0+0+0+0+0+9','100*0+0+0+0+0-0+9','100*0+0+0+0+0*0+9','100*0+0+0+0-0+0+9','100*0+0+0+0-0-0+9','100*0+0+0+0-0*0+9','100*0+0+0+0*0+0+9','100*0+0+0+0*0-0+9','100*0+0+0+0*0*0+9','100*0+0+0-0+0+0+9','100*0+0+0-0+0-0+9','100*0+0+0-0+0*0+9','100*0+0+0-0-0+0+9','100*0+0+0-0-0-0+9','100*0+0+0-0-0*0+9','100*0+0+0-0*0+0+9','100*0+0+0-0*0-0+9','100*0+0+0-0*0*0+9','100*0+0+0*0+0+0+9','100*0+0+0*0+0-0+9','100*0+0+0*0+0*0+9','100*0+0+0*0-0+0+9','100*0+0+0*0-0-0+9','100*0+0+0*0-0*0+9','100*0+0+0*0*0+0+9','100*0+0+0*0*0-0+9','100*0+0+0*0*0*0+9','100*0+0-0+0+0+0+9','100*0+0-0+0+0-0+9','100*0+0-0+0+0*0+9','100*0+0-0+0-0+0+9','100*0+0-0+0-0-0+9','100*0+0-0+0-0*0+9','100*0+0-0+0*0+0+9','100*0+0-0+0*0-0+9','100*0+0-0+0*0*0+9','100*0+0-0-0+0+0+9','100*0+0-0-0+0-0+9','100*0+0-0-0+0*0+9','100*0+0-0-0-0+0+9','100*0+0-0-0-0-0+9','100*0+0-0-0-0*0+9','100*0+0-0-0*0+0+9','100*0+0-0-0*0-0+9','100*0+0-0-0*0*0+9','100*0+0-0*0+0+0+9','100*0+0-0*0+0-0+9','100*0+0-0*0+0*0+9','100*0+0-0*0-0+0+9','100*0+0-0*0-0-0+9','100*0+0-0*0-0*0+9','100*0+0-0*0*0+0+9','100*0+0-0*0*0-0+9','100*0+0-0*0*0*0+9','100*0+0*0+0+0+0+9','100*0+0*0+0+0-0+9','100*0+0*0+0+0*0+9','100*0+0*0+0-0+0+9','100*0+0*0+0-0-0+9','100*0+0*0+0-0*0+9','100*0+0*0+0*0+0+9','100*0+0*0+0*0-0+9','100*0+0*0+0*0*0+9','100*0+0*0-0+0+0+9','100*0+0*0-0+0-0+9','100*0+0*0-0+0*0+9','100*0+0*0-0-0+0+9','100*0+0*0-0-0-0+9','100*0+0*0-0-0*0+9','100*0+0*0-0*0+0+9','100*0+0*0-0*0-0+9','100*0+0*0-0*0*0+9','100*0+0*0*0+0+0+9','100*0+0*0*0+0-0+9','100*0+0*0*0+0*0+9','100*0+0*0*0-0+0+9','100*0+0*0*0-0-0+9','100*0+0*0*0-0*0+9','100*0+0*0*0*0+0+9','100*0+0*0*0*0-0+9','100*0+0*0*0*0*0+9','100*0-0+0+0+0+0+9','100*0-0+0+0+0-0+9','100*0-0+0+0+0*0+9','100*0-0+0+0-0+0+9','100*0-0+0+0-0-0+9','100*0-0+0+0-0*0+9','100*0-0+0+0*0+0+9','100*0-0+0+0*0-0+9','100*0-0+0+0*0*0+9','100*0-0+0-0+0+0+9','100*0-0+0-0+0-0+9','100*0-0+0-0+0*0+9','100*0-0+0-0-0+0+9','100*0-0+0-0-0-0+9','100*0-0+0-0-0*0+9','100*0-0+0-0*0+0+9','100*0-0+0-0*0-0+9','100*0-0+0-0*0*0+9','100*0-0+0*0+0+0+9','100*0-0+0*0+0-0+9','100*0-0+0*0+0*0+9','100*0-0+0*0-0+0+9','100*0-0+0*0-0-0+9','100*0-0+0*0-0*0+9','100*0-0+0*0*0+0+9','100*0-0+0*0*0-0+9','100*0-0+0*0*0*0+9','100*0-0-0+0+0+0+9','100*0-0-0+0+0-0+9','100*0-0-0+0+0*0+9','100*0-0-0+0-0+0+9','100*0-0-0+0-0-0+9','100*0-0-0+0-0*0+9','100*0-0-0+0*0+0+9','100*0-0-0+0*0-0+9','100*0-0-0+0*0*0+9','100*0-0-0-0+0+0+9','100*0-0-0-0+0-0+9','100*0-0-0-0+0*0+9','100*0-0-0-0-0+0+9','100*0-0-0-0-0-0+9','100*0-0-0-0-0*0+9','100*0-0-0-0*0+0+9','100*0-0-0-0*0-0+9','100*0-0-0-0*0*0+9','100*0-0-0*0+0+0+9','100*0-0-0*0+0-0+9','100*0-0-0*0+0*0+9','100*0-0-0*0-0+0+9','100*0-0-0*0-0-0+9','100*0-0-0*0-0*0+9','100*0-0-0*0*0+0+9','100*0-0-0*0*0-0+9','100*0-0-0*0*0*0+9','100*0-0*0+0+0+0+9','100*0-0*0+0+0-0+9','100*0-0*0+0+0*0+9','100*0-0*0+0-0+0+9','100*0-0*0+0-0-0+9','100*0-0*0+0-0*0+9','100*0-0*0+0*0+0+9','100*0-0*0+0*0-0+9','100*0-0*0+0*0*0+9','100*0-0*0-0+0+0+9','100*0-0*0-0+0-0+9','100*0-0*0-0+0*0+9','100*0-0*0-0-0+0+9','100*0-0*0-0-0-0+9','100*0-0*0-0-0*0+9','100*0-0*0-0*0+0+9','100*0-0*0-0*0-0+9','100*0-0*0-0*0*0+9','100*0-0*0*0+0+0+9','100*0-0*0*0+0-0+9','100*0-0*0*0+0*0+9','100*0-0*0*0-0+0+9','100*0-0*0*0-0-0+9','100*0-0*0*0-0*0+9','100*0-0*0*0*0+0+9','100*0-0*0*0*0-0+9','100*0-0*0*0*0*0+9','100*0*0+0+0+0+0+9','100*0*0+0+0+0-0+9','100*0*0+0+0+0*0+9','100*0*0+0+0-0+0+9','100*0*0+0+0-0-0+9','100*0*0+0+0-0*0+9','100*0*0+0+0*0+0+9','100*0*0+0+0*0-0+9','100*0*0+0+0*0*0+9','100*0*0+0-0+0+0+9','100*0*0+0-0+0-0+9','100*0*0+0-0+0*0+9','100*0*0+0-0-0+0+9','100*0*0+0-0-0-0+9','100*0*0+0-0-0*0+9','100*0*0+0-0*0+0+9','100*0*0+0-0*0-0+9','100*0*0+0-0*0*0+9','100*0*0+0*0+0+0+9','100*0*0+0*0+0-0+9','100*0*0+0*0+0*0+9','100*0*0+0*0-0+0+9','100*0*0+0*0-0-0+9','100*0*0+0*0-0*0+9','100*0*0+0*0*0+0+9','100*0*0+0*0*0-0+9','100*0*0+0*0*0*0+9','100*0*0-0+0+0+0+9','100*0*0-0+0+0-0+9','100*0*0-0+0+0*0+9','100*0*0-0+0-0+0+9','100*0*0-0+0-0-0+9','100*0*0-0+0-0*0+9','100*0*0-0+0*0+0+9','100*0*0-0+0*0-0+9','100*0*0-0+0*0*0+9','100*0*0-0-0+0+0+9','100*0*0-0-0+0-0+9','100*0*0-0-0+0*0+9','100*0*0-0-0-0+0+9','100*0*0-0-0-0-0+9','100*0*0-0-0-0*0+9','100*0*0-0-0*0+0+9','100*0*0-0-0*0-0+9','100*0*0-0-0*0*0+9','100*0*0-0*0+0+0+9','100*0*0-0*0+0-0+9','100*0*0-0*0+0*0+9','100*0*0-0*0-0+0+9','100*0*0-0*0-0-0+9','100*0*0-0*0-0*0+9','100*0*0-0*0*0+0+9','100*0*0-0*0*0-0+9','100*0*0-0*0*0*0+9','100*0*0*0+0+0+0+9','100*0*0*0+0+0-0+9','100*0*0*0+0+0*0+9','100*0*0*0+0-0+0+9','100*0*0*0+0-0-0+9','100*0*0*0+0-0*0+9','100*0*0*0+0*0+0+9','100*0*0*0+0*0-0+9','100*0*0*0+0*0*0+9','100*0*0*0-0+0+0+9','100*0*0*0-0+0-0+9','100*0*0*0-0+0*0+9','100*0*0*0-0-0+0+9','100*0*0*0-0-0-0+9','100*0*0*0-0-0*0+9','100*0*0*0-0*0+0+9','100*0*0*0-0*0-0+9','100*0*0*0-0*0*0+9','100*0*0*0*0+0+0+9','100*0*0*0*0+0-0+9','100*0*0*0*0+0*0+9','100*0*0*0*0-0+0+9','100*0*0*0*0-0-0+9','100*0*0*0*0-0*0+9','100*0*0*0*0*0+0+9','100*0*0*0*0*0-0+9','100*0*0*0*0*0*0+9','1000*0+0+0+0+0+9','1000*0+0+0+0-0+9','1000*0+0+0+0*0+9','1000*0+0+0-0+0+9','1000*0+0+0-0-0+9','1000*0+0+0-0*0+9','1000*0+0+0*0+0+9','1000*0+0+0*0-0+9','1000*0+0+0*0*0+9','1000*0+0-0+0+0+9','1000*0+0-0+0-0+9','1000*0+0-0+0*0+9','1000*0+0-0-0+0+9','1000*0+0-0-0-0+9','1000*0+0-0-0*0+9','1000*0+0-0*0+0+9','1000*0+0-0*0-0+9','1000*0+0-0*0*0+9','1000*0+0*0+0+0+9','1000*0+0*0+0-0+9','1000*0+0*0+0*0+9','1000*0+0*0-0+0+9','1000*0+0*0-0-0+9','1000*0+0*0-0*0+9','1000*0+0*0*0+0+9','1000*0+0*0*0-0+9','1000*0+0*0*0*0+9','1000*0-0+0+0+0+9','1000*0-0+0+0-0+9','1000*0-0+0+0*0+9','1000*0-0+0-0+0+9','1000*0-0+0-0-0+9','1000*0-0+0-0*0+9','1000*0-0+0*0+0+9','1000*0-0+0*0-0+9','1000*0-0+0*0*0+9','1000*0-0-0+0+0+9','1000*0-0-0+0-0+9','1000*0-0-0+0*0+9','1000*0-0-0-0+0+9','1000*0-0-0-0-0+9','1000*0-0-0-0*0+9','1000*0-0-0*0+0+9','1000*0-0-0*0-0+9','1000*0-0-0*0*0+9','1000*0-0*0+0+0+9','1000*0-0*0+0-0+9','1000*0-0*0+0*0+9','1000*0-0*0-0+0+9','1000*0-0*0-0-0+9','1000*0-0*0-0*0+9','1000*0-0*0*0+0+9','1000*0-0*0*0-0+9','1000*0-0*0*0*0+9','1000*0*0+0+0+0+9','1000*0*0+0+0-0+9','1000*0*0+0+0*0+9','1000*0*0+0-0+0+9','1000*0*0+0-0-0+9','1000*0*0+0-0*0+9','1000*0*0+0*0+0+9','1000*0*0+0*0-0+9','1000*0*0+0*0*0+9','1000*0*0-0+0+0+9','1000*0*0-0+0-0+9','1000*0*0-0+0*0+9','1000*0*0-0-0+0+9','1000*0*0-0-0-0+9','1000*0*0-0-0*0+9','1000*0*0-0*0+0+9','1000*0*0-0*0-0+9','1000*0*0-0*0*0+9','1000*0*0*0+0+0+9','1000*0*0*0+0-0+9','1000*0*0*0+0*0+9','1000*0*0*0-0+0+9','1000*0*0*0-0-0+9','1000*0*0*0-0*0+9','1000*0*0*0*0+0+9','1000*0*0*0*0-0+9','1000*0*0*0*0*0+9','10000*0+0+0+0+9','10000*0+0+0-0+9','10000*0+0+0*0+9','10000*0+0-0+0+9','10000*0+0-0-0+9','10000*0+0-0*0+9','10000*0+0*0+0+9','10000*0+0*0-0+9','10000*0+0*0*0+9','10000*0-0+0+0+9','10000*0-0+0-0+9','10000*0-0+0*0+9','10000*0-0-0+0+9','10000*0-0-0-0+9','10000*0-0-0*0+9','10000*0-0*0+0+9','10000*0-0*0-0+9','10000*0-0*0*0+9','10000*0*0+0+0+9','10000*0*0+0-0+9','10000*0*0+0*0+9','10000*0*0-0+0+9','10000*0*0-0-0+9','10000*0*0-0*0+9','10000*0*0*0+0+9','10000*0*0*0-0+9','10000*0*0*0*0+9','100000*0+0+0+9','100000*0+0-0+9','100000*0+0*0+9','100000*0-0+0+9','100000*0-0-0+9','100000*0-0*0+9','100000*0*0+0+9','100000*0*0-0+9','100000*0*0*0+9','1000000*0+0+9','1000000*0-0+9','1000000*0*0+9','10000000*0+9']", - "[]", - "['999999999']", - "['0+1']", - "['1+2*3+4','1-2+3*4','12+3-4']" - ], - "boilerplate": { - "python": "class Solution:\n def addOperators(self, num: str, target: int) -> List[str]:\n ", - "java": "import java.util.List;\nimport java.util.ArrayList;\n\nclass Solution {\n public List addOperators(String num, int target) {\n List results = new ArrayList();\n // Implement your solution logic here\n return results;\n }\n}", - "cpp": "class Solution {\npublic:\n vector addOperators(string num, int target) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "import java.util.Arrays;\n\nArrays.sort(result);\nArrays.sort(expected);\nreturn Arrays.equals(result, expected);", - "cpp": "std::sort(result.begin(), result.end());\nstd::sort(expected.begin(), expected.end());\nreturn result == expected;" - }, - "explanation": "https://www.youtube.com/watch?v=tunRDBsP7OQ&pp=ygUhTmVldENvZGUgRXhwcmVzc2lvbiBBZGQgT3BlcmF0b3Jz", - "method_name": "addOperators" - }, - { - "title": "Remove Invalid Parentheses", - "source": "https://leetcode.com/problems/remove-invalid-parentheses/", - "description": "

Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.

\n\n

Return a list of unique strings that are valid with the minimum number of removals. You may return the answer in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "()())()"\nOutput: ["(())()","()()()"]\n
\n\n

Example 2:

\n\n
\nInput: s = "(a)())()"\nOutput: ["(a())()","(a)()()"]\n
\n\n

Example 3:

\n\n
\nInput: s = ")("\nOutput: [""]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 25
  • \n\t
  • s consists of lowercase English letters and parentheses '(' and ')'.
  • \n\t
  • There will be at most 20 parentheses in s.
  • \n
\n", - "difficulty": "hard", - "sample_test_cases": [ - "--arg1=\"()())()\"", - "--arg1=\"(a)())()\"", - "--arg1=\")(\"" - ], - "sample_test_results": [ - "['(())()','()()()']", - "['(a())()','(a)()()']", - "['']" - ], - "hidden_test_cases": [ - "--arg1=\"()())()\"", - "--arg1=\"(a)())()\"", - "--arg1=\")(\"", - "--arg1=\"((()\"", - "--arg1=\")()\"", - "--arg1=\"(())())\"", - "--arg1=\"())()(((\"", - "--arg1=\"(a)(b)(c))(\"", - "--arg1=\")()(\"", - "--arg1=\"((())\"" - ], - "hidden_test_results": [ - "['(())()','()()()']", - "['(a())()','(a)()()']", - "['']", - "['()']", - "['()']", - "['(()())','(())()']", - "['()()']", - "['(a(b)(c))','(a)(b(c))','(a)(b)(c)']", - "['()']", - "['(())']" - ], - "boilerplate": { - "python": "class Solution:\n def removeInvalidParentheses(self, s: str) -> List[str]:\n ", - "java": "class Solution {\n public List removeInvalidParentheses(String s) {\n \n }\n}", - "cpp": "class Solution {\npublic:\n vector removeInvalidParentheses(string s) {\n \n }\n};" - }, - "compare_func": { - "python": "return sorted(result) == sorted(eval(expected))", - "java": "List resultSorted = new ArrayList<>(result);\nCollections.sort(resultSorted);\nList expectedSorted = new ArrayList<>(Arrays.asList(eval(expected)));\nCollections.sort(expectedSorted);\nreturn resultSorted.equals(expectedSorted);", - "cpp": "bool compareFunction(const vector& result, const string& expected) {\n vector expectedVec;\n // Assumes a parsing function from string to vector exists\n parseStringToIntVector(expected, expectedVec);\n \n vector sortedResult = result;\n sort(sortedResult.begin(), sortedResult.end());\n \n sort(expectedVec.begin(), expectedVec.end());\n \n return sortedResult == expectedVec;\n}" - }, - "explanation": "https://www.youtube.com/watch?v=mgQ4O9iUEbg&pp=ygUjTmVldENvZGUgUmVtb3ZlIEludmFsaWQgUGFyZW50aGVzZXM%3D", - "method_name": "removeInvalidParentheses" - } - ] \ No newline at end of file + { + "title": "Two Sum", + "source": "https://leetcode.com/problems/two-sum/", + "description": "

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

\n\n

You may assume that each input would have exactly one solution, and you may not use the same element twice.

\n\n

You can return the answer in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [2,7,11,15], target = 9\nOutput: [0,1]\nExplanation: Because nums[0] + nums[1] == 9, we return [0, 1].\n
\n\n

Example 2:

\n\n
\nInput: nums = [3,2,4], target = 6\nOutput: [1,2]\n
\n\n

Example 3:

\n\n
\nInput: nums = [3,3], target = 6\nOutput: [0,1]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 2 <= nums.length <= 104
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • -109 <= target <= 109
  • \n\t
  • Only one valid answer exists.
  • \n
\n\n

 

\nFollow-up: Can you come up with an algorithm that is less than O(n2) time complexity?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[2,7,11,15] --arg2=9", + "--arg1=[3,2,4] --arg2=6", + "--arg1=[3,3] --arg2=6" + ], + "sample_test_results": [ + "[0,1]", + "[1,2]", + "[0,1]" + ], + "hidden_test_cases": [ + "--arg1=[49,61,74,96,29,88,53,-34,-48] --arg2=184", + "--arg1=[62,15,-95,26,-65,12,-86,-5,-40,-64,-91,-14,20,-36,83] --arg2=-60", + "--arg1=[-12,-75,90,56,-15,-55,-51,-27,61,24,-9,-58] --arg2=-85", + "--arg1=[-87,21,-26,13,-29,-53,-87,11] --arg2=-140", + "--arg1=[-65,6,58,-29] --arg2=-7", + "--arg1=[-87,54] --arg2=-33", + "--arg1=[-97,-10,89] --arg2=-8", + "--arg1=[30,57,-82,-8,92,99,82,-76] --arg2=74", + "--arg1=[75,-74,40] --arg2=1", + "--arg1=[-67,-35,76,71,-85,91,-55,-42,66,-28,1,89] --arg2=56" + ], + "hidden_test_results": [ + "[3,5]", + "[3,6]", + "[7,11]", + "[0,5]", + "[0,2]", + "[0,1]", + "[0,2]", + "[3,6]", + "[0,1]", + "[1,5]" + ], + "boilerplate": { + "python": "class Solution:\n def twoSum(self, nums: List[int], target: int) -> List[int]:\n ", + "java": "class Solution {\n public int[] twoSum(int[] nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector twoSum(vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "return Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray());", + "cpp": "std::sort(result.begin(), result.end());\nstd::vector expected_vector;\n// Convert expected string to vector (example using integer parsing)\nstd::stringstream ss(expected);\nint number;\nwhile (ss >> number) {\n expected_vector.push_back(number);\n if (ss.peek() == ',') {\n ss.ignore();\n }\n}\nstd::sort(expected_vector.begin(), expected_vector.end());\nreturn result == expected_vector;" + }, + "explanation": "https://www.youtube.com/watch?v=KLlXCFG5TnA&pp=ygUQTmVldENvZGUgVHdvIFN1bQ%3D%3D", + "method_name": "twoSum" + }, + { + "title": "Palindrome Number", + "source": "https://leetcode.com/problems/palindrome-number/", + "description": "

Given an integer x, return true if x is a palindrome, and false otherwise.

\n\n

 

\n

Example 1:

\n\n
\nInput: x = 121\nOutput: true\nExplanation: 121 reads as 121 from left to right and from right to left.\n
\n\n

Example 2:

\n\n
\nInput: x = -121\nOutput: false\nExplanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.\n
\n\n

Example 3:

\n\n
\nInput: x = 10\nOutput: false\nExplanation: Reads 01 from right to left. Therefore it is not a palindrome.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= x <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without converting the integer to a string?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=121", + "--arg1=-121", + "--arg1=10" + ], + "sample_test_results": [ + "true", + "false", + "false" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=1234321", + "--arg1=-1", + "--arg1=1000", + "--arg1=12321", + "--arg1=100001", + "--arg1=2147483647", + "--arg1=-2147483648", + "--arg1=11", + "--arg1=1000021" + ], + "hidden_test_results": [ + "true", + "true", + "false", + "false", + "true", + "true", + "false", + "false", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isPalindrome(self, x: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPalindrome(int x) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPalindrome(int x) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try {\n return result.equals(evaluateExpression(expected));\n} catch (Exception e) {\n return false;\n}\n\nString evaluateExpression(String expression) {\n // This section requires a method to safely evaluate the expression in the expected string.\n // Using a scripting engine or library for mathematical/eval expression such as \"javax.script.ScriptEngineManager\"\n // would typically be safe and effective here.\n ScriptEngineManager manager = new ScriptEngineManager();\n ScriptEngine engine = manager.getEngineByName(\"js\"); // Using JavaScript for simple evaluation\n try {\n Object evaluatedResult = engine.eval(expression);\n return String.valueOf(evaluatedResult);\n } catch (ScriptException e) {\n throw new RuntimeException(\"Error evaluating expression\", e);\n }\n}", + "cpp": "#include \n#include \n#include \n\n// This function will evaluate a string expression and return the corresponding result\nbool evaluateExpression(double result, const std::string& expression) {\n // Defining possible operations\n std::unordered_map> operations = {\n {'+', std::plus()},\n {'-', std::minus()},\n {'*', std::multiplies()},\n {'/', std::divides()}\n };\n\n // Scan the expression to evaluate it\n size_t pos = expression.find_first_of(\"+-*/\");\n if (pos != std::string::npos) {\n char op = expression[pos];\n double left = std::stod(expression.substr(0, pos));\n double right = std::stod(expression.substr(pos + 1));\n double evalResult = operations[op](left, right);\n return result == evalResult;\n }\n\n return false; // Return false if no operation found or invalid expression\n}\n\n// Usage:\n// bool isEqual = evaluateExpression(result, expected);" + }, + "explanation": "https://www.youtube.com/watch?v=yubRKwixN-U&pp=ygUaTmVldENvZGUgUGFsaW5kcm9tZSBOdW1iZXI%3D", + "method_name": "isPalindrome" + }, + { + "title": "Longest Common Prefix", + "source": "https://leetcode.com/problems/longest-common-prefix/", + "description": "

Write a function to find the longest common prefix string amongst an array of strings.

\n\n

If there is no common prefix, return an empty string "".

\n\n

 

\n

Example 1:

\n\n
\nInput: strs = ["flower","flow","flight"]\nOutput: "fl"\n
\n\n

Example 2:

\n\n
\nInput: strs = ["dog","racecar","car"]\nOutput: ""\nExplanation: There is no common prefix among the input strings.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= strs.length <= 200
  • \n\t
  • 0 <= strs[i].length <= 200
  • \n\t
  • strs[i] consists of only lowercase English letters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=['flower','flow','flight']", + "--arg1=['dog','racecar','car']" + ], + "sample_test_results": [ + "'fl'", + "''" + ], + "hidden_test_cases": [ + "--arg1=['interspecies','interstellar','interstate']", + "--arg1=['throne','throne']", + "--arg1=['']", + "--arg1=['a']", + "--arg1=['','b']", + "--arg1=['prefix','prefix','prefix']", + "--arg1=['abc','def','ghi']", + "--arg1=['flower','flower','flower','flower']", + "--arg1=['x','xy','xyz']", + "--arg1=['ab','a']" + ], + "hidden_test_results": [ + "'inters'", + "'throne'", + "''", + "'a'", + "''", + "'prefix'", + "''", + "'flower'", + "'x'", + "'a'" + ], + "boilerplate": { + "python": "class Solution:\n def longestCommonPrefix(self, strs: List[str]) -> str:\n ", + "java": "class Solution {\n public String longestCommonPrefix(String[] strs) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string longestCommonPrefix(vector& strs) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try {\n return result == (Boolean) engine.eval(expected);\n} catch (ScriptException e) {\n e.printStackTrace();\n return false;\n}", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=0sWShKIJoo4&pp=ygUeTmVldENvZGUgTG9uZ2VzdCBDb21tb24gUHJlZml4", + "method_name": "longestCommonPrefix" + }, + { + "title": "Valid Parentheses", + "source": "https://leetcode.com/problems/valid-parentheses/", + "description": "

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

\n\n

An input string is valid if:

\n\n
    \n\t
  1. Open brackets must be closed by the same type of brackets.
  2. \n\t
  3. Open brackets must be closed in the correct order.
  4. \n\t
  5. Every close bracket has a corresponding open bracket of the same type.
  6. \n
\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "()"

\n\n

Output: true

\n
\n\n

Example 2:

\n\n
\n

Input: s = "()[]{}"

\n\n

Output: true

\n
\n\n

Example 3:

\n\n
\n

Input: s = "(]"

\n\n

Output: false

\n
\n\n

Example 4:

\n\n
\n

Input: s = "([])"

\n\n

Output: true

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of parentheses only '()[]{}'.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='()'", + "--arg1='()[]{}'", + "--arg1='(]'", + "--arg1='([])'" + ], + "sample_test_results": [ + "true", + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1='{[]}'", + "--arg1='((()))'", + "--arg1='(()[]{})'", + "--arg1='}{}'", + "--arg1=''", + "--arg1='((())'", + "--arg1='())'", + "--arg1='([)]'", + "--arg1='{{{}}}'", + "--arg1='[({})]'" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "false", + "true", + "false", + "false", + "false", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def isValid(self, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean isValid(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isValid(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try {\n // Assuming the expected is a Java expression as a string.\n Object expectedResult = eval(expected); // Evaluate the expression\n return result.equals(expectedResult);\n} catch (Exception e) {\n return false; // Return false if there's any error in evaluation\n}", + "cpp": "#include \n#include \n#include \n\nbool isNumber(const std::string& str) {\n for (char const &c : str) {\n if (std::isdigit(c) == 0) return false;\n }\n return true;\n}\n\ndouble calculateExpression(const std::string& expr);\n\ndouble evalExpression(const std::string& expr) {\n return calculateExpression(expr);\n}\n\nbool compareFunction(const std::string& result, const std::string& expected) {\n if (isNumber(result) && isNumber(expected)) {\n return std::stod(result) == evalExpression(expected);\n }\n throw std::invalid_argument(\"Both inputs must be numeric in string format.\");\n}" + }, + "explanation": "https://www.youtube.com/watch?v=WTzjTskDFMg&pp=ygUaTmVldENvZGUgVmFsaWQgUGFyZW50aGVzZXM%3D", + "method_name": "isValid" + }, + { + "title": "Find the Index of the First Occurrence in a String", + "source": "https://leetcode.com/problems/implement-strstr/", + "description": "

Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

\n\n

 

\n

Example 1:

\n\n
\nInput: haystack = "sadbutsad", needle = "sad"\nOutput: 0\nExplanation: "sad" occurs at index 0 and 6.\nThe first occurrence is at index 0, so we return 0.\n
\n\n

Example 2:

\n\n
\nInput: haystack = "leetcode", needle = "leeto"\nOutput: -1\nExplanation: "leeto" did not occur in "leetcode", so we return -1.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= haystack.length, needle.length <= 104
  • \n\t
  • haystack and needle consist of only lowercase English characters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='sadbutsad' --arg2='sad'", + "--arg1='leetcode' --arg2='leeto'" + ], + "sample_test_results": [ + "0", + "-1" + ], + "hidden_test_cases": [ + "--arg1='hello' --arg2='ll'", + "--arg1='aaaaa' --arg2='bba'", + "--arg1='' --arg2=''", + "--arg1='a' --arg2='a'", + "--arg1='mississippi' --arg2='issi'", + "--arg1='aaaaaa' --arg2='aa'", + "--arg1='abc' --arg2='c'", + "--arg1='hello world' --arg2='world'", + "--arg1='abcabcd' --arg2='abcd'", + "--arg1='testing' --arg2=''" + ], + "hidden_test_results": [ + "2", + "-1", + "0", + "0", + "1", + "0", + "2", + "6", + "3", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def strStr(self, haystack: str, needle: str) -> int:\n ", + "java": "class Solution {\n public int strStr(String haystack, String needle) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int strStr(string haystack, string needle) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return Integer.parseInt(expected) == result;", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Gjkhm1gYIMw&pp=ygU7TmVldENvZGUgRmluZCB0aGUgSW5kZXggb2YgdGhlIEZpcnN0IE9jY3VycmVuY2UgaW4gYSBTdHJpbmc%3D", + "method_name": "strStr" + }, + { + "title": "Search Insert Position", + "source": "https://leetcode.com/problems/search-insert-position/", + "description": "

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.

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,3,5,6], target = 5\nOutput: 2\n
\n\n

Example 2:

\n\n
\nInput: nums = [1,3,5,6], target = 2\nOutput: 1\n
\n\n

Example 3:

\n\n
\nInput: nums = [1,3,5,6], target = 7\nOutput: 4\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 104
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • nums contains distinct values sorted in ascending order.
  • \n\t
  • -104 <= target <= 104
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,3,5,6] --arg2=5", + "--arg1=[1,3,5,6] --arg2=2", + "--arg1=[1,3,5,6] --arg2=7" + ], + "sample_test_results": [ + "2", + "1", + "4" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=0", + "--arg1=[1] --arg2=2", + "--arg1=[1,3,5,6,8,10] --arg2=9", + "--arg1=[1,4,6,7,8,9] --arg2=6", + "--arg1=[-5,-3,0,1,3] --arg2=-4", + "--arg1=[-3,-1,0,2] --arg2=1", + "--arg1=[1,2,3,4,5] --arg2=5", + "--arg1=[2,4,6,8] --arg2=1", + "--arg1=[1,3,5,7] --arg2=4", + "--arg1=[1,3,5,7,9] --arg2=8" + ], + "hidden_test_results": [ + "0", + "1", + "5", + "2", + "1", + "3", + "4", + "0", + "2", + "4" + ], + "boilerplate": { + "python": "class Solution:\n def searchInsert(self, nums: List[int], target: int) -> int:\n ", + "java": "class Solution {\n public int searchInsert(int[] nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int searchInsert(vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return Integer.valueOf(result).equals(Integer.valueOf(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=K-RYzDZkzCI&pp=ygUfTmVldENvZGUgU2VhcmNoIEluc2VydCBQb3NpdGlvbg%3D%3D", + "method_name": "searchInsert" + }, + { + "title": "Length of Last Word", + "source": "https://leetcode.com/problems/length-of-last-word/", + "description": "

Given a string s consisting of words and spaces, return the length of the last word in the string.

\n\n

A word is a maximal substring consisting of non-space characters only.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "Hello World"\nOutput: 5\nExplanation: The last word is "World" with length 5.\n
\n\n

Example 2:

\n\n
\nInput: s = "   fly me   to   the moon  "\nOutput: 4\nExplanation: The last word is "moon" with length 4.\n
\n\n

Example 3:

\n\n
\nInput: s = "luffy is still joyboy"\nOutput: 6\nExplanation: The last word is "joyboy" with length 6.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of only English letters and spaces ' '.
  • \n\t
  • There will be at least one word in s.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=\"Hello World\"", + "--arg1=\" fly me to the moon \"", + "--arg1=\"luffy is still joyboy\"" + ], + "sample_test_results": [ + "5", + "4", + "6" + ], + "hidden_test_cases": [ + "--arg1=\"a\"", + "--arg1=\"hello \"", + "--arg1=\" space\"", + "--arg1=\"multiple words here\"", + "--arg1=\"oneword\"", + "--arg1=\" spaces between words \"", + "--arg1=\"trailing space \"", + "--arg1=\" leading space\"", + "--arg1=\"multiple spaces between\"", + "--arg1=\"z\"" + ], + "hidden_test_results": [ + "1", + "5", + "5", + "4", + "7", + "5", + "5", + "5", + "7", + "1" + ], + "boilerplate": { + "python": "class Solution:\n def lengthOfLastWord(self, s: str) -> int:\n ", + "java": "class Solution {\n public int lengthOfLastWord(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int lengthOfLastWord(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=KT9rltZTybQ&pp=ygUcTmVldENvZGUgTGVuZ3RoIG9mIExhc3QgV29yZA%3D%3D", + "method_name": "lengthOfLastWord" + }, + { + "title": "Plus One", + "source": "https://leetcode.com/problems/plus-one/", + "description": "

You are given a large integer represented as an integer array digits, where each digits[i] is the ith 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 any leading 0's.

\n\n

Increment the large integer by one and return the resulting array of digits.

\n\n

 

\n

Example 1:

\n\n
\nInput: digits = [1,2,3]\nOutput: [1,2,4]\nExplanation: The array represents the integer 123.\nIncrementing by one gives 123 + 1 = 124.\nThus, the result should be [1,2,4].\n
\n\n

Example 2:

\n\n
\nInput: digits = [4,3,2,1]\nOutput: [4,3,2,2]\nExplanation: The array represents the integer 4321.\nIncrementing by one gives 4321 + 1 = 4322.\nThus, the result should be [4,3,2,2].\n
\n\n

Example 3:

\n\n
\nInput: digits = [9]\nOutput: [1,0]\nExplanation: The array represents the integer 9.\nIncrementing by one gives 9 + 1 = 10.\nThus, the result should be [1,0].\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= digits.length <= 100
  • \n\t
  • 0 <= digits[i] <= 9
  • \n\t
  • digits does not contain any leading 0's.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,2,3]", + "--arg1=[4,3,2,1]", + "--arg1=[9]" + ], + "sample_test_results": [ + "[1,2,4]", + "[4,3,2,2]", + "[1,0]" + ], + "hidden_test_cases": [ + "--arg1=[0]", + "--arg1=[9,9]", + "--arg1=[1,0,0]", + "--arg1=[1,9,9]", + "--arg1=[9,8,9]", + "--arg1=[1,2,3,4]", + "--arg1=[9,9,9,9]", + "--arg1=[5,0,9]", + "--arg1=[1]", + "--arg1=[4,9,9,9]" + ], + "hidden_test_results": [ + "[1]", + "[1,0,0]", + "[1,0,1]", + "[2,0,0]", + "[9,9,0]", + "[1,2,3,5]", + "[1,0,0,0,0]", + "[5,1,0]", + "[2]", + "[5,0,0,0]" + ], + "boilerplate": { + "python": "class Solution:\n def plusOne(self, digits: List[int]) -> List[int]:\n ", + "java": "class Solution {\n public int[] plusOne(int[] digits) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector plusOne(vector& digits) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=jIaA8boiG1s&pp=ygURTmVldENvZGUgUGx1cyBPbmU%3D", + "method_name": "plusOne" + }, + { + "title": "Add Binary", + "source": "https://leetcode.com/problems/add-binary/", + "description": "

Given two binary strings a and b, return their sum as a binary string.

\n\n

 

\n

Example 1:

\n
Input: a = \"11\", b = \"1\"\nOutput: \"100\"\n

Example 2:

\n
Input: a = \"1010\", b = \"1011\"\nOutput: \"10101\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= a.length, b.length <= 104
  • \n\t
  • a and b consist only of '0' or '1' characters.
  • \n\t
  • Each string does not contain leading zeros except for the zero itself.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=\"11\" --arg2=\"1\"", + "--arg1=\"1010\" --arg2=\"1011\"" + ], + "sample_test_results": [ + "'100'", + "'10101'" + ], + "hidden_test_cases": [ + "--arg1=\"0\" --arg2=\"0\"", + "--arg1=\"1\" --arg2=\"1\"", + "--arg1=\"111\" --arg2=\"111\"", + "--arg1=\"1111\" --arg2=\"1111\"", + "--arg1=\"1010\" --arg2=\"0101\"", + "--arg1=\"100\" --arg2=\"110\"", + "--arg1=\"11\" --arg2=\"11\"", + "--arg1=\"1\" --arg2=\"111\"", + "--arg1=\"1000\" --arg2=\"1100\"", + "--arg1=\"1111\" --arg2=\"1\"" + ], + "hidden_test_results": [ + "'0'", + "'10'", + "'1110'", + "'11110'", + "'1111'", + "'1010'", + "'110'", + "'1000'", + "'10100'", + "'10000'" + ], + "boilerplate": { + "python": "class Solution:\n def addBinary(self, a: str, b: str) -> str:\n ", + "java": "class Solution {\n public String addBinary(String a, String b) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string addBinary(string a, string b) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return Objects.equals(result, expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=keuWJ47xG8g&pp=ygUTTmVldENvZGUgQWRkIEJpbmFyeQ%3D%3D", + "method_name": "addBinary" + }, + { + "title": "Climbing Stairs", + "source": "https://leetcode.com/problems/climbing-stairs/", + "description": "

You are climbing a staircase. It takes n steps to reach the top.

\n\n

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 2\nOutput: 2\nExplanation: There are two ways to climb to the top.\n1. 1 step + 1 step\n2. 2 steps\n
\n\n

Example 2:

\n\n
\nInput: n = 3\nOutput: 3\nExplanation: There are three ways to climb to the top.\n1. 1 step + 1 step + 1 step\n2. 1 step + 2 steps\n3. 2 steps + 1 step\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 45
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=2", + "--arg1=3" + ], + "sample_test_results": [ + "2", + "3" + ], + "hidden_test_cases": [ + "--arg1=1", + "--arg1=4", + "--arg1=5", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9", + "--arg1=10", + "--arg1=20", + "--arg1=30" + ], + "hidden_test_results": [ + "1", + "5", + "8", + "13", + "21", + "34", + "55", + "89", + "10946", + "1346269" + ], + "boilerplate": { + "python": "class Solution:\n def climbStairs(self, n: int) -> int:\n ", + "java": "class Solution {\n public int climbStairs(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int climbStairs(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return result == Integer.parseInt(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Y0lT9Fck7qI&pp=ygUYTmVldENvZGUgQ2xpbWJpbmcgU3RhaXJz", + "method_name": "climbStairs" + }, + { + "title": "Best Time to Buy and Sell Stock", + "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock/", + "description": "

You are given an array prices where prices[i] is the price of a given stock on the ith day.

\n\n

You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.

\n\n

Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.

\n\n

 

\n

Example 1:

\n\n
\nInput: prices = [7,1,5,3,6,4]\nOutput: 5\nExplanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.\nNote that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.\n
\n\n

Example 2:

\n\n
\nInput: prices = [7,6,4,3,1]\nOutput: 0\nExplanation: In this case, no transactions are done and the max profit = 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= prices.length <= 105
  • \n\t
  • 0 <= prices[i] <= 104
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[7,1,5,3,6,4]", + "--arg1=[7,6,4,3,1]", + "--arg1=[2,4,1,7]" + ], + "sample_test_results": [ + "5", + "0", + "6" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,2]", + "--arg1=[2,1]", + "--arg1=[3,3,3]", + "--arg1=[1,2,4,2,5,7,2,4,9,0]", + "--arg1=[2,1,2,1,0,1,2]", + "--arg1=[9,8,7,6,5,4,3,2,1]", + "--arg1=[1,4,1,4,3,1]", + "--arg1=[10000,9999,9998,9997]", + "--arg1=[0,2,0,2,0,2]" + ], + "hidden_test_results": [ + "0", + "1", + "0", + "0", + "8", + "2", + "0", + "3", + "0", + "2" + ], + "boilerplate": { + "python": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", + "java": "class Solution {\n public int maxProfit(int[] prices) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxProfit(vector& prices) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=1pkOgXD63yU&pp=ygUoTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jaw%3D%3D", + "method_name": "maxProfit" + }, + { + "title": "Valid Palindrome", + "source": "https://leetcode.com/problems/valid-palindrome/", + "description": "

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.

\n\n

Given a string s, return true if it is a palindrome, or false otherwise.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "A man, a plan, a canal: Panama"\nOutput: true\nExplanation: "amanaplanacanalpanama" is a palindrome.\n
\n\n

Example 2:

\n\n
\nInput: s = "race a car"\nOutput: false\nExplanation: "raceacar" is not a palindrome.\n
\n\n

Example 3:

\n\n
\nInput: s = " "\nOutput: true\nExplanation: s is an empty string "" after removing non-alphanumeric characters.\nSince an empty string reads the same forward and backward, it is a palindrome.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 2 * 105
  • \n\t
  • s consists only of printable ASCII characters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=\"A man --arg2=a plan --arg3=a canal: Panama\"", + "--arg1=\"race a car\"", + "--arg1=\" \"" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=\"\"", + "--arg1=\". --arg2=\"", + "--arg1=\"0P\"", + "--arg1=\"abc123cba\"", + "--arg1=\"Race a Car\"", + "--arg1=\"!@#$%^&*()\"", + "--arg1=\"12321\"", + "--arg1=\"Never odd or even\"", + "--arg1=\"a\"", + "--arg1=\". --arg2=a --arg3=.\"" + ], + "hidden_test_results": [ + "true", + "true", + "false", + "false", + "false", + "true", + "true", + "true", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def isPalindrome(self, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean isPalindrome(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPalindrome(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=jJXJ16kPFWg&pp=ygUZTmVldENvZGUgVmFsaWQgUGFsaW5kcm9tZQ%3D%3D", + "method_name": "isPalindrome" + }, + { + "title": "Excel Sheet Column Title", + "source": "https://leetcode.com/problems/excel-sheet-column-title/", + "description": "

Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.

\n\n

For example:

\n\n
\nA -> 1\nB -> 2\nC -> 3\n...\nZ -> 26\nAA -> 27\nAB -> 28 \n...\n
\n\n

 

\n

Example 1:

\n\n
\nInput: columnNumber = 1\nOutput: "A"\n
\n\n

Example 2:

\n\n
\nInput: columnNumber = 28\nOutput: "AB"\n
\n\n

Example 3:

\n\n
\nInput: columnNumber = 701\nOutput: "ZY"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= columnNumber <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=1", + "--arg1=28", + "--arg1=701" + ], + "sample_test_results": [ + "'A'", + "'AB'", + "'ZY'" + ], + "hidden_test_cases": [ + "--arg1=26", + "--arg1=27", + "--arg1=52", + "--arg1=676", + "--arg1=702", + "--arg1=1000", + "--arg1=2147483647", + "--arg1=18278", + "--arg1=17576", + "--arg1=18277" + ], + "hidden_test_results": [ + "'Z'", + "'AA'", + "'AZ'", + "'YZ'", + "'ZZ'", + "'ALL'", + "'FXSHRXW'", + "'ZZZ'", + "'YYZ'", + "'ZZY'" + ], + "boilerplate": { + "python": "class Solution:\n def convertToTitle(self, columnNumber: int) -> str:\n ", + "java": "class Solution {\n public String convertToTitle(int columnNumber) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string convertToTitle(int columnNumber) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "#include \n#include \n#include \n#include \n#include \n\n// Function to evaluate mathematical expressions from a string\n// Simple implementation just for demonstration, assumed input well-formed\nstd::pair evaluateExpression(const std::string& expr) {\n std::istringstream iss(expr);\n double result;\n iss >> result; // just evaluates the first number for simplicity\n return std::make_pair(result, !iss.fail());\n}\n\ntemplate \nbool compareFunction(T result, const std::string& expected) {\n auto [evaluated, valid] = evaluateExpression(expected);\n return valid && result == evaluated;\n}\n\n// Example usage\nint main() {\n // Suppose we have result as double from some calculations\n double result = 42.0;\n std::string expected = \"42\";\n \n if (compareFunction(result, expected)) {\n std::cout << \"Result matches the expected expression.\" << std::endl;\n } else {\n std::cout << \"Result does not match the expected expression.\" << std::endl;\n }\n \n return 0;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=X_vJDpCCuoA&pp=ygUhTmVldENvZGUgRXhjZWwgU2hlZXQgQ29sdW1uIFRpdGxl", + "method_name": "convertToTitle" + }, + { + "title": "Happy Number", + "source": "https://leetcode.com/problems/happy-number/", + "description": "

Write an algorithm to determine if a number n is happy.

\n\n

A happy number is a number defined by the following process:

\n\n
    \n\t
  • Starting with any positive integer, replace the number by the sum of the squares of its digits.
  • \n\t
  • Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1.
  • \n\t
  • Those numbers for which this process ends in 1 are happy.
  • \n
\n\n

Return true if n is a happy number, and false if not.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 19\nOutput: true\nExplanation:\n12 + 92 = 82\n82 + 22 = 68\n62 + 82 = 100\n12 + 02 + 02 = 1\n
\n\n

Example 2:

\n\n
\nInput: n = 2\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=19", + "--arg1=2", + "--arg1=7" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=1", + "--arg1=4", + "--arg1=16", + "--arg1=89", + "--arg1=100", + "--arg1=1111111", + "--arg1=999999", + "--arg1=123", + "--arg1=3", + "--arg1=44" + ], + "hidden_test_results": [ + "true", + "false", + "false", + "false", + "true", + "true", + "false", + "false", + "false", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def isHappy(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isHappy(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isHappy(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return result.compare(expected) == 0;" + }, + "explanation": "https://www.youtube.com/watch?v=ljz85bxOYJ0&pp=ygUVTmVldENvZGUgSGFwcHkgTnVtYmVy", + "method_name": "isHappy" + }, + { + "title": "Isomorphic Strings", + "source": "https://leetcode.com/problems/isomorphic-strings/", + "description": "

Given two strings s and t, determine if they are isomorphic.

\n\n

Two strings s and t are isomorphic if the characters in s can be replaced to get t.

\n\n

All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself.

\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "egg", t = "add"

\n\n

Output: true

\n\n

Explanation:

\n\n

The strings s and t can be made identical by:

\n\n
    \n\t
  • Mapping 'e' to 'a'.
  • \n\t
  • Mapping 'g' to 'd'.
  • \n
\n
\n\n

Example 2:

\n\n
\n

Input: s = "foo", t = "bar"

\n\n

Output: false

\n\n

Explanation:

\n\n

The strings s and t can not be made identical as 'o' needs to be mapped to both 'a' and 'r'.

\n
\n\n

Example 3:

\n\n
\n

Input: s = "paper", t = "title"

\n\n

Output: true

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 5 * 104
  • \n\t
  • t.length == s.length
  • \n\t
  • s and t consist of any valid ascii character.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=\"egg\" --arg2=\"add\"", + "--arg1=\"foo\" --arg2=\"bar\"", + "--arg1=\"paper\" --arg2=\"title\"" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=\"\" --arg2=\"\"", + "--arg1=\"a\" --arg2=\"b\"", + "--arg1=\"ab\" --arg2=\"aa\"", + "--arg1=\"badc\" --arg2=\"bada\"", + "--arg1=\"abcde\" --arg2=\"vwxyz\"", + "--arg1=\"hello\" --arg2=\"world\"", + "--arg1=\"aaaa\" --arg2=\"bbbb\"", + "--arg1=\"ab\" --arg2=\"cd\"", + "--arg1=\"13\" --arg2=\"42\"", + "--arg1=\"ACAB\" --arg2=\"XCXY\"" + ], + "hidden_test_results": [ + "true", + "true", + "false", + "false", + "true", + "false", + "true", + "true", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def isIsomorphic(self, s: str, t: str) -> bool:\n ", + "java": "class Solution {\n public boolean isIsomorphic(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isIsomorphic(string s, string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=7yF-U1hLEqQ&pp=ygUbTmVldENvZGUgSXNvbW9ycGhpYyBTdHJpbmdz", + "method_name": "isIsomorphic" + }, + { + "title": "Contains Duplicate II", + "source": "https://leetcode.com/problems/contains-duplicate-ii/", + "description": "

Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) <= k.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,3,1], k = 3\nOutput: true\n
\n\n

Example 2:

\n\n
\nInput: nums = [1,0,1,1], k = 1\nOutput: true\n
\n\n

Example 3:

\n\n
\nInput: nums = [1,2,3,1,2,3], k = 2\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • 0 <= k <= 105
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,2,3,1] --arg2=3", + "--arg1=[1,0,1,1] --arg2=1", + "--arg1=[1,2,3,1,2,3] --arg2=2" + ], + "sample_test_results": [ + "true", + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1=[1,2,3,4,5] --arg2=2", + "--arg1=[1,1] --arg2=1", + "--arg1=[1,2,1] --arg2=0", + "--arg1=[1,2,3,4,1] --arg2=4", + "--arg1=[1,2,3,4,1] --arg2=3", + "--arg1=[-1,-1] --arg2=1", + "--arg1=[1] --arg2=1", + "--arg1=[1,2,3,4,2] --arg2=3", + "--arg1=[1,1,1,1] --arg2=2", + "--arg1=[1,2,1,2] --arg2=2" + ], + "hidden_test_results": [ + "false", + "true", + "false", + "true", + "false", + "true", + "false", + "true", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool:\n ", + "java": "class Solution {\n public boolean containsNearbyDuplicate(int[] nums, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool containsNearbyDuplicate(vector& nums, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=ypn0aZ0nrL4&pp=ygUeTmVldENvZGUgQ29udGFpbnMgRHVwbGljYXRlIElJ", + "method_name": "containsNearbyDuplicate" + }, + { + "title": "Summary Ranges", + "source": "https://leetcode.com/problems/summary-ranges/", + "description": "

You are given a sorted unique integer array nums.

\n\n

A range [a,b] is the set of all integers from a to b (inclusive).

\n\n

Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, each element of nums is covered by exactly one of the ranges, and there is no integer x such that x is in one of the ranges but not in nums.

\n\n

Each range [a,b] in the list should be output as:

\n\n
    \n\t
  • "a->b" if a != b
  • \n\t
  • "a" if a == b
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [0,1,2,4,5,7]\nOutput: ["0->2","4->5","7"]\nExplanation: The ranges are:\n[0,2] --> "0->2"\n[4,5] --> "4->5"\n[7,7] --> "7"\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,2,3,4,6,8,9]\nOutput: ["0","2->4","6","8->9"]\nExplanation: The ranges are:\n[0,0] --> "0"\n[2,4] --> "2->4"\n[6,6] --> "6"\n[8,9] --> "8->9"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 20
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n\t
  • All the values of nums are unique.
  • \n\t
  • nums is sorted in ascending order.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[0,1,2,4,5,7]", + "--arg1=[0,2,3,4,6,8,9]", + "--arg1=[]" + ], + "sample_test_results": [ + "['0->2','4->5','7']", + "['0','2->4','6','8->9']", + "[]" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,2]", + "--arg1=[1,3,5,7]", + "--arg1=[1,2,3,4,5]", + "--arg1=[-1,0,1,2]", + "--arg1=[-5,-4,-3,-1,0,2]", + "--arg1=[1,3]", + "--arg1=[1,2,4,6,7,8]", + "--arg1=[0,1,3,5,6,7,9]", + "--arg1=[-2147483648,2147483647]" + ], + "hidden_test_results": [ + "['1']", + "['1->2']", + "['1','3','5','7']", + "['1->5']", + "['-1->2']", + "['-5->-3','-1->0','2']", + "['1','3']", + "['1->2','4','6->8']", + "['0->1','3','5->7','9']", + "['-2147483648','2147483647']" + ], + "boilerplate": { + "python": "class Solution:\n def summaryRanges(self, nums: List[int]) -> List[str]:\n ", + "java": "class Solution {\n public List summaryRanges(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector summaryRanges(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "return Arrays.equals(Arrays.sort(result), Arrays.sort(new Gson().fromJson(expected, Object[].class)));", + "cpp": "std::sort(result.begin(), result.end());\nstd::vector expected_result;\neval(expected, expected_result); // Assume eval is a function that populates expected_result\nstd::sort(expected_result.begin(), expected_result.end());\nreturn result == expected_result;" + }, + "explanation": "https://www.youtube.com/watch?v=ZHJDwbfqoa8&pp=ygUXTmVldENvZGUgU3VtbWFyeSBSYW5nZXM%3D", + "method_name": "summaryRanges" + }, + { + "title": "Power of Two", + "source": "https://leetcode.com/problems/power-of-two/", + "description": "

Given an integer n, return true if it is a power of two. Otherwise, return false.

\n\n

An integer n is a power of two, if there exists an integer x such that n == 2x.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 1\nOutput: true\nExplanation: 20 = 1\n
\n\n

Example 2:

\n\n
\nInput: n = 16\nOutput: true\nExplanation: 24 = 16\n
\n\n

Example 3:

\n\n
\nInput: n = 3\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=1", + "--arg1=16", + "--arg1=3" + ], + "sample_test_results": [ + "true", + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=-16", + "--arg1=2", + "--arg1=4", + "--arg1=5", + "--arg1=32", + "--arg1=64", + "--arg1=100", + "--arg1=2147483647", + "--arg1=-2147483648" + ], + "hidden_test_results": [ + "false", + "false", + "true", + "true", + "false", + "true", + "true", + "false", + "false", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isPowerOfTwo(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPowerOfTwo(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPowerOfTwo(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=H2bjttEV4Vc&pp=ygUVTmVldENvZGUgUG93ZXIgb2YgVHdv", + "method_name": "isPowerOfTwo" + }, + { + "title": "Ugly Number", + "source": "https://leetcode.com/problems/ugly-number/", + "description": "

An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.

\n\n

Given an integer n, return true if n is an ugly number.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 6\nOutput: true\nExplanation: 6 = 2 × 3\n
\n\n

Example 2:

\n\n
\nInput: n = 1\nOutput: true\nExplanation: 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5.\n
\n\n

Example 3:

\n\n
\nInput: n = 14\nOutput: false\nExplanation: 14 is not ugly since it includes the prime factor 7.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=6", + "--arg1=1", + "--arg1=14" + ], + "sample_test_results": [ + "true", + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1=8", + "--arg1=0", + "--arg1=-6", + "--arg1=25", + "--arg1=15", + "--arg1=49", + "--arg1=30", + "--arg1=100", + "--arg1=-2147483648", + "--arg1=2147483647" + ], + "hidden_test_results": [ + "true", + "false", + "false", + "true", + "true", + "false", + "true", + "true", + "false", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isUgly(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isUgly(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isUgly(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=M0Zay1Qr9ws&pp=ygUUTmVldENvZGUgVWdseSBOdW1iZXI%3D", + "method_name": "isUgly" + }, + { + "title": "Word Pattern", + "source": "https://leetcode.com/problems/word-pattern/", + "description": "

Given a pattern and a string s, find if s follows the same pattern.

\n\n

Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. Specifically:

\n\n
    \n\t
  • Each letter in pattern maps to exactly one unique word in s.
  • \n\t
  • Each unique word in s maps to exactly one letter in pattern.
  • \n\t
  • No two letters map to the same word, and no two words map to the same letter.
  • \n
\n\n

 

\n

Example 1:

\n\n
\n

Input: pattern = "abba", s = "dog cat cat dog"

\n\n

Output: true

\n\n

Explanation:

\n\n

The bijection can be established as:

\n\n
    \n\t
  • 'a' maps to "dog".
  • \n\t
  • 'b' maps to "cat".
  • \n
\n
\n\n

Example 2:

\n\n
\n

Input: pattern = "abba", s = "dog cat cat fish"

\n\n

Output: false

\n
\n\n

Example 3:

\n\n
\n

Input: pattern = "aaaa", s = "dog cat cat dog"

\n\n

Output: false

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= pattern.length <= 300
  • \n\t
  • pattern contains only lower-case English letters.
  • \n\t
  • 1 <= s.length <= 3000
  • \n\t
  • s contains only lowercase English letters and spaces ' '.
  • \n\t
  • s does not contain any leading or trailing spaces.
  • \n\t
  • All the words in s are separated by a single space.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=\"abba\" --arg2=\"dog cat cat dog\"", + "--arg1=\"abba\" --arg2=\"dog cat cat fish\"", + "--arg1=\"aaaa\" --arg2=\"dog cat cat dog\"" + ], + "sample_test_results": [ + "true", + "false", + "false" + ], + "hidden_test_cases": [ + "--arg1=\"abc\" --arg2=\"dog cat dog\"", + "--arg1=\"jquery\" --arg2=\"jquery\"", + "--arg1=\"aaa\" --arg2=\"aa aa aa\"", + "--arg1=\"abba\" --arg2=\"dog dog dog dog\"", + "--arg1=\"ab\" --arg2=\"dog cat\"", + "--arg1=\"abc\" --arg2=\"b c a\"", + "--arg1=\"aabb\" --arg2=\"cat cat dog dog\"", + "--arg1=\"abba\" --arg2=\"dog cat cat fish\"", + "--arg1=\"\" --arg2=\"\"", + "--arg1=\"a\" --arg2=\"dog\"" + ], + "hidden_test_results": [ + "false", + "false", + "true", + "false", + "true", + "true", + "true", + "false", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def wordPattern(self, pattern: str, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean wordPattern(String pattern, String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool wordPattern(string pattern, string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=W_akoecmCbM&pp=ygUVTmVldENvZGUgV29yZCBQYXR0ZXJu", + "method_name": "wordPattern" + }, + { + "title": "Nim Game", + "source": "https://leetcode.com/problems/nim-game/", + "description": "

You are playing the following Nim Game with your friend:

\n\n
    \n\t
  • Initially, there is a heap of stones on the table.
  • \n\t
  • You and your friend will alternate taking turns, and you go first.
  • \n\t
  • On each turn, the person whose turn it is will remove 1 to 3 stones from the heap.
  • \n\t
  • The one who removes the last stone is the winner.
  • \n
\n\n

Given n, the number of stones in the heap, return true if you can win the game assuming both you and your friend play optimally, otherwise return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 4\nOutput: false\nExplanation: These are the possible outcomes:\n1. You remove 1 stone. Your friend removes 3 stones, including the last stone. Your friend wins.\n2. You remove 2 stones. Your friend removes 2 stones, including the last stone. Your friend wins.\n3. You remove 3 stones. Your friend removes the last stone. Your friend wins.\nIn all outcomes, your friend wins.\n
\n\n

Example 2:

\n\n
\nInput: n = 1\nOutput: true\n
\n\n

Example 3:

\n\n
\nInput: n = 2\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=4", + "--arg1=1", + "--arg1=2" + ], + "sample_test_results": [ + "false", + "true", + "true" + ], + "hidden_test_cases": [ + "--arg1=3", + "--arg1=5", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9", + "--arg1=10", + "--arg1=100", + "--arg1=1000000", + "--arg1=2147483647" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "false", + "true", + "true", + "false", + "false", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def canWinNim(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean canWinNim(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool canWinNim(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=ndR2buBWVc8&pp=ygURTmVldENvZGUgTmltIEdhbWU%3D", + "method_name": "canWinNim" + }, + { + "title": "Power of Three", + "source": "https://leetcode.com/problems/power-of-three/", + "description": "

Given an integer n, return true if it is a power of three. Otherwise, return false.

\n\n

An integer n is a power of three, if there exists an integer x such that n == 3x.

\n\n

 

\n

Example 1:

\n\n
\nInput: n = 27\nOutput: true\nExplanation: 27 = 33\n
\n\n

Example 2:

\n\n
\nInput: n = 0\nOutput: false\nExplanation: There is no x where 3x = 0.\n
\n\n

Example 3:

\n\n
\nInput: n = -1\nOutput: false\nExplanation: There is no x where 3x = (-1).\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=27", + "--arg1=0", + "--arg1=-1" + ], + "sample_test_results": [ + "true", + "false", + "false" + ], + "hidden_test_cases": [ + "--arg1=1", + "--arg1=9", + "--arg1=45", + "--arg1=81", + "--arg1=243", + "--arg1=-3", + "--arg1=2", + "--arg1=99", + "--arg1=19683", + "--arg1=-729" + ], + "hidden_test_results": [ + "true", + "true", + "false", + "true", + "true", + "false", + "false", + "false", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isPowerOfThree(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPowerOfThree(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPowerOfThree(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return std::tolower(std::string(result).compare(expected)) == 0;" + }, + "explanation": "https://www.youtube.com/watch?v=M2P2BAFmLlo&pp=ygUXTmVldENvZGUgUG93ZXIgb2YgVGhyZWU%3D", + "method_name": "isPowerOfThree" + }, + { + "title": "Power of Four", + "source": "https://leetcode.com/problems/power-of-four/", + "description": "

Given an integer n, return true if it is a power of four. Otherwise, return false.

\n\n

An integer n is a power of four, if there exists an integer x such that n == 4x.

\n\n

 

\n

Example 1:

\n
Input: n = 16\nOutput: true\n

Example 2:

\n
Input: n = 5\nOutput: false\n

Example 3:

\n
Input: n = 1\nOutput: true\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= n <= 231 - 1
  • \n
\n\n

 

\nFollow up: Could you solve it without loops/recursion?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=16", + "--arg1=5", + "--arg1=1" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=4", + "--arg1=64", + "--arg1=8", + "--arg1=256", + "--arg1=-4", + "--arg1=0", + "--arg1=2", + "--arg1=100", + "--arg1=1024", + "--arg1=-1024" + ], + "hidden_test_results": [ + "true", + "true", + "false", + "true", + "false", + "false", + "false", + "false", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isPowerOfFour(self, n: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPowerOfFour(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPowerOfFour(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return String.valueOf(result).toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=qEYZPwnlM0U&pp=ygUWTmVldENvZGUgUG93ZXIgb2YgRm91cg%3D%3D", + "method_name": "isPowerOfFour" + }, + { + "title": "Reverse Vowels of a String", + "source": "https://leetcode.com/problems/reverse-vowels-of-a-string/", + "description": "

Given a string s, reverse only all the vowels in the string and return it.

\n\n

The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once.

\n\n

 

\n

Example 1:

\n\n
\n

Input: s = "IceCreAm"

\n\n

Output: "AceCreIm"

\n\n

Explanation:

\n\n

The vowels in s are ['I', 'e', 'e', 'A']. On reversing the vowels, s becomes "AceCreIm".

\n
\n\n

Example 2:

\n\n
\n

Input: s = "leetcode"

\n\n

Output: "leotcede"

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 3 * 105
  • \n\t
  • s consist of printable ASCII characters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='IceCreAm'", + "--arg1='leetcode'" + ], + "sample_test_results": [ + "'AceCreIm'", + "'leotcede'" + ], + "hidden_test_cases": [ + "--arg1='hello'", + "--arg1='aA'", + "--arg1='race a car'", + "--arg1=''", + "--arg1='xyz'", + "--arg1='AEIOU'", + "--arg1='aeiou'", + "--arg1='. --arg2=!'", + "--arg1='Aa'", + "--arg1='LEetcOde'" + ], + "hidden_test_results": [ + "'holle'", + "'Aa'", + "'raca e car'", + "''", + "'xyz'", + "'UOIEA'", + "'uoiea'", + "'.,!'", + "'aA'", + "'LeOtcedE'" + ], + "boilerplate": { + "python": "class Solution:\n def reverseVowels(self, s: str) -> str:\n ", + "java": "class Solution {\n public String reverseVowels(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string reverseVowels(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "#include \n#include \n#include \n\nbool evaluateAndCompare(const std::string& result, const std::string& expected) {\n try {\n // Evaluate the expected expression\n int expectedValue = std::stoi(expected);\n int resultValue = std::stoi(result);\n // Compare result and evaluated expected value\n return resultValue == expectedValue;\n } catch (const std::invalid_argument& e) {\n // Handle conversion errors\n return false;\n } catch (const std::out_of_range& e) {\n // Handle out of range errors\n return false;\n }\n}" + }, + "explanation": "https://www.youtube.com/watch?v=uHYjUMR3Tg8&pp=ygUjTmVldENvZGUgUmV2ZXJzZSBWb3dlbHMgb2YgYSBTdHJpbmc%3D", + "method_name": "reverseVowels" + }, + { + "title": "Intersection of Two Arrays II", + "source": "https://leetcode.com/problems/intersection-of-two-arrays-ii/", + "description": "

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums1 = [1,2,2,1], nums2 = [2,2]\nOutput: [2,2]\n
\n\n

Example 2:

\n\n
\nInput: nums1 = [4,9,5], nums2 = [9,4,9,8,4]\nOutput: [4,9]\nExplanation: [9,4] is also accepted.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums1.length, nums2.length <= 1000
  • \n\t
  • 0 <= nums1[i], nums2[i] <= 1000
  • \n
\n\n

 

\n

Follow up:

\n\n
    \n\t
  • What if the given array is already sorted? How would you optimize your algorithm?
  • \n\t
  • What if nums1's size is small compared to nums2's size? Which algorithm is better?
  • \n\t
  • What if elements of nums2 are stored on disk, and the memory is limited such that you cannot load all elements into the memory at once?
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,2,2,1] --arg2=[2,2]", + "--arg1=[4,9,5] --arg2=[9,4,9,8,4]" + ], + "sample_test_results": [ + "[2,2]", + "[9,4]" + ], + "hidden_test_cases": [ + "--arg1=[1,1,1] --arg2=[1,1]", + "--arg1=[1,2] --arg2=[1,1]", + "--arg1=[1] --arg2=[1]", + "--arg1=[1,2,3] --arg2=[4,5,6]", + "--arg1=[1,2,3,4] --arg2=[1,2,3,4]", + "--arg1=[1,1,1,1] --arg2=[1]", + "--arg1=[] --arg2=[1]", + "--arg1=[1,2,2,3] --arg2=[2,2,2,3]", + "--arg1=[1,2,3,4,5] --arg2=[5,4,3,2,1]", + "--arg1=[1000,1000] --arg2=[1000,1000]" + ], + "hidden_test_results": [ + "[1,1]", + "[1]", + "[1]", + "[]", + "[1,2,3,4]", + "[1]", + "[]", + "[2,2,3]", + "[5,4,3,2,1]", + "[1000,1000]" + ], + "boilerplate": { + "python": "class Solution:\n def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:\n ", + "java": "class Solution {\n public int[] intersect(int[] nums1, int[] nums2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector intersect(vector& nums1, vector& nums2) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "return Arrays.equals(result.toArray(), Arrays.stream(eval(expected)).sorted().toArray())", + "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedVec;\nistringstream iss(expected.substr(1, expected.size() - 2));\nint number;\nwhile (iss >> number) {\n expectedVec.push_back(number);\n if (iss.peek() == ',')\n iss.ignore();\n}\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn result == expectedVec;" + }, + "explanation": "https://www.youtube.com/watch?v=fwUTXaMom6U&pp=ygUmTmVldENvZGUgSW50ZXJzZWN0aW9uIG9mIFR3byBBcnJheXMgSUk%3D", + "method_name": "intersect" + }, + { + "title": "Valid Perfect Square", + "source": "https://leetcode.com/problems/valid-perfect-square/", + "description": "

Given a positive integer num, return true if num is a perfect square or false otherwise.

\n\n

A perfect square is an integer that is the square of an integer. In other words, it is the product of some integer with itself.

\n\n

You must not use any built-in library function, such as sqrt.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = 16\nOutput: true\nExplanation: We return true because 4 * 4 = 16 and 4 is an integer.\n
\n\n

Example 2:

\n\n
\nInput: num = 14\nOutput: false\nExplanation: We return false because 3.742 * 3.742 = 14 and 3.742 is not an integer.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=16", + "--arg1=14", + "--arg1=1" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=4", + "--arg1=9", + "--arg1=25", + "--arg1=26", + "--arg1=100", + "--arg1=2147483647", + "--arg1=808201", + "--arg1=2", + "--arg1=3" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "false", + "true", + "false", + "true", + "false", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isPerfectSquare(self, num: int) -> bool:\n ", + "java": "class Solution {\n public boolean isPerfectSquare(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isPerfectSquare(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Cg_wWPHJ2Sk&pp=ygUdTmVldENvZGUgVmFsaWQgUGVyZmVjdCBTcXVhcmU%3D", + "method_name": "isPerfectSquare" + }, + { + "title": "Find the Difference", + "source": "https://leetcode.com/problems/find-the-difference/", + "description": "

You are given two strings s and t.

\n\n

String t is generated by random shuffling string s and then add one more letter at a random position.

\n\n

Return the letter that was added to t.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abcd", t = "abcde"\nOutput: "e"\nExplanation: 'e' is the letter that was added.\n
\n\n

Example 2:

\n\n
\nInput: s = "", t = "y"\nOutput: "y"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s.length <= 1000
  • \n\t
  • t.length == s.length + 1
  • \n\t
  • s and t consist of lowercase English letters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='abcd' --arg2='abcde'", + "--arg1='' --arg2='y'", + "--arg1='ae' --arg2='aea'" + ], + "sample_test_results": [ + "'e'", + "'y'", + "'a'" + ], + "hidden_test_cases": [ + "--arg1='abcd' --arg2='abcde'", + "--arg1='' --arg2='y'", + "--arg1='a' --arg2='aa'", + "--arg1='ae' --arg2='aea'", + "--arg1='abc' --arg2='cabd'", + "--arg1='xyz' --arg2='xyzz'", + "--arg1='aaa' --arg2='aaaa'", + "--arg1='bb' --arg2='bbb'", + "--arg1='abcd' --arg2='dbcae'", + "--arg1='hello' --arg2='hollae'" + ], + "hidden_test_results": [ + "'e'", + "'y'", + "'a'", + "'a'", + "'d'", + "'z'", + "'a'", + "'b'", + "'e'", + "'a'" + ], + "boilerplate": { + "python": "class Solution:\n def findTheDifference(self, s: str, t: str) -> str:\n ", + "java": "class Solution {\n public char findTheDifference(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n char findTheDifference(string s, string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return Objects.equals(result, Integer.parseInt(expected));", + "cpp": "return (result == std::stoi(expected)); // assuming expected is a string representation of an integer" + }, + "explanation": "https://www.youtube.com/watch?v=a4wqKR-znBE&pp=ygUcTmVldENvZGUgRmluZCB0aGUgRGlmZmVyZW5jZQ%3D%3D", + "method_name": "findTheDifference" + }, + { + "title": "Is Subsequence", + "source": "https://leetcode.com/problems/is-subsequence/", + "description": "

Given two strings s and t, return true if s is a subsequence of t, or false otherwise.

\n\n

A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not).

\n\n

 

\n

Example 1:

\n
Input: s = \"abc\", t = \"ahbgdc\"\nOutput: true\n

Example 2:

\n
Input: s = \"axc\", t = \"ahbgdc\"\nOutput: false\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s.length <= 100
  • \n\t
  • 0 <= t.length <= 104
  • \n\t
  • s and t consist only of lowercase English letters.
  • \n
\n\n

 

\nFollow up: Suppose there are lots of incoming s, say s1, s2, ..., sk where k >= 109, and you want to check one by one to see if t has its subsequence. In this scenario, how would you change your code?", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='abc' --arg2='ahbgdc'", + "--arg1='axc' --arg2='ahbgdc'", + "--arg1='' --arg2='ahbgdc'" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1='abc' --arg2='ahbgdc'", + "--arg1='' --arg2=''", + "--arg1='abc' --arg2='abc'", + "--arg1='abc' --arg2='abcd'", + "--arg1='abc' --arg2='acb'", + "--arg1='ab' --arg2='baab'", + "--arg1='leetcode' --arg2='yleets'", + "--arg1='b' --arg2='abc'", + "--arg1='bb' --arg2='ahbgb'", + "--arg1='aaaaaa' --arg2='bbaaaa'" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "false", + "true", + "false", + "true", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isSubsequence(self, s: str, t: str) -> bool:\n ", + "java": "class Solution {\n public boolean isSubsequence(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isSubsequence(string s, string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=99RVfqklbCE&pp=ygUXTmVldENvZGUgSXMgU3Vic2VxdWVuY2U%3D", + "method_name": "isSubsequence" + }, + { + "title": "Binary Watch", + "source": "https://leetcode.com/problems/binary-watch/", + "description": "

A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED represents a zero or one, with the least significant bit on the right.

\n\n
    \n\t
  • For example, the below binary watch reads "4:51".
  • \n
\n\n

\"\"

\n\n

Given an integer turnedOn which represents the number of LEDs that are currently on (ignoring the PM), return all possible times the watch could represent. You may return the answer in any order.

\n\n

The hour must not contain a leading zero.

\n\n
    \n\t
  • For example, "01:00" is not valid. It should be "1:00".
  • \n
\n\n

The minute must consist of two digits and may contain a leading zero.

\n\n
    \n\t
  • For example, "10:2" is not valid. It should be "10:02".
  • \n
\n\n

 

\n

Example 1:

\n
Input: turnedOn = 1\nOutput: [\"0:01\",\"0:02\",\"0:04\",\"0:08\",\"0:16\",\"0:32\",\"1:00\",\"2:00\",\"4:00\",\"8:00\"]\n

Example 2:

\n
Input: turnedOn = 9\nOutput: []\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= turnedOn <= 10
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=1", + "--arg1=9", + "--arg1=2" + ], + "sample_test_results": [ + "['0:01','0:02','0:04','0:08','0:16','0:32','1:00','2:00','4:00','8:00']", + "[]", + "['0:03','0:05','0:06','0:09','0:10','0:12','0:17','0:18','0:20','0:24','0:33','0:34','0:36','0:40','0:48','1:01','1:02','1:04','1:08','1:16','1:32','2:01','2:02','2:04','2:08','2:16','2:32','3:00','4:01','4:02','4:04','4:08','4:16','4:32','5:00','6:00','8:01','8:02','8:04','8:08','8:16','8:32','9:00','10:00']" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=1", + "--arg1=2", + "--arg1=3", + "--arg1=4", + "--arg1=5", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9" + ], + "hidden_test_results": [ + "['0:00']", + "['0:01','0:02','0:04','0:08','0:16','0:32','1:00','2:00','4:00','8:00']", + "['0:03','0:05','0:06','0:09','0:10','0:12','0:17','0:18','0:20','0:24','0:33','0:34','0:36','0:40','0:48','1:01','1:02','1:04','1:08','1:16','1:32','2:01','2:02','2:04','2:08','2:16','2:32','3:00','4:01','4:02','4:04','4:08','4:16','4:32','5:00','6:00','8:01','8:02','8:04','8:08','8:16','8:32','9:00','10:00']", + "['0:07','0:11','0:13','0:14','0:19','0:21','0:22','0:25','0:26','0:28','0:35','0:37','0:38','0:41','0:42','0:44','0:49','0:50','0:52','0:56','1:03','1:05','1:06','1:09','1:10','1:12','1:17','1:18','1:20','1:24','1:33','1:34','1:36','1:40','1:48','2:03','2:05','2:06','2:09','2:10','2:12','2:17','2:18','2:20','2:24','2:33','2:34','2:36','2:40','2:48','3:01','3:02','3:04','3:08','3:16','3:32','4:03','4:05','4:06','4:09','4:10','4:12','4:17','4:18','4:20','4:24','4:33','4:34','4:36','4:40','4:48','5:01','5:02','5:04','5:08','5:16','5:32','6:01','6:02','6:04','6:08','6:16','6:32','7:00','8:03','8:05','8:06','8:09','8:10','8:12','8:17','8:18','8:20','8:24','8:33','8:34','8:36','8:40','8:48','9:01','9:02','9:04','9:08','9:16','9:32','10:01','10:02','10:04','10:08','10:16','10:32','11:00']", + "['0:15','0:23','0:27','0:29','0:30','0:39','0:43','0:45','0:46','0:51','0:53','0:54','0:57','0:58','1:07','1:11','1:13','1:14','1:19','1:21','1:22','1:25','1:26','1:28','1:35','1:37','1:38','1:41','1:42','1:44','1:49','1:50','1:52','1:56','2:07','2:11','2:13','2:14','2:19','2:21','2:22','2:25','2:26','2:28','2:35','2:37','2:38','2:41','2:42','2:44','2:49','2:50','2:52','2:56','3:03','3:05','3:06','3:09','3:10','3:12','3:17','3:18','3:20','3:24','3:33','3:34','3:36','3:40','3:48','4:07','4:11','4:13','4:14','4:19','4:21','4:22','4:25','4:26','4:28','4:35','4:37','4:38','4:41','4:42','4:44','4:49','4:50','4:52','4:56','5:03','5:05','5:06','5:09','5:10','5:12','5:17','5:18','5:20','5:24','5:33','5:34','5:36','5:40','5:48','6:03','6:05','6:06','6:09','6:10','6:12','6:17','6:18','6:20','6:24','6:33','6:34','6:36','6:40','6:48','7:01','7:02','7:04','7:08','7:16','7:32','8:07','8:11','8:13','8:14','8:19','8:21','8:22','8:25','8:26','8:28','8:35','8:37','8:38','8:41','8:42','8:44','8:49','8:50','8:52','8:56','9:03','9:05','9:06','9:09','9:10','9:12','9:17','9:18','9:20','9:24','9:33','9:34','9:36','9:40','9:48','10:03','10:05','10:06','10:09','10:10','10:12','10:17','10:18','10:20','10:24','10:33','10:34','10:36','10:40','10:48','11:01','11:02','11:04','11:08','11:16','11:32']", + "['0:31','0:47','0:55','0:59','1:15','1:23','1:27','1:29','1:30','1:39','1:43','1:45','1:46','1:51','1:53','1:54','1:57','1:58','2:15','2:23','2:27','2:29','2:30','2:39','2:43','2:45','2:46','2:51','2:53','2:54','2:57','2:58','3:07','3:11','3:13','3:14','3:19','3:21','3:22','3:25','3:26','3:28','3:35','3:37','3:38','3:41','3:42','3:44','3:49','3:50','3:52','3:56','4:15','4:23','4:27','4:29','4:30','4:39','4:43','4:45','4:46','4:51','4:53','4:54','4:57','4:58','5:07','5:11','5:13','5:14','5:19','5:21','5:22','5:25','5:26','5:28','5:35','5:37','5:38','5:41','5:42','5:44','5:49','5:50','5:52','5:56','6:07','6:11','6:13','6:14','6:19','6:21','6:22','6:25','6:26','6:28','6:35','6:37','6:38','6:41','6:42','6:44','6:49','6:50','6:52','6:56','7:03','7:05','7:06','7:09','7:10','7:12','7:17','7:18','7:20','7:24','7:33','7:34','7:36','7:40','7:48','8:15','8:23','8:27','8:29','8:30','8:39','8:43','8:45','8:46','8:51','8:53','8:54','8:57','8:58','9:07','9:11','9:13','9:14','9:19','9:21','9:22','9:25','9:26','9:28','9:35','9:37','9:38','9:41','9:42','9:44','9:49','9:50','9:52','9:56','10:07','10:11','10:13','10:14','10:19','10:21','10:22','10:25','10:26','10:28','10:35','10:37','10:38','10:41','10:42','10:44','10:49','10:50','10:52','10:56','11:03','11:05','11:06','11:09','11:10','11:12','11:17','11:18','11:20','11:24','11:33','11:34','11:36','11:40','11:48']", + "['1:31','1:47','1:55','1:59','2:31','2:47','2:55','2:59','3:15','3:23','3:27','3:29','3:30','3:39','3:43','3:45','3:46','3:51','3:53','3:54','3:57','3:58','4:31','4:47','4:55','4:59','5:15','5:23','5:27','5:29','5:30','5:39','5:43','5:45','5:46','5:51','5:53','5:54','5:57','5:58','6:15','6:23','6:27','6:29','6:30','6:39','6:43','6:45','6:46','6:51','6:53','6:54','6:57','6:58','7:07','7:11','7:13','7:14','7:19','7:21','7:22','7:25','7:26','7:28','7:35','7:37','7:38','7:41','7:42','7:44','7:49','7:50','7:52','7:56','8:31','8:47','8:55','8:59','9:15','9:23','9:27','9:29','9:30','9:39','9:43','9:45','9:46','9:51','9:53','9:54','9:57','9:58','10:15','10:23','10:27','10:29','10:30','10:39','10:43','10:45','10:46','10:51','10:53','10:54','10:57','10:58','11:07','11:11','11:13','11:14','11:19','11:21','11:22','11:25','11:26','11:28','11:35','11:37','11:38','11:41','11:42','11:44','11:49','11:50','11:52','11:56']", + "['3:31','3:47','3:55','3:59','5:31','5:47','5:55','5:59','6:31','6:47','6:55','6:59','7:15','7:23','7:27','7:29','7:30','7:39','7:43','7:45','7:46','7:51','7:53','7:54','7:57','7:58','9:31','9:47','9:55','9:59','10:31','10:47','10:55','10:59','11:15','11:23','11:27','11:29','11:30','11:39','11:43','11:45','11:46','11:51','11:53','11:54','11:57','11:58']", + "['7:31','7:47','7:55','7:59','11:31','11:47','11:55','11:59']", + "[]" + ], + "boilerplate": { + "python": "class Solution:\n def readBinaryWatch(self, turnedOn: int) -> List[str]:\n ", + "java": "class Solution {\n public List readBinaryWatch(int turnedOn) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector readBinaryWatch(int turnedOn) {\n \n }\n};" + }, + "compare_func": { + "python": "def sorted_list_strings(lst):\n return sorted([str(x) for x in eval(lst)])\n return sorted(result) == sorted_list_strings(expected)", + "java": "try {\n List evalResult = Arrays.asList(eval(expected).replace(\"[\", \"\").replace(\"]\", \"\").split(\",\"));\n List resultAsString = result.stream().map(Object::toString).collect(Collectors.toList());\n Collections.sort(resultAsString);\n Collections.sort(evalResult);\n return resultAsString.equals(evalResult);\n} catch (Exception e) {\n return false;\n}", + "cpp": "std::multiset sorted_list_strings(const std::string& lst) {\n std::multiset sortedStrings;\n std::string cleaned = lst;\n // Remove leading/trailing whitespace\n cleaned.erase(0, cleaned.find_first_not_of(\" \\t\\n\\r\"));\n cleaned.erase(cleaned.find_last_not_of(\" \\t\\n\\r\") + 1);\n \n // Substitute all commas with spaces\n std::replace(cleaned.begin(), cleaned.end(), ',', ' ');\n std::stringstream ss(cleaned);\n std::string item;\n \n while(ss >> item) {\n sortedStrings.insert(item);\n }\n return sortedStrings;\n}\n\nreturn std::multiset(result.begin(), result.end()) == sorted_list_strings(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=0BanwDe6cMY&pp=ygUVTmVldENvZGUgQmluYXJ5IFdhdGNo", + "method_name": "readBinaryWatch" + }, + { + "title": "Convert a Number to Hexadecimal", + "source": "https://leetcode.com/problems/convert-a-number-to-hexadecimal/", + "description": "

Given a 32-bit integer num, return a string representing its hexadecimal representation. For negative integers, two’s complement method is used.

\n\n

All the letters in the answer string should be lowercase characters, and there should not be any leading zeros in the answer except for the zero itself.

\n\n

Note: You are not allowed to use any built-in library method to directly solve this problem.

\n\n

 

\n

Example 1:

\n
Input: num = 26\nOutput: \"1a\"\n

Example 2:

\n
Input: num = -1\nOutput: \"ffffffff\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -231 <= num <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=26", + "--arg1=-1", + "--arg1=0" + ], + "sample_test_results": [ + "'1a'", + "'ffffffff'", + "'0'" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=16", + "--arg1=26", + "--arg1=-1", + "--arg1=2147483647", + "--arg1=-2147483648", + "--arg1=100", + "--arg1=-100", + "--arg1=255", + "--arg1=-255" + ], + "hidden_test_results": [ + "'0'", + "'10'", + "'1a'", + "'ffffffff'", + "'7fffffff'", + "'80000000'", + "'64'", + "'ffffff9c'", + "'ff'", + "'ffffff01'" + ], + "boilerplate": { + "python": "class Solution:\n def toHex(self, num: int) -> str:\n ", + "java": "class Solution {\n public String toHex(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string toHex(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "boolean resultAsExpected = false;\ntry {\n ScriptEngineManager mgr = new ScriptEngineManager();\n ScriptEngine engine = mgr.getEngineByName(\"JavaScript\");\n Object expectedVal = engine.eval(expected);\n if (expectedVal instanceof Boolean) {\n resultAsExpected = (boolean) expectedVal == result;\n } else if (expectedVal instanceof Number) {\n resultAsExpected = Double.compare(((Number) expectedVal).doubleValue(), ((Number) result).doubleValue()) == 0;\n } else {\n resultAsExpected = expectedVal.equals(result);\n }\n} catch (ScriptException e) {\n // Handle scripting evaluation errors if necessary\n}", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=I1HBykyZvbc&pp=ygUoTmVldENvZGUgQ29udmVydCBhIE51bWJlciB0byBIZXhhZGVjaW1hbA%3D%3D", + "method_name": "toHex" + }, + { + "title": "Longest Palindrome", + "source": "https://leetcode.com/problems/longest-palindrome/", + "description": "

Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.

\n\n

Letters are case sensitive, for example, "Aa" is not considered a palindrome.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abccccdd"\nOutput: 7\nExplanation: One longest palindrome that can be built is "dccaccd", whose length is 7.\n
\n\n

Example 2:

\n\n
\nInput: s = "a"\nOutput: 1\nExplanation: The longest palindrome that can be built is "a", whose length is 1.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 2000
  • \n\t
  • s consists of lowercase and/or uppercase English letters only.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='abccccdd'", + "--arg1='a'", + "--arg1='Aa'" + ], + "sample_test_results": [ + "7", + "1", + "1" + ], + "hidden_test_cases": [ + "--arg1='racecar'", + "--arg1='aaaaaa'", + "--arg1='abcde'", + "--arg1='AAaa'", + "--arg1='aA'", + "--arg1='z'", + "--arg1='abccba'", + "--arg1='aaabbbcccc'", + "--arg1='abcABC'", + "--arg1=''" + ], + "hidden_test_results": [ + "7", + "6", + "1", + "4", + "1", + "1", + "6", + "9", + "1", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def longestPalindrome(self, s: str) -> int:\n ", + "java": "class Solution {\n public int longestPalindrome(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int longestPalindrome(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=_g9jrLuAphs&pp=ygUbTmVldENvZGUgTG9uZ2VzdCBQYWxpbmRyb21l", + "method_name": "longestPalindrome" + }, + { + "title": "Add Strings", + "source": "https://leetcode.com/problems/add-strings/", + "description": "

Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string.

\n\n

You must solve the problem without using any built-in library for handling large integers (such as BigInteger). You must also not convert the inputs to integers directly.

\n\n

 

\n

Example 1:

\n\n
\nInput: num1 = "11", num2 = "123"\nOutput: "134"\n
\n\n

Example 2:

\n\n
\nInput: num1 = "456", num2 = "77"\nOutput: "533"\n
\n\n

Example 3:

\n\n
\nInput: num1 = "0", num2 = "0"\nOutput: "0"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num1.length, num2.length <= 104
  • \n\t
  • num1 and num2 consist of only digits.
  • \n\t
  • num1 and num2 don't have any leading zeros except for the zero itself.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='11' --arg2='123'", + "--arg1='456' --arg2='77'", + "--arg1='0' --arg2='0'" + ], + "sample_test_results": [ + "'134'", + "'533'", + "'0'" + ], + "hidden_test_cases": [ + "--arg1='9' --arg2='1'", + "--arg1='999' --arg2='1'", + "--arg1='1' --arg2='999'", + "--arg1='0' --arg2='1'", + "--arg1='1' --arg2='0'", + "--arg1='999999' --arg2='1'", + "--arg1='123' --arg2='456'", + "--arg1='1000' --arg2='2000'", + "--arg1='9999' --arg2='9999'", + "--arg1='1111' --arg2='9999'" + ], + "hidden_test_results": [ + "'10'", + "'1000'", + "'1000'", + "'1'", + "'1'", + "'1000000'", + "'579'", + "'3000'", + "'19998'", + "'11110'" + ], + "boilerplate": { + "python": "class Solution:\n def addStrings(self, num1: str, num2: str) -> str:\n ", + "java": "class Solution {\n public String addStrings(String num1, String num2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string addStrings(string num1, string num2) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == eval(expected)", + "java": "return result.toString().equals(String.valueOf(eval(expected)));", + "cpp": "bool compareFunction(const std::string &result, const std::string &expected) {\n return result == expected;\n}\n" + }, + "explanation": "https://www.youtube.com/watch?v=jziDtPZJ4fw&pp=ygUUTmVldENvZGUgQWRkIFN0cmluZ3M%3D", + "method_name": "addStrings" + }, + { + "title": "Arranging Coins", + "source": "https://leetcode.com/problems/arranging-coins/", + "description": "

You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete.

\n\n

Given the integer n, return the number of complete rows of the staircase you will build.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: n = 5\nOutput: 2\nExplanation: Because the 3rd row is incomplete, we return 2.\n
\n\n

Example 2:

\n\"\"\n
\nInput: n = 8\nOutput: 3\nExplanation: Because the 4th row is incomplete, we return 3.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 231 - 1
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=5", + "--arg1=8", + "--arg1=1" + ], + "sample_test_results": [ + "2", + "3", + "1" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=3", + "--arg1=10", + "--arg1=15", + "--arg1=21", + "--arg1=100", + "--arg1=1000", + "--arg1=10000", + "--arg1=2147483647", + "--arg1=6" + ], + "hidden_test_results": [ + "0", + "2", + "4", + "5", + "6", + "13", + "44", + "140", + "65535", + "3" + ], + "boilerplate": { + "python": "class Solution:\n def arrangeCoins(self, n: int) -> int:\n ", + "java": "class Solution {\n public int arrangeCoins(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int arrangeCoins(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=5rHz_6s2Buw&pp=ygUYTmVldENvZGUgQXJyYW5naW5nIENvaW5z", + "method_name": "arrangeCoins" + }, + { + "title": "Assign Cookies", + "source": "https://leetcode.com/problems/assign-cookies/", + "description": "

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.

\n\n

Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and each cookie j has a size s[j]. If s[j] >= g[i], we can assign the cookie j to the child i, and the child i will be content. Your goal is to maximize the number of your content children and output the maximum number.

\n\n

 

\n

Example 1:

\n\n
\nInput: g = [1,2,3], s = [1,1]\nOutput: 1\nExplanation: You have 3 children and 2 cookies. The greed factors of 3 children are 1, 2, 3. \nAnd even though you have 2 cookies, since their size is both 1, you could only make the child whose greed factor is 1 content.\nYou need to output 1.\n
\n\n

Example 2:

\n\n
\nInput: g = [1,2], s = [1,2,3]\nOutput: 2\nExplanation: You have 2 children and 3 cookies. The greed factors of 2 children are 1, 2. \nYou have 3 cookies and their sizes are big enough to gratify all of the children, \nYou need to output 2.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= g.length <= 3 * 104
  • \n\t
  • 0 <= s.length <= 3 * 104
  • \n\t
  • 1 <= g[i], s[j] <= 231 - 1
  • \n
\n\n

 

\n

Note: This question is the same as 2410: Maximum Matching of Players With Trainers.

\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,2,3] --arg2=[1,1]", + "--arg1=[1,2] --arg2=[1,2,3]", + "--arg1=[1,2,3] --arg2=[]" + ], + "sample_test_results": [ + "1", + "2", + "0" + ], + "hidden_test_cases": [ + "--arg1=[] --arg2=[1,2,3]", + "--arg1=[1,2] --arg2=[1]", + "--arg1=[2] --arg2=[1]", + "--arg1=[1,2,3] --arg2=[1,2,3]", + "--arg1=[10,9,8,7] --arg2=[5,6,7,8]", + "--arg1=[1,1,1] --arg2=[1,1,1]", + "--arg1=[2,3,4,5] --arg2=[1,2,3]", + "--arg1=[1] --arg2=[2]", + "--arg1=[3,4,5] --arg2=[1,2]", + "--arg1=[1,2,3] --arg2=[3]" + ], + "hidden_test_results": [ + "0", + "1", + "0", + "3", + "2", + "3", + "2", + "1", + "0", + "1" + ], + "boilerplate": { + "python": "class Solution:\n def findContentChildren(self, g: List[int], s: List[int]) -> int:\n ", + "java": "class Solution {\n public int findContentChildren(int[] g, int[] s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findContentChildren(vector& g, vector& s) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=JW8fgvoxPTg&pp=ygUXTmVldENvZGUgQXNzaWduIENvb2tpZXM%3D", + "method_name": "findContentChildren" + }, + { + "title": "Repeated Substring Pattern", + "source": "https://leetcode.com/problems/repeated-substring-pattern/", + "description": "

Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "abab"\nOutput: true\nExplanation: It is the substring "ab" twice.\n
\n\n

Example 2:

\n\n
\nInput: s = "aba"\nOutput: false\n
\n\n

Example 3:

\n\n
\nInput: s = "abcabcabcabc"\nOutput: true\nExplanation: It is the substring "abc" four times or the substring "abcabc" twice.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s consists of lowercase English letters.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='abab'", + "--arg1='aba'", + "--arg1='abcabcabcabc'" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=''", + "--arg1='a'", + "--arg1='aa'", + "--arg1='aaa'", + "--arg1='aabaaba'", + "--arg1='abaababaab'", + "--arg1='aaaaa'", + "--arg1='abcabc'", + "--arg1='abcabcabc'", + "--arg1='abac'" + ], + "hidden_test_results": [ + "true", + "false", + "true", + "true", + "false", + "true", + "true", + "true", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def repeatedSubstringPattern(self, s: str) -> bool:\n ", + "java": "class Solution {\n public boolean repeatedSubstringPattern(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool repeatedSubstringPattern(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=2qEmA76Unm4&pp=ygUjTmVldENvZGUgUmVwZWF0ZWQgU3Vic3RyaW5nIFBhdHRlcm4%3D", + "method_name": "repeatedSubstringPattern" + }, + { + "title": "License Key Formatting", + "source": "https://leetcode.com/problems/license-key-formatting/", + "description": "

You are given a license key represented as a string s that consists of only alphanumeric characters and dashes. The string is separated into n + 1 groups by n dashes. You are also given an integer k.

\n\n

We want to reformat the string s such that each group contains exactly k characters, except for the first group, which could be shorter than k but still must contain at least one character. Furthermore, there must be a dash inserted between two groups, and you should convert all lowercase letters to uppercase.

\n\n

Return the reformatted license key.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "5F3Z-2e-9-w", k = 4\nOutput: "5F3Z-2E9W"\nExplanation: The string s has been split into two parts, each part has 4 characters.\nNote that the two extra dashes are not needed and can be removed.\n
\n\n

Example 2:

\n\n
\nInput: s = "2-5g-3-J", k = 2\nOutput: "2-5G-3J"\nExplanation: The string s has been split into three parts, each part has 2 characters except the first part as it could be shorter as mentioned above.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 105
  • \n\t
  • s consists of English letters, digits, and dashes '-'.
  • \n\t
  • 1 <= k <= 104
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1='5F3Z-2e-9-w' --arg2=4", + "--arg1='2-5g-3-J' --arg2=2" + ], + "sample_test_results": [ + "'5F3Z-2E9W'", + "'2-5G-3J'" + ], + "hidden_test_cases": [ + "--arg1='a-a-a-a-' --arg2=1", + "--arg1='---' --arg2=3", + "--arg1='2' --arg2=2", + "--arg1='r' --arg2=1", + "--arg1='5F3Z-2e-9-w-a-b-c-d' --arg2=4", + "--arg1='2-5g-3-J-k-L' --arg2=3", + "--arg1='a-b-c' --arg2=3", + "--arg1='12345' --arg2=1", + "--arg1='ABCD' --arg2=2", + "--arg1='a-1-B-2' --arg2=2" + ], + "hidden_test_results": [ + "'A-A-A-A'", + "''", + "'2'", + "'R'", + "'5F3Z-2E9W-ABCD'", + "'2-5G3-JKL'", + "'ABC'", + "'1-2-3-4-5'", + "'AB-CD'", + "'A1-B2'" + ], + "boilerplate": { + "python": "class Solution:\n def licenseKeyFormatting(self, s: str, k: int) -> str:\n ", + "java": "class Solution {\n public String licenseKeyFormatting(String s, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string licenseKeyFormatting(string s, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=3KMlpe8eZ0E&pp=ygUfTmVldENvZGUgTGljZW5zZSBLZXkgRm9ybWF0dGluZw%3D%3D", + "method_name": "licenseKeyFormatting" + }, + { + "title": "Construct the Rectangle", + "source": "https://leetcode.com/problems/construct-the-rectangle/", + "description": "

A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:

\n\n
    \n\t
  1. The area of the rectangular web page you designed must equal to the given target area.
  2. \n\t
  3. The width W should not be larger than the length L, which means L >= W.
  4. \n\t
  5. The difference between length L and width W should be as small as possible.
  6. \n
\n\n

Return an array [L, W] where L and W are the length and width of the web page you designed in sequence.

\n\n

 

\n

Example 1:

\n\n
\nInput: area = 4\nOutput: [2,2]\nExplanation: The target area is 4, and all the possible ways to construct it are [1,4], [2,2], [4,1]. \nBut according to requirement 2, [1,4] is illegal; according to requirement 3,  [4,1] is not optimal compared to [2,2]. So the length L is 2, and the width W is 2.\n
\n\n

Example 2:

\n\n
\nInput: area = 37\nOutput: [37,1]\n
\n\n

Example 3:

\n\n
\nInput: area = 122122\nOutput: [427,286]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= area <= 107
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=4", + "--arg1=37", + "--arg1=122122" + ], + "sample_test_results": [ + "[2,2]", + "[37,1]", + "[427,286]" + ], + "hidden_test_cases": [ + "--arg1=1", + "--arg1=9", + "--arg1=16", + "--arg1=24", + "--arg1=100", + "--arg1=1000", + "--arg1=10000", + "--arg1=99999", + "--arg1=1000000", + "--arg1=9999999" + ], + "hidden_test_results": [ + "[1,1]", + "[3,3]", + "[4,4]", + "[6,4]", + "[10,10]", + "[40,25]", + "[100,100]", + "[369,271]", + "[1000,1000]", + "[4649,2151]" + ], + "boilerplate": { + "python": "class Solution:\n def constructRectangle(self, area: int) -> List[int]:\n ", + "java": "class Solution {\n public int[] constructRectangle(int area) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector constructRectangle(int area) {\n \n }\n};" + }, + "compare_func": { + "python": "expected = eval(expected); return result[0]*result[1] == expected[0]*expected[1] and result[0] >= result[1] and abs(result[0]-result[1]) <= abs(expected[0]-expected[1])", + "java": "String[] expectedComponents = expected.split(\",\");\nint[] expectedArray = {Integer.parseInt(expectedComponents[0].trim()), Integer.parseInt(expectedComponents[1].trim())};\n\nboolean conditionsMet = (result[0] * result[1] == expectedArray[0] * expectedArray[1]) &&\n (result[0] >= result[1]) &&\n (Math.abs(result[0] - result[1]) <= Math.abs(expectedArray[0] - expectedArray[1]));\n\nreturn conditionsMet;", + "cpp": "// Assuming `result` and `expected` are both arrays of integers with size 2\nauto resultProduct = result[0] * result[1];\nauto expectedProduct = expected[0] * expected[1];\nauto resultDiff = std::abs(result[0] - result[1]);\nauto expectedDiff = std::abs(expected[0] - expected[1]);\n\nreturn resultProduct == expectedProduct && result[0] >= result[1] && resultDiff <= expectedDiff;" + }, + "explanation": "https://www.youtube.com/watch?v=-Lb4SvVyPCM&pp=ygUgTmVldENvZGUgQ29uc3RydWN0IHRoZSBSZWN0YW5nbGU%3D", + "method_name": "constructRectangle" + }, + { + "title": "Teemo Attacking", + "source": "https://leetcode.com/problems/teemo-attacking/", + "description": "

Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly duration seconds. More formally, an attack at second t will mean Ashe is poisoned during the inclusive time interval [t, t + duration - 1]. If Teemo attacks again before the poison effect ends, the timer for it is reset, and the poison effect will end duration seconds after the new attack.

\n\n

You are given a non-decreasing integer array timeSeries, where timeSeries[i] denotes that Teemo attacks Ashe at second timeSeries[i], and an integer duration.

\n\n

Return the total number of seconds that Ashe is poisoned.

\n\n

 

\n

Example 1:

\n\n
\nInput: timeSeries = [1,4], duration = 2\nOutput: 4\nExplanation: Teemo's attacks on Ashe go as follows:\n- At second 1, Teemo attacks, and Ashe is poisoned for seconds 1 and 2.\n- At second 4, Teemo attacks, and Ashe is poisoned for seconds 4 and 5.\nAshe is poisoned for seconds 1, 2, 4, and 5, which is 4 seconds in total.\n
\n\n

Example 2:

\n\n
\nInput: timeSeries = [1,2], duration = 2\nOutput: 3\nExplanation: Teemo's attacks on Ashe go as follows:\n- At second 1, Teemo attacks, and Ashe is poisoned for seconds 1 and 2.\n- At second 2 however, Teemo attacks again and resets the poison timer. Ashe is poisoned for seconds 2 and 3.\nAshe is poisoned for seconds 1, 2, and 3, which is 3 seconds in total.
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= timeSeries.length <= 104
  • \n\t
  • 0 <= timeSeries[i], duration <= 107
  • \n\t
  • timeSeries is sorted in non-decreasing order.
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=[1,4] --arg2=2", + "--arg1=[1,2] --arg2=2" + ], + "sample_test_results": [ + "4", + "3" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=1", + "--arg1=[1,2,3,4,5] --arg2=1", + "--arg1=[1,3,5,7,9] --arg2=3", + "--arg1=[1,2,3,4,5] --arg2=5", + "--arg1=[1,10,20,30] --arg2=5", + "--arg1=[1,2,3,100] --arg2=2", + "--arg1=[1,1,1,1] --arg2=2", + "--arg1=[0,1,2] --arg2=1", + "--arg1=[1,5,10] --arg2=2", + "--arg1=[1,3] --arg2=3" + ], + "hidden_test_results": [ + "1", + "5", + "11", + "9", + "20", + "6", + "2", + "3", + "6", + "5" + ], + "boilerplate": { + "python": "class Solution:\n def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:\n ", + "java": "class Solution {\n public int findPoisonedDuration(int[] timeSeries, int duration) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findPoisonedDuration(vector& timeSeries, int duration) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=NejSCTIdd5k&pp=ygUYTmVldENvZGUgVGVlbW8gQXR0YWNraW5n", + "method_name": "findPoisonedDuration" + }, + { + "title": "Base 7", + "source": "https://leetcode.com/problems/base-7/", + "description": "

Given an integer num, return a string of its base 7 representation.

\n\n

 

\n

Example 1:

\n
Input: num = 100\nOutput: \"202\"\n

Example 2:

\n
Input: num = -7\nOutput: \"-10\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • -107 <= num <= 107
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=100", + "--arg1=-7" + ], + "sample_test_results": [ + "'202'", + "'-10'" + ], + "hidden_test_cases": [ + "--arg1=0", + "--arg1=7", + "--arg1=-49", + "--arg1=1000000", + "--arg1=-1000000", + "--arg1=1", + "--arg1=-1", + "--arg1=49", + "--arg1=999999", + "--arg1=-999999" + ], + "hidden_test_results": [ + "'0'", + "'10'", + "'-100'", + "'11333311'", + "'-11333311'", + "'1'", + "'-1'", + "'100'", + "'11333310'", + "'-11333310'" + ], + "boilerplate": { + "python": "class Solution:\n def convertToBase7(self, num: int) -> str:\n ", + "java": "class Solution {\n public String convertToBase7(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string convertToBase7(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try {\n return result.equals(Class.forName(expected).getConstructor().newInstance());\n} catch (Exception e) {\n return false;\n}", + "cpp": "try {\n return result == std::stoi(expected);\n} catch(const std::invalid_argument &ia) {\n return false;\n}\nreturn false;" + }, + "explanation": "https://www.youtube.com/watch?v=sbmq-efwOsA&pp=ygUPTmVldENvZGUgQmFzZSA3", + "method_name": "convertToBase7" + }, + { + "title": "Perfect Number", + "source": "https://leetcode.com/problems/perfect-number/", + "description": "

A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. A divisor of an integer x is an integer that can divide x evenly.

\n\n

Given an integer n, return true if n is a perfect number, otherwise return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = 28\nOutput: true\nExplanation: 28 = 1 + 2 + 4 + 7 + 14\n1, 2, 4, 7, and 14 are all divisors of 28.\n
\n\n

Example 2:

\n\n
\nInput: num = 7\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num <= 108
  • \n
\n", + "difficulty": "easy", + "sample_test_cases": [ + "--arg1=28", + "--arg1=7" + ], + "sample_test_results": [ + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1=1", + "--arg1=6", + "--arg1=496", + "--arg1=8128", + "--arg1=33550336", + "--arg1=12", + "--arg1=100", + "--arg1=1000", + "--arg1=10000", + "--arg1=100000" + ], + "hidden_test_results": [ + "false", + "true", + "true", + "true", + "true", + "false", + "false", + "false", + "false", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def checkPerfectNumber(self, num: int) -> bool:\n ", + "java": "class Solution {\n public boolean checkPerfectNumber(int num) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool checkPerfectNumber(int num) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=HLZLwjzIVGo&pp=ygUXTmVldENvZGUgUGVyZmVjdCBOdW1iZXI%3D", + "method_name": "checkPerfectNumber" + }, + { + "title": "Zigzag Conversion", + "source": "https://leetcode.com/problems/zigzag-conversion/", + "description": "

The string "PAYPALISHIRING" 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)

\n\n
\nP   A   H   N\nA P L S I I G\nY   I   R\n
\n\n

And then read line by line: "PAHNAPLSIIGYIR"

\n\n

Write the code that will take a string and make this conversion given a number of rows:

\n\n
\nstring convert(string s, int numRows);\n
\n\n

 

\n

Example 1:

\n\n
\nInput: s = "PAYPALISHIRING", numRows = 3\nOutput: "PAHNAPLSIIGYIR"\n
\n\n

Example 2:

\n\n
\nInput: s = "PAYPALISHIRING", numRows = 4\nOutput: "PINALSIGYAHRPI"\nExplanation:\nP     I    N\nA   L S  I G\nY A   H R\nP     I\n
\n\n

Example 3:

\n\n
\nInput: s = "A", numRows = 1\nOutput: "A"\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 1000
  • \n\t
  • s consists of English letters (lower-case and upper-case), ',' and '.'.
  • \n\t
  • 1 <= numRows <= 1000
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1='PAYPALISHIRING' --arg2=3", + "--arg1='PAYPALISHIRING' --arg2=4", + "--arg1='A' --arg2=1" + ], + "sample_test_results": [ + "'PAHNAPLSIIGYIR'", + "'PINALSIGYAHRPI'", + "'A'" + ], + "hidden_test_cases": [ + "--arg1='ABCDEF' --arg2=2", + "--arg1='HELLO' --arg2=1", + "--arg1='WORLD' --arg2=5", + "--arg1='TEST.TEST' --arg2=3", + "--arg1='A --arg2=B --arg3=C' --arg4=2", + "--arg1='abcdefghijklmnop' --arg2=4", + "--arg1='ANTHROPIC' --arg2=3", + "--arg1='Testing123' --arg2=2", + "--arg1='' --arg2=1", + "--arg1='AB' --arg2=1" + ], + "hidden_test_results": [ + "'ACEBDF'", + "'HELLO'", + "'WORLD'", + "'T.TETTSSE'", + "'ABC,,'", + "'agmbfhlnceikodjp'", + "'ARCNHOITP'", + "'Tsig2etn13'", + "''", + "'AB'" + ], + "boilerplate": { + "python": "class Solution:\n def convert(self, s: str, numRows: int) -> str:\n ", + "java": "class Solution {\n public String convert(String s, int numRows) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string convert(string s, int numRows) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try {\n ScriptEngineManager manager = new ScriptEngineManager();\n ScriptEngine engine = manager.getEngineByName(\"JavaScript\");\n Object expectedValue = engine.eval(expected);\n return result.equals(expectedValue);\n} catch (ScriptException e) {\n e.printStackTrace();\n return false;\n}", + "cpp": "try {\n return result == std::stod(expected);\n} catch (const std::invalid_argument&) {\n // Handle the case where the expected string is not a valid double\n return false;\n} catch (const std::out_of_range&) {\n // Handle the case where the number is out of double's range\n return false;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=Q2Tw6gcVEwc&pp=ygUaTmVldENvZGUgWmlnemFnIENvbnZlcnNpb24%3D", + "method_name": "convert" + }, + { + "title": "Container With Most Water", + "source": "https://leetcode.com/problems/container-with-most-water/", + "description": "

You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).

\n\n

Find two lines that together with the x-axis form a container, such that the container contains the most water.

\n\n

Return the maximum amount of water a container can store.

\n\n

Notice that you may not slant the container.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: height = [1,8,6,2,5,4,8,3,7]\nOutput: 49\nExplanation: The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49.\n
\n\n

Example 2:

\n\n
\nInput: height = [1,1]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == height.length
  • \n\t
  • 2 <= n <= 105
  • \n\t
  • 0 <= height[i] <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[1,8,6,2,5,4,8,3,7]", + "--arg1=[1,1]" + ], + "sample_test_results": [ + "49", + "1" + ], + "hidden_test_cases": [ + "--arg1=[4,3,2,1,4]", + "--arg1=[1,2,4,3]", + "--arg1=[1,2]", + "--arg1=[1,1,1]", + "--arg1=[2,3,4,5,18,17,6]", + "--arg1=[1,8,100,2,100,4,8,3,7]", + "--arg1=[1,2,3,4,5,6]", + "--arg1=[6,5,4,3,2,1]", + "--arg1=[0,0]", + "--arg1=[10000,1]" + ], + "hidden_test_results": [ + "16", + "4", + "1", + "2", + "17", + "200", + "9", + "9", + "0", + "1" + ], + "boilerplate": { + "python": "class Solution:\n def maxArea(self, height: List[int]) -> int:\n ", + "java": "class Solution {\n public int maxArea(int[] height) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxArea(vector& height) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return Integer.parseInt(result) == expected;", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=UuiTKBwPgAo&pp=ygUiTmVldENvZGUgQ29udGFpbmVyIFdpdGggTW9zdCBXYXRlcg%3D%3D", + "method_name": "maxArea" + }, + { + "title": "3Sum Closest", + "source": "https://leetcode.com/problems/3sum-closest/", + "description": "

Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target.

\n\n

Return the sum of the three integers.

\n\n

You may assume that each input would have exactly one solution.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [-1,2,1,-4], target = 1\nOutput: 2\nExplanation: The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,0,0], target = 1\nOutput: 0\nExplanation: The sum that is closest to the target is 0. (0 + 0 + 0 = 0).\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 3 <= nums.length <= 500
  • \n\t
  • -1000 <= nums[i] <= 1000
  • \n\t
  • -104 <= target <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[-1,2,1,-4] --arg2=1", + "--arg1=[0,0,0] --arg2=1" + ], + "sample_test_results": [ + "2", + "0" + ], + "hidden_test_cases": [ + "--arg1=[1,1,1,0] --arg2=100", + "--arg1=[-1,0,1,2,3] --arg2=1", + "--arg1=[0,0,0,0] --arg2=1", + "--arg1=[-5,-4,-3,-2,-1] --arg2=0", + "--arg1=[1,2,3,4,5] --arg2=10", + "--arg1=[-1,-2,-3,1,2,3] --arg2=0", + "--arg1=[1,1,-1,-1,3] --arg2=-1", + "--arg1=[-100,-50,0,50,100] --arg2=23", + "--arg1=[-1,2,1,-4,3,-3] --arg2=0", + "--arg1=[-1000,1000,1000] --arg2=100" + ], + "hidden_test_results": [ + "3", + "1", + "0", + "-6", + "10", + "0", + "-1", + "0", + "0", + "1000" + ], + "boilerplate": { + "python": "class Solution:\n def threeSumClosest(self, nums: List[int], target: int) -> int:\n ", + "java": "class Solution {\n public int threeSumClosest(int[] nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int threeSumClosest(vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=PXWT4wzkA6M&pp=ygUVTmVldENvZGUgM1N1bSBDbG9zZXN0", + "method_name": "threeSumClosest" + }, + { + "title": "Search in Rotated Sorted Array", + "source": "https://leetcode.com/problems/search-in-rotated-sorted-array/", + "description": "

There is an integer array nums sorted in ascending order (with distinct values).

\n\n

Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2].

\n\n

Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n
Input: nums = [4,5,6,7,0,1,2], target = 0\nOutput: 4\n

Example 2:

\n
Input: nums = [4,5,6,7,0,1,2], target = 3\nOutput: -1\n

Example 3:

\n
Input: nums = [1], target = 0\nOutput: -1\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 5000
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • All values of nums are unique.
  • \n\t
  • nums is an ascending array that is possibly rotated.
  • \n\t
  • -104 <= target <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[4,5,6,7,0,1,2] --arg2=0", + "--arg1=[4,5,6,7,0,1,2] --arg2=3", + "--arg1=[1] --arg2=0" + ], + "sample_test_results": [ + "4", + "-1", + "-1" + ], + "hidden_test_cases": [ + "--arg1=[3,1] --arg2=1", + "--arg1=[1,3,5] --arg2=3", + "--arg1=[5,1,2,3,4] --arg2=1", + "--arg1=[4,5,6,7,0,1,2] --arg2=5", + "--arg1=[1] --arg2=1", + "--arg1=[1,3] --arg2=3", + "--arg1=[3,5,1] --arg2=3", + "--arg1=[5,1,3] --arg2=5", + "--arg1=[4,5,6,7,8,1,2,3] --arg2=8", + "--arg1=[1,2,3,4,5] --arg2=6" + ], + "hidden_test_results": [ + "1", + "1", + "1", + "1", + "0", + "1", + "0", + "0", + "4", + "-1" + ], + "boilerplate": { + "python": "class Solution:\n def search(self, nums: List[int], target: int) -> int:\n ", + "java": "class Solution {\n public int search(int[] nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int search(vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return result == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=U8XENwh8Oy8&pp=ygUnTmVldENvZGUgU2VhcmNoIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5", + "method_name": "search" + }, + { + "title": "Find First and Last Position of Element in Sorted Array", + "source": "https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/", + "description": "

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.

\n\n

If target is not found in the array, return [-1, -1].

\n\n

You must write an algorithm with O(log n) runtime complexity.

\n\n

 

\n

Example 1:

\n
Input: nums = [5,7,7,8,8,10], target = 8\nOutput: [3,4]\n

Example 2:

\n
Input: nums = [5,7,7,8,8,10], target = 6\nOutput: [-1,-1]\n

Example 3:

\n
Input: nums = [], target = 0\nOutput: [-1,-1]\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n\t
  • nums is a non-decreasing array.
  • \n\t
  • -109 <= target <= 109
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[5,7,7,8,8,10] --arg2=8", + "--arg1=[5,7,7,8,8,10] --arg2=6", + "--arg1=[] --arg2=0" + ], + "sample_test_results": [ + "(3, 4)", + "(-1, -1)", + "(-1, -1)" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=1", + "--arg1=[1,1,1,1] --arg2=1", + "--arg1=[1,2,3,4,5] --arg2=3", + "--arg1=[1,2,2,3,4,4,4] --arg2=4", + "--arg1=[1,1,2] --arg2=2", + "--arg1=[1] --arg2=2", + "--arg1=[1,2,3] --arg2=4", + "--arg1=[1,1,1,2,2,3] --arg2=2", + "--arg1=[1,2,3,3,3,4,5] --arg2=3", + "--arg1=[1,2,3,4,5,5,5,5,6] --arg2=5" + ], + "hidden_test_results": [ + "(0, 0)", + "(0, 3)", + "(2, 2)", + "(4, 6)", + "(2, 2)", + "(-1, -1)", + "(-1, -1)", + "(3, 4)", + "(2, 4)", + "(4, 7)" + ], + "boilerplate": { + "python": "class Solution:\n def searchRange(self, nums: List[int], target: int) -> List[int]:\n ", + "java": "class Solution {\n public int[] searchRange(int[] nums, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector searchRange(vector& nums, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try {\n return Objects.equals(result, eval(expected));\n} catch (Exception e) {\n return false;\n}", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=4sQL7R5ySUU&pp=ygVATmVldENvZGUgRmluZCBGaXJzdCBhbmQgTGFzdCBQb3NpdGlvbiBvZiBFbGVtZW50IGluIFNvcnRlZCBBcnJheQ%3D%3D", + "method_name": "searchRange" + }, + { + "title": "Count and Say", + "source": "https://leetcode.com/problems/count-and-say/", + "description": "

The count-and-say sequence is a sequence of digit strings defined by the recursive formula:

\n\n
    \n\t
  • countAndSay(1) = "1"
  • \n\t
  • countAndSay(n) is the run-length encoding of countAndSay(n - 1).
  • \n
\n\n

Run-length encoding (RLE) is a string compression method that works by replacing consecutive identical characters (repeated 2 or more times) with the concatenation of the character and the number marking the count of the characters (length of the run). For example, to compress the string "3322251" we replace "33" with "23", replace "222" with "32", replace "5" with "15" and replace "1" with "11". Thus the compressed string becomes "23321511".

\n\n

Given a positive integer n, return the nth element of the count-and-say sequence.

\n\n

 

\n

Example 1:

\n\n
\n

Input: n = 4

\n\n

Output: "1211"

\n\n

Explanation:

\n\n
\ncountAndSay(1) = "1"\ncountAndSay(2) = RLE of "1" = "11"\ncountAndSay(3) = RLE of "11" = "21"\ncountAndSay(4) = RLE of "21" = "1211"\n
\n
\n\n

Example 2:

\n\n
\n

Input: n = 1

\n\n

Output: "1"

\n\n

Explanation:

\n\n

This is the base case.

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 30
  • \n
\n\n

 

\nFollow up: Could you solve it iteratively?", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=4", + "--arg1=1", + "--arg1=5" + ], + "sample_test_results": [ + "'1211'", + "'1'", + "'111221'" + ], + "hidden_test_cases": [ + "--arg1=2", + "--arg1=3", + "--arg1=6", + "--arg1=7", + "--arg1=8", + "--arg1=9", + "--arg1=10", + "--arg1=15", + "--arg1=20", + "--arg1=30" + ], + "hidden_test_results": [ + "'11'", + "'21'", + "'312211'", + "'13112221'", + "'1113213211'", + "'31131211131221'", + "'13211311123113112211'", + "'311311222113111231131112132112311321322112111312211312111322212311322113212221'", + "'11131221131211132221232112111312111213111213211231132132211211131221131211221321123113213221123113112221131112311332211211131221131211132211121312211231131112311211232221121321132132211331121321231231121113112221121321133112132112312321123113112221121113122113121113123112112322111213211322211312113211'", + "'3113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112212211131221121321131211132221123113112221131112311332211211133112111311222112111312211311123113322112111312211312111322212321121113121112133221121321132132211331121321132213211231132132211211131221232112111312212221121123222112311311222113111231133211121321321122111312211312111322211213211321322123211211131211121332211231131122211311123113321112131221123113111231121123222112111331121113112221121113122113111231133221121113122113121113221112131221123113111231121123222112111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321132132211322132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211322113321132211221121332211231131122211311123113321112131221123113111231121113311211131221121321131211132221123113112211121312211231131122211211133112111311222112111312211312111322211213211321223112111311222112132113213221133122211311221122111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321132132211322132113213221123113112221133112132123222112111312211312112213211231132132211211131221131211322113321132211221121332211213211321322113311213212312311211131122211213211331121321123123211231131122211211131221131112311332211213211321223112111311222112132113213221123123211231132132211231131122211311123113322112111312211312111322111213122112311311123112112322211213211321322113312211223113112221121113122113111231133221121321132132211331222113321112131122211332113221122112133221123113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112311332111213122112311311123112112322211322311311222113111231133211121312211231131112311211232221121113122113121113222123211211131221132211131221121321131211132221123113112211121312211231131122113221122112133221121321132132211331121321231231121113121113122122311311222113111231133221121113122113121113221112131221123113111231121123222112132113213221133112132123123112111312211322311211133112111312211213211311123113223112111321322123122113222122211211232221121113122113121113222123211211131211121311121321123113213221121113122123211211131221121311121312211213211321322112311311222113311213212322211211131221131211221321123113213221121113122113121113222112131112131221121321131211132221121321132132211331121321232221123113112221131112311322311211131122211213211331121321122112133221121113122113121113222123112221221321132132211231131122211331121321232221121113122113121113222123211211131211121332211213111213122112132113121113222112132113213221232112111312111213322112132113213221133112132123123112111311222112132113311213211221121332211231131122211311123113321112131221123113112221132231131122211211131221131112311332211213211321223112111311222112132113212221132221222112112322211211131221131211132221232112111312111213111213211231131112311311221122132113213221133112132123222112311311222113111231132231121113112221121321133112132112211213322112111312211312111322212321121113121112131112132112311321322112111312212321121113122122211211232221121311121312211213211312111322211213211321322123211211131211121332211213211321322113311213211322132112311321322112111312212321121113122122211211232221121321132132211331121321231231121113112221121321133112132112312321123113112221121113122113111231133221121321132122311211131122211213211321222113222122211211232221123113112221131112311332111213122112311311123112111331121113122112132113121113222112311311221112131221123113112221121113311211131122211211131221131211132221121321132132212321121113121112133221123113112221131112311332111213213211221113122113121113222112132113213221232112111312111213322112132113213221133112132123123112111312211322311211133112111312212221121123222112132113213221133112132123222113223113112221131112311332111213122112311311123112112322211211131221131211132221232112111312111213111213211231132132211211131221131211221321123113213221123113112221131112211322212322211231131122211322111312211312111322211213211321322113311213211331121113122122211211132213211231131122212322211331222113112211'" + ], + "boilerplate": { + "python": "class Solution:\n def countAndSay(self, n: int) -> str:\n ", + "java": "class Solution {\n public String countAndSay(int n) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string countAndSay(int n) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return Objects.equals(result, expected);", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=iP4RH2zespg&pp=ygUWTmVldENvZGUgQ291bnQgYW5kIFNheQ%3D%3D", + "method_name": "countAndSay" + }, + { + "title": "Combination Sum II", + "source": "https://leetcode.com/problems/combination-sum-ii/", + "description": "

Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target.

\n\n

Each number in candidates may only be used once in the combination.

\n\n

Note: The solution set must not contain duplicate combinations.

\n\n

 

\n

Example 1:

\n\n
\nInput: candidates = [10,1,2,7,6,1,5], target = 8\nOutput: \n[\n[1,1,6],\n[1,2,5],\n[1,7],\n[2,6]\n]\n
\n\n

Example 2:

\n\n
\nInput: candidates = [2,5,2,1,2], target = 5\nOutput: \n[\n[1,2,2],\n[5]\n]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= candidates.length <= 100
  • \n\t
  • 1 <= candidates[i] <= 50
  • \n\t
  • 1 <= target <= 30
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[10,1,2,7,6,1,5] --arg2=8", + "--arg1=[2,5,2,1,2] --arg2=5", + "--arg1=[1,1,1,1,1,1,1] --arg2=3" + ], + "sample_test_results": [ + "[[1,1,6],[1,2,5],[1,7],[2,6]]", + "[[1,2,2],[5]]", + "[[1,1,1]]" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=1", + "--arg1=[1,2,3] --arg2=6", + "--arg1=[1,1,1,2,2] --arg2=3", + "--arg1=[10,20,30,40,50] --arg2=60", + "--arg1=[2,2,2,2,2] --arg2=4", + "--arg1=[1,2,3,4,5] --arg2=10", + "--arg1=[1,1,1,1,1,1,1,1,1,1] --arg2=5", + "--arg1=[5,4,3,2,1] --arg2=8", + "--arg1=[10,1,2,7,6,1,5] --arg2=9", + "--arg1=[1,2,2,2,2,2,3] --arg2=7" + ], + "hidden_test_results": [ + "[[1]]", + "[[1,2,3]]", + "[[1,1,1],[1,2]]", + "[[10,20,30],[10,50],[20,40]]", + "[[2,2]]", + "[[1,2,3,4],[1,4,5],[2,3,5]]", + "[[1,1,1,1,1]]", + "[[1,2,5],[1,3,4],[3,5]]", + "[[1,1,2,5],[1,1,7],[1,2,6],[2,7]]", + "[[1,2,2,2],[2,2,3]]" + ], + "boilerplate": { + "python": "class Solution:\n def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:\n ", + "java": "class Solution {\n public List> combinationSum2(int[] candidates, int \ntarget) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector> combinationSum2(vector& candidates, int \ntarget) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted([sorted(x) for x in result]) == eval(expected)", + "java": "Arrays.deepEquals(\n result.stream().map(arr -> Arrays.stream(arr).sorted().toArray(Integer[]::new)).sorted((a1, a2) -> Arrays.compare(a1, a2)).toArray(Integer[][]::new), \n Arrays.stream(expected).map(arr -> Arrays.stream(arr).sorted().toArray(Integer[]::new)).sorted((a1, a2) -> Arrays.compare(a1, a2)).toArray(Integer[][]::new)\n)", + "cpp": "std::vector> sortedResult;\nfor (const auto& vec : result) {\n std::vector sortedVec = vec;\n std::sort(sortedVec.begin(), sortedVec.end());\n sortedResult.push_back(sortedVec);\n}\nstd::sort(sortedResult.begin(), sortedResult.end());\nreturn sortedResult == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=FOyRpNUSFeA&pp=ygUbTmVldENvZGUgQ29tYmluYXRpb24gU3VtIElJ", + "method_name": "combinationSum2" + }, + { + "title": "Multiply Strings", + "source": "https://leetcode.com/problems/multiply-strings/", + "description": "

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

\n\n

Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.

\n\n

 

\n

Example 1:

\n
Input: num1 = \"2\", num2 = \"3\"\nOutput: \"6\"\n

Example 2:

\n
Input: num1 = \"123\", num2 = \"456\"\nOutput: \"56088\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num1.length, num2.length <= 200
  • \n\t
  • num1 and num2 consist of digits only.
  • \n\t
  • Both num1 and num2 do not contain any leading zero, except the number 0 itself.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=\"2\" --arg2=\"3\"", + "--arg1=\"123\" --arg2=\"456\"", + "--arg1=\"9999\" --arg2=\"9999\"" + ], + "sample_test_results": [ + "'6'", + "'56088'", + "'99980001'" + ], + "hidden_test_cases": [ + "--arg1=\"0\" --arg2=\"0\"", + "--arg1=\"1\" --arg2=\"1\"", + "--arg1=\"999\" --arg2=\"999\"", + "--arg1=\"1234\" --arg2=\"5678\"", + "--arg1=\"99999\" --arg2=\"99999\"", + "--arg1=\"123456789\" --arg2=\"987654321\"", + "--arg1=\"1000000\" --arg2=\"1000000\"", + "--arg1=\"11111111\" --arg2=\"11111111\"", + "--arg1=\"12345678901234567890\" --arg2=\"12345678901234567890\"", + "--arg1=\"0\" --arg2=\"1234567890\"" + ], + "hidden_test_results": [ + "'0'", + "'1'", + "'998001'", + "'7006652'", + "'9999800001'", + "'121932631112635269'", + "'1000000000000'", + "'123456787654321'", + "'152415787532388367501905199875019052100'", + "'0'" + ], + "boilerplate": { + "python": "class Solution:\n def multiply(self, num1: str, num2: str) -> str:\n ", + "java": "class Solution {\n public String multiply(String num1, String num2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string multiply(string num1, string num2) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "{\n return result == std::stoi(expected);\n}" + }, + "explanation": "https://www.youtube.com/watch?v=1vZswirL8Y8&pp=ygUZTmVldENvZGUgTXVsdGlwbHkgU3RyaW5ncw%3D%3D", + "method_name": "multiply" + }, + { + "title": "Jump Game II", + "source": "https://leetcode.com/problems/jump-game-ii/", + "description": "

You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0].

\n\n

Each element nums[i] represents the maximum length of a forward jump from index i. In other words, if you are at nums[i], you can jump to any nums[i + j] where:

\n\n
    \n\t
  • 0 <= j <= nums[i] and
  • \n\t
  • i + j < n
  • \n
\n\n

Return the minimum number of jumps to reach nums[n - 1]. The test cases are generated such that you can reach nums[n - 1].

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [2,3,1,1,4]\nOutput: 2\nExplanation: The minimum number of jumps to reach the last index is 2. Jump 1 step from index 0 to 1, then 3 steps to the last index.\n
\n\n

Example 2:

\n\n
\nInput: nums = [2,3,0,1,4]\nOutput: 2\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 104
  • \n\t
  • 0 <= nums[i] <= 1000
  • \n\t
  • It's guaranteed that you can reach nums[n - 1].
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[2,3,1,1,4]", + "--arg1=[2,3,0,1,4]", + "--arg1=[1,2,3,4,5]" + ], + "sample_test_results": [ + "2", + "2", + "3" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[2,1]", + "--arg1=[1,1,1,1]", + "--arg1=[3,2,1]", + "--arg1=[1,2,1,1,1]", + "--arg1=[5,9,3,2,1,0,2,3,3,1,0,0]", + "--arg1=[1,2,3,4,5]", + "--arg1=[4,1,1,3,1,1,1]", + "--arg1=[1,1,1,1,1,1,1,1,1,1]", + "--arg1=[10,9,8,7,6,5,4,3,2,1]" + ], + "hidden_test_results": [ + "0", + "1", + "3", + "1", + "3", + "3", + "3", + "2", + "9", + "1" + ], + "boilerplate": { + "python": "class Solution:\n def jump(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int jump(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int jump(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=dJ7sWiOoK7g&pp=ygUVTmVldENvZGUgSnVtcCBHYW1lIElJ", + "method_name": "jump" + }, + { + "title": "Maximum Subarray", + "source": "https://leetcode.com/problems/maximum-subarray/", + "description": "

Given an integer array nums, find the subarray with the largest sum, and return its sum.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [-2,1,-3,4,-1,2,1,-5,4]\nOutput: 6\nExplanation: The subarray [4,-1,2,1] has the largest sum 6.\n
\n\n

Example 2:

\n\n
\nInput: nums = [1]\nOutput: 1\nExplanation: The subarray [1] has the largest sum 1.\n
\n\n

Example 3:

\n\n
\nInput: nums = [5,4,-1,7,8]\nOutput: 23\nExplanation: The subarray [5,4,-1,7,8] has the largest sum 23.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -104 <= nums[i] <= 104
  • \n
\n\n

 

\n

Follow up: If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle.

\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[-2,1,-3,4,-1,2,1,-5,4]", + "--arg1=[1]", + "--arg1=[5,4,-1,7,8]" + ], + "sample_test_results": [ + "6", + "1", + "23" + ], + "hidden_test_cases": [ + "--arg1=[-1]", + "--arg1=[-2,-1]", + "--arg1=[1,2,3,4,5]", + "--arg1=[-1,-2,-3,-4,-5]", + "--arg1=[1,-1,1,-1,1,-1]", + "--arg1=[-2,1,-3,4,-1,2,1,-5,4]", + "--arg1=[0,0,0,0]", + "--arg1=[-1,0,-2,2]", + "--arg1=[1,-2,3,-4,5,-6,7,-8]", + "--arg1=[-1,-1,2,-1,-1]" + ], + "hidden_test_results": [ + "-1", + "-1", + "15", + "-1", + "1", + "6", + "0", + "2", + "7", + "2" + ], + "boilerplate": { + "python": "class Solution:\n def maxSubArray(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int maxSubArray(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxSubArray(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=5WZl3MMT0Eg&pp=ygUZTmVldENvZGUgTWF4aW11bSBTdWJhcnJheQ%3D%3D", + "method_name": "maxSubArray" + }, + { + "title": "Spiral Matrix", + "source": "https://leetcode.com/problems/spiral-matrix/", + "description": "

Given an m x n matrix, return all elements of the matrix in spiral order.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [[1,2,3],[4,5,6],[7,8,9]]\nOutput: [1,2,3,6,9,8,7,4,5]\n
\n\n

Example 2:

\n\"\"\n
\nInput: matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]\nOutput: [1,2,3,4,8,12,11,10,9,5,6,7]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == matrix.length
  • \n\t
  • n == matrix[i].length
  • \n\t
  • 1 <= m, n <= 10
  • \n\t
  • -100 <= matrix[i][j] <= 100
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[1,2,3],[4,5,6],[7,8,9]]", + "--arg1=[[1,2,3,4],[5,6,7,8],[9,10,11,12]]" + ], + "sample_test_results": [ + "[1,2,3,6,9,8,7,4,5]", + "[1,2,3,4,8,12,11,10,9,5,6,7]" + ], + "hidden_test_cases": [ + "--arg1=[[1]]", + "--arg1=[[1,2],[3,4]]", + "--arg1=[[1,2,3]]", + "--arg1=[[1],[2],[3]]", + "--arg1=[[1,2,3,4],[5,6,7,8]]", + "--arg1=[[1,2],[3,4],[5,6]]", + "--arg1=[[]]", + "--arg1=[]", + "--arg1=[[1,2,3],[4,5,6]]", + "--arg1=[[1,2],[3,4],[5,6],[7,8]]" + ], + "hidden_test_results": [ + "[1]", + "[1,2,4,3]", + "[1,2,3]", + "[1,2,3]", + "[1,2,3,4,8,7,6,5]", + "[1,2,4,6,5,3]", + "[]", + "[]", + "[1,2,3,6,5,4]", + "[1,2,4,6,8,7,5,3]" + ], + "boilerplate": { + "python": "class Solution:\n def spiralOrder(self, matrix: List[List[int]]) -> List[int]:\n ", + "java": "class Solution {\n public List spiralOrder(int[][] matrix) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector spiralOrder(vector>& matrix) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=BJnMZNwUk1M&pp=ygUWTmVldENvZGUgU3BpcmFsIE1hdHJpeA%3D%3D", + "method_name": "spiralOrder" + }, + { + "title": "Merge Intervals", + "source": "https://leetcode.com/problems/merge-intervals/", + "description": "

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.

\n\n

 

\n

Example 1:

\n\n
\nInput: intervals = [[1,3],[2,6],[8,10],[15,18]]\nOutput: [[1,6],[8,10],[15,18]]\nExplanation: Since intervals [1,3] and [2,6] overlap, merge them into [1,6].\n
\n\n

Example 2:

\n\n
\nInput: intervals = [[1,4],[4,5]]\nOutput: [[1,5]]\nExplanation: Intervals [1,4] and [4,5] are considered overlapping.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= intervals.length <= 104
  • \n\t
  • intervals[i].length == 2
  • \n\t
  • 0 <= starti <= endi <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[1,3],[2,6],[8,10],[15,18]]", + "--arg1=[[1,4],[4,5]]" + ], + "sample_test_results": [ + "[[1,6],[8,10],[15,18]]", + "[[1,5]]" + ], + "hidden_test_cases": [ + "--arg1=[[1,4],[0,4]]", + "--arg1=[[1,4],[2,3]]", + "--arg1=[[1,4],[0,0]]", + "--arg1=[[1,4]]", + "--arg1=[[1,4],[5,6]]", + "--arg1=[[1,10],[2,3],[4,5],[6,7],[8,9]]", + "--arg1=[[1,2],[2,3],[3,4],[4,5]]", + "--arg1=[[1,5],[2,3]]", + "--arg1=[[1,4],[1,5]]", + "--arg1=[[1,4],[4,6],[5,7],[6,8]]" + ], + "hidden_test_results": [ + "[[0,4]]", + "[[1,4]]", + "[[0,0],[1,4]]", + "[[1,4]]", + "[[1,4],[5,6]]", + "[[1,10]]", + "[[1,5]]", + "[[1,5]]", + "[[1,5]]", + "[[1,8]]" + ], + "boilerplate": { + "python": "class Solution:\n def merge(self, intervals: List[List[int]]) -> List[List[int]]:\n ", + "java": "class Solution {\n public int[][] merge(int[][] intervals) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector> merge(vector>& intervals) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(sorted(result)) == str(eval(expected))", + "java": "return Arrays.toString(Arrays.stream(result).sorted().toArray()).equals(Arrays.toString(eval(expected)))", + "cpp": "std::string resultStr = std::accumulate(result.begin(), result.end(), std::string(), [](std::string a, int b) { return a + std::to_string(b) + \", \"; });\nresultStr.pop_back(); // Remove last comma\nresultStr.pop_back(); // Remove last space\nstd::string expectedStr = std::accumulate(expected.begin(), expected.end(), std::string(), [](std::string a, int b) { return a + std::to_string(b) + \", \"; });\nexpectedStr.pop_back(); // Remove last comma\nexpectedStr.pop_back(); // Remove last space\n\nstd::sort(result.begin(), result.end());\n\nreturn resultStr == expectedStr;" + }, + "explanation": "https://www.youtube.com/watch?v=44H3cEC2fFM&pp=ygUYTmVldENvZGUgTWVyZ2UgSW50ZXJ2YWxz", + "method_name": "merge" + }, + { + "title": "Insert Interval", + "source": "https://leetcode.com/problems/insert-interval/", + "description": "

You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and intervals is sorted in ascending order by starti. You are also given an interval newInterval = [start, end] that represents the start and end of another interval.

\n\n

Insert newInterval into intervals such that intervals is still sorted in ascending order by starti and intervals still does not have any overlapping intervals (merge overlapping intervals if necessary).

\n\n

Return intervals after the insertion.

\n\n

Note that you don't need to modify intervals in-place. You can make a new array and return it.

\n\n

 

\n

Example 1:

\n\n
\nInput: intervals = [[1,3],[6,9]], newInterval = [2,5]\nOutput: [[1,5],[6,9]]\n
\n\n

Example 2:

\n\n
\nInput: intervals = [[1,2],[3,5],[6,7],[8,10],[12,16]], newInterval = [4,8]\nOutput: [[1,2],[3,10],[12,16]]\nExplanation: Because the new interval [4,8] overlaps with [3,5],[6,7],[8,10].\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= intervals.length <= 104
  • \n\t
  • intervals[i].length == 2
  • \n\t
  • 0 <= starti <= endi <= 105
  • \n\t
  • intervals is sorted by starti in ascending order.
  • \n\t
  • newInterval.length == 2
  • \n\t
  • 0 <= start <= end <= 105
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[1,3],[6,9]] --arg2=[2,5]", + "--arg1=[[1,2],[3,5],[6,7],[8,10],[12,16]] --arg2=[4,8]" + ], + "sample_test_results": [ + "[[1,5],[6,9]]", + "[[1,2],[3,10],[12,16]]" + ], + "hidden_test_cases": [ + "--arg1=[] --arg2=[5,7]", + "--arg1=[[1,5]] --arg2=[2,3]", + "--arg1=[[1,5]] --arg2=[2,7]", + "--arg1=[[1,5]] --arg2=[6,8]", + "--arg1=[[1,5]] --arg2=[0,3]", + "--arg1=[[3,5],[12,15]] --arg2=[6,6]", + "--arg1=[[1,2],[3,5],[6,7],[8,10],[12,16]] --arg2=[4,8]", + "--arg1=[[1,5]] --arg2=[0,0]", + "--arg1=[[3,5],[12,15]] --arg2=[1,2]", + "--arg1=[[1,5],[6,7]] --arg2=[0,8]" + ], + "hidden_test_results": [ + "[[5,7]]", + "[[1,5]]", + "[[1,7]]", + "[[1,5],[6,8]]", + "[[0,5]]", + "[[3,5],[6,6],[12,15]]", + "[[1,2],[3,10],[12,16]]", + "[[0,0],[1,5]]", + "[[1,2],[3,5],[12,15]]", + "[[0,8]]" + ], + "boilerplate": { + "python": "class Solution:\n def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:\n ", + "java": "class Solution {\n public int[][] insert(int[][] intervals, int[] newInterval) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector> insert(vector>& intervals, vector& \nnewInterval) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(sorted(result)) == str(eval(expected))", + "java": "return result.stream().sorted().toString().equals(String.valueOf(new ScriptEngineManager().getEngineByName(\"JavaScript\").eval(expected)))", + "cpp": "std::string sortedResult = result;\nstd::sort(sortedResult.begin(), sortedResult.end());\nstd::string evaluatedExpected = std::to_string(eval(expected));\nreturn sortedResult == evaluatedExpected;" + }, + "explanation": "https://www.youtube.com/watch?v=A8NUOmlwOlM&pp=ygUYTmVldENvZGUgSW5zZXJ0IEludGVydmFs", + "method_name": "insert" + }, + { + "title": "Unique Paths II", + "source": "https://leetcode.com/problems/unique-paths-ii/", + "description": "

You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time.

\n\n

An obstacle and space are marked as 1 or 0 respectively in grid. A path that the robot takes cannot include any square that is an obstacle.

\n\n

Return the number of possible unique paths that the robot can take to reach the bottom-right corner.

\n\n

The testcases are generated so that the answer will be less than or equal to 2 * 109.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: obstacleGrid = [[0,0,0],[0,1,0],[0,0,0]]\nOutput: 2\nExplanation: There is one obstacle in the middle of the 3x3 grid above.\nThere are two ways to reach the bottom-right corner:\n1. Right -> Right -> Down -> Down\n2. Down -> Down -> Right -> Right\n
\n\n

Example 2:

\n\"\"\n
\nInput: obstacleGrid = [[0,1],[0,0]]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == obstacleGrid.length
  • \n\t
  • n == obstacleGrid[i].length
  • \n\t
  • 1 <= m, n <= 100
  • \n\t
  • obstacleGrid[i][j] is 0 or 1.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[0,0,0],[0,1,0],[0,0,0]]", + "--arg1=[[0,1],[0,0]]" + ], + "sample_test_results": [ + "2", + "1" + ], + "hidden_test_cases": [ + "--arg1=[[0]]", + "--arg1=[[1]]", + "--arg1=[[0,0],[0,1]]", + "--arg1=[[0,0],[1,0]]", + "--arg1=[[0,0,0]]", + "--arg1=[[0],[0],[0]]", + "--arg1=[[1,0]]", + "--arg1=[[0,1],[1,0]]", + "--arg1=[[0,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,0]]", + "--arg1=[[0,0,0],[0,0,0],[0,0,1]]" + ], + "hidden_test_results": [ + "1", + "0", + "0", + "1", + "1", + "1", + "0", + "0", + "4", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:\n ", + "java": "class Solution {\n public int uniquePathsWithObstacles(int[][] obstacleGrid) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int uniquePathsWithObstacles(vector>& obstacleGrid) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=d3UOz7zdE4I&pp=ygUYTmVldENvZGUgVW5pcXVlIFBhdGhzIElJ", + "method_name": "uniquePathsWithObstacles" + }, + { + "title": "Simplify Path", + "source": "https://leetcode.com/problems/simplify-path/", + "description": "

You are given an absolute path for a Unix-style file system, which always begins with a slash '/'. Your task is to transform this absolute path into its simplified canonical path.

\n\n

The rules of a Unix-style file system are as follows:

\n\n
    \n\t
  • A single period '.' represents the current directory.
  • \n\t
  • A double period '..' represents the previous/parent directory.
  • \n\t
  • Multiple consecutive slashes such as '//' and '///' are treated as a single slash '/'.
  • \n\t
  • Any sequence of periods that does not match the rules above should be treated as a valid directory or file name. For example, '...' and '....' are valid directory or file names.
  • \n
\n\n

The simplified canonical path should follow these rules:

\n\n
    \n\t
  • The path must start with a single slash '/'.
  • \n\t
  • Directories within the path must be separated by exactly one slash '/'.
  • \n\t
  • The path must not end with a slash '/', unless it is the root directory.
  • \n\t
  • The path must not have any single or double periods ('.' and '..') used to denote current or parent directories.
  • \n
\n\n

Return the simplified canonical path.

\n\n

 

\n

Example 1:

\n\n
\n

Input: path = "/home/"

\n\n

Output: "/home"

\n\n

Explanation:

\n\n

The trailing slash should be removed.

\n
\n\n

Example 2:

\n\n
\n

Input: path = "/home//foo/"

\n\n

Output: "/home/foo"

\n\n

Explanation:

\n\n

Multiple consecutive slashes are replaced by a single one.

\n
\n\n

Example 3:

\n\n
\n

Input: path = "/home/user/Documents/../Pictures"

\n\n

Output: "/home/user/Pictures"

\n\n

Explanation:

\n\n

A double period ".." refers to the directory up a level (the parent directory).

\n
\n\n

Example 4:

\n\n
\n

Input: path = "/../"

\n\n

Output: "/"

\n\n

Explanation:

\n\n

Going one level up from the root directory is not possible.

\n
\n\n

Example 5:

\n\n
\n

Input: path = "/.../a/../b/c/../d/./"

\n\n

Output: "/.../b/d"

\n\n

Explanation:

\n\n

"..." is a valid name for a directory in this problem.

\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= path.length <= 3000
  • \n\t
  • path consists of English letters, digits, period '.', slash '/' or '_'.
  • \n\t
  • path is a valid absolute Unix path.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=\"/home/\"", + "--arg1=\"/home//foo/\"", + "--arg1=\"/home/user/Documents/../Pictures\"", + "--arg1=\"/../\"", + "--arg1=\"/.../a/../b/c/../d/./\"" + ], + "sample_test_results": [ + "'/home'", + "'/home/foo'", + "'/home/user/Pictures'", + "'/'", + "'/.../b/d'" + ], + "hidden_test_cases": [ + "--arg1=\"/a/./b/../../c/\"", + "--arg1=\"/home/\"", + "--arg1=\"/...\"", + "--arg1=\"/..hidden\"", + "--arg1=\"//\"", + "--arg1=\"/a//b////c/d//././/..\"", + "--arg1=\"/abc/...\"", + "--arg1=\"/a/./b/./c/./d/\"", + "--arg1=\"/a/../../b/../c//.//\"", + "--arg1=\"/a//b//./c/d/\"" + ], + "hidden_test_results": [ + "'/c'", + "'/home'", + "'/...'", + "'/..hidden'", + "'/'", + "'/a/b/c'", + "'/abc/...'", + "'/a/b/c/d'", + "'/c'", + "'/a/b/c/d'" + ], + "boilerplate": { + "python": "class Solution:\n def simplifyPath(self, path: str) -> str:\n ", + "java": "class Solution {\n public String simplifyPath(String path) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string simplifyPath(string path) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try {\n return result == Integer.parseInt(expected);\n} catch (NumberFormatException e) {\n return false;\n}", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=qYlHrAKJfyA&pp=ygUWTmVldENvZGUgU2ltcGxpZnkgUGF0aA%3D%3D", + "method_name": "simplifyPath" + }, + { + "title": "Edit Distance", + "source": "https://leetcode.com/problems/edit-distance/", + "description": "

Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.

\n\n

You have the following three operations permitted on a word:

\n\n
    \n\t
  • Insert a character
  • \n\t
  • Delete a character
  • \n\t
  • Replace a character
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: word1 = "horse", word2 = "ros"\nOutput: 3\nExplanation: \nhorse -> rorse (replace 'h' with 'r')\nrorse -> rose (remove 'r')\nrose -> ros (remove 'e')\n
\n\n

Example 2:

\n\n
\nInput: word1 = "intention", word2 = "execution"\nOutput: 5\nExplanation: \nintention -> inention (remove 't')\ninention -> enention (replace 'i' with 'e')\nenention -> exention (replace 'n' with 'x')\nexention -> exection (replace 'n' with 'c')\nexection -> execution (insert 'u')\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= word1.length, word2.length <= 500
  • \n\t
  • word1 and word2 consist of lowercase English letters.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1='horse' --arg2='ros'", + "--arg1='intention' --arg2='execution'", + "--arg1='' --arg2='a'" + ], + "sample_test_results": [ + "3", + "5", + "1" + ], + "hidden_test_cases": [ + "--arg1='' --arg2=''", + "--arg1='a' --arg2=''", + "--arg1='abc' --arg2='abc'", + "--arg1='abcde' --arg2='ace'", + "--arg1='sea' --arg2='eat'", + "--arg1='leetcode' --arg2='practice'", + "--arg1='hello' --arg2='world'", + "--arg1='pneumonoultramicroscopicsilicovolcanoconiosis' --arg2='ultramicroscopically'", + "--arg1='abc' --arg2='def'", + "--arg1='aaa' --arg2='bbb'" + ], + "hidden_test_results": [ + "0", + "1", + "0", + "2", + "2", + "7", + "4", + "27", + "3", + "3" + ], + "boilerplate": { + "python": "class Solution:\n def minDistance(self, word1: str, word2: str) -> int:\n ", + "java": "class Solution {\n public int minDistance(String word1, String word2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int minDistance(string word1, string word2) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=XYi2-LPrwm4&pp=ygUWTmVldENvZGUgRWRpdCBEaXN0YW5jZQ%3D%3D", + "method_name": "minDistance" + }, + { + "title": "Search a 2D Matrix", + "source": "https://leetcode.com/problems/search-a-2d-matrix/", + "description": "

You are given an m x n integer matrix matrix with the following two properties:

\n\n
    \n\t
  • Each row is sorted in non-decreasing order.
  • \n\t
  • The first integer of each row is greater than the last integer of the previous row.
  • \n
\n\n

Given an integer target, return true if target is in matrix or false otherwise.

\n\n

You must write a solution in O(log(m * n)) time complexity.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3\nOutput: true\n
\n\n

Example 2:

\n\"\"\n
\nInput: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == matrix.length
  • \n\t
  • n == matrix[i].length
  • \n\t
  • 1 <= m, n <= 100
  • \n\t
  • -104 <= matrix[i][j], target <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[1,3,5,7],[10,11,16,20],[23,30,34,60]] --arg2=3", + "--arg1=[[1,3,5,7],[10,11,16,20],[23,30,34,60]] --arg2=13", + "--arg1=[[1]] --arg2=1" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=[[1]] --arg2=2", + "--arg1=[[1,2,3]] --arg2=2", + "--arg1=[[1],[2],[3]] --arg2=2", + "--arg1=[[1,2],[3,4]] --arg2=4", + "--arg1=[[-10,-8],[15,20]] --arg2=-8", + "--arg1=[[1,2,3,4],[5,6,7,8]] --arg2=6", + "--arg1=[[1,2,3],[4,5,6],[7,8,9]] --arg2=9", + "--arg1=[[1]] --arg2=0", + "--arg1=[[1,3,5]] --arg2=5", + "--arg1=[[1],[3],[5]] --arg2=3" + ], + "hidden_test_results": [ + "false", + "true", + "true", + "true", + "true", + "true", + "true", + "false", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:\n ", + "java": "class Solution {\n public boolean searchMatrix(int[][] matrix, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool searchMatrix(vector>& matrix, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().equalsIgnoreCase(expected);", + "cpp": "return toLowerCase(result) == toLowerCase(expected); \n\nstd::string toLowerCase(const std::string &input) {\n std::string lowercaseString;\n for (char c : input) {\n lowercaseString += std::tolower(c);\n }\n return lowercaseString;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=Ber2pi2C0j0&pp=ygUbTmVldENvZGUgU2VhcmNoIGEgMkQgTWF0cml4", + "method_name": "searchMatrix" + }, + { + "title": "Word Search", + "source": "https://leetcode.com/problems/word-search/", + "description": "

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

\n\n

The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"\nOutput: true\n
\n\n

Example 2:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "SEE"\nOutput: true\n
\n\n

Example 3:

\n\"\"\n
\nInput: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB"\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == board.length
  • \n\t
  • n = board[i].length
  • \n\t
  • 1 <= m, n <= 6
  • \n\t
  • 1 <= word.length <= 15
  • \n\t
  • board and word consists of only lowercase and uppercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you use search pruning to make your solution faster with a larger board?

\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[['A','B','C','E'],['S','F','C','S'],['A','D','E','E']] --arg2='ABCCED'", + "--arg1=[['A','B','C','E'],['S','F','C','S'],['A','D','E','E']] --arg2='SEE'", + "--arg1=[['A','B','C','E'],['S','F','C','S'],['A','D','E','E']] --arg2='ABCB'" + ], + "sample_test_results": [ + "true", + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1=[['A']] --arg2='A'", + "--arg1=[['A','B'],['C','D']] --arg2='ABDC'", + "--arg1=[['A','B']] --arg2='BA'", + "--arg1=[['A','B','C'],['D','E','F']] --arg2='CBA'", + "--arg1=[['A']] --arg2='B'", + "--arg1=[['A','A']] --arg2='AAA'", + "--arg1=[['A','B','C']] --arg2='ABC'", + "--arg1=[['A'],['B'],['C']] --arg2='ABC'", + "--arg1=[['A','B'],['C','D']] --arg2='AC'", + "--arg1=[['A','B','C'],['D','E','F'],['G','H','I']] --arg2='ABCFIHG'" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "false", + "false", + "true", + "true", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def exist(self, board: List[List[str]], word: str) -> bool:\n ", + "java": "class Solution {\n public boolean exist(char[][] board, String word) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool exist(vector>& board, string word) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=pfiQ_PS1g8E&pp=ygUUTmVldENvZGUgV29yZCBTZWFyY2g%3D", + "method_name": "exist" + }, + { + "title": "Subsets II", + "source": "https://leetcode.com/problems/subsets-ii/", + "description": "

Given an integer array nums that may contain duplicates, return all possible subsets (the power set).

\n\n

The solution set must not contain duplicate subsets. Return the solution in any order.

\n\n

 

\n

Example 1:

\n
Input: nums = [1,2,2]\nOutput: [[],[1],[1,2],[1,2,2],[2],[2,2]]\n

Example 2:

\n
Input: nums = [0]\nOutput: [[],[0]]\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 10
  • \n\t
  • -10 <= nums[i] <= 10
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[1,2,2]", + "--arg1=[0]", + "--arg1=[1,1,1]" + ], + "sample_test_results": [ + "[[],[1],[1,2],[1,2,2],[2],[2,2]]", + "[[],[0]]", + "[[],[1],[1,1],[1,1,1]]" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,2]", + "--arg1=[1,2,3]", + "--arg1=[2,2,2,2]", + "--arg1=[1,2,2,3]", + "--arg1=[1,1,2,2]", + "--arg1=[3,2,1]", + "--arg1=[-1,0,1]", + "--arg1=[0,0,0]", + "--arg1=[4,4,4,1,4]" + ], + "hidden_test_results": [ + "[[],[1]]", + "[[],[1],[1,2],[2]]", + "[[],[1],[1,2],[1,2,3],[1,3],[2],[2,3],[3]]", + "[[],[2],[2,2],[2,2,2],[2,2,2,2]]", + "[[],[1],[1,2],[1,2,2],[1,2,2,3],[1,2,3],[1,3],[2],[2,2],[2,2,3],[2,3],[3]]", + "[[],[1],[1,1],[1,1,2],[1,1,2,2],[1,2],[1,2,2],[2],[2,2]]", + "[[],[1],[1,2],[1,2,3],[1,3],[2],[2,3],[3]]", + "[[],[-1],[-1,0],[-1,0,1],[-1,1],[0],[0,1],[1]]", + "[[],[0],[0,0],[0,0,0]]", + "[[],[1],[1,4],[1,4,4],[1,4,4,4],[1,4,4,4,4],[4],[4,4],[4,4,4],[4,4,4,4]]" + ], + "boilerplate": { + "python": "class Solution:\n def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:\n ", + "java": "class Solution {\n public List> subsetsWithDup(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector> subsetsWithDup(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted([sorted(x) for x in result]) == sorted(eval(expected))", + "java": "return Arrays.equals(\n Arrays.stream(result)\n .map(subArray -> Arrays.stream(subArray).sorted().toArray(String[]::new))\n .sorted(new Comparator<>() {\n public int compare(String[] a, String[] b) {\n for (int i = 0; i < Math.min(a.length, b.length); i++) {\n int cmp = a[i].compareTo(b[i]);\n if (cmp != 0) {\n return cmp;\n }\n }\n return Integer.compare(a.length, b.length);\n }\n }).toArray(String[][]::new), \n Arrays.stream(expected)\n .sorted(new Comparator<>() {\n public int compare(String[] a, String[] b) {\n for (int i = 0; i < Math.min(a.length, b.length); i++) {\n int cmp = a[i].compareTo(b[i]);\n if (cmp != 0) {\n return cmp;\n }\n }\n return Integer.compare(a.length, b.length);\n }\n }).toArray(String[][]::new)\n);", + "cpp": "#include \n#include \n\nbool compareFunction(const std::vector>& result, const std::vector>& expected) {\n auto sort_inner_vectors = [](std::vector& vec) {\n std::sort(vec.begin(), vec.end());\n };\n\n // Sort inner vectors of result\n std::vector> sorted_result = result;\n std::for_each(sorted_result.begin(), sorted_result.end(), sort_inner_vectors);\n std::sort(sorted_result.begin(), sorted_result.end());\n\n // Sort inner vectors of expected\n std::vector> sorted_expected = expected;\n std::for_each(sorted_expected.begin(), sorted_expected.end(), sort_inner_vectors);\n std::sort(sorted_expected.begin(), sorted_expected.end());\n\n return sorted_result == sorted_expected;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=Vn2v6ajA7U0&pp=ygUTTmVldENvZGUgU3Vic2V0cyBJSQ%3D%3D", + "method_name": "subsetsWithDup" + }, + { + "title": "Restore IP Addresses", + "source": "https://leetcode.com/problems/restore-ip-addresses/", + "description": "

A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclusive) and cannot have leading zeros.

\n\n
    \n\t
  • For example, "0.1.2.201" and "192.168.1.1" are valid IP addresses, but "0.011.255.245", "192.168.1.312" and "192.168@1.1" are invalid IP addresses.
  • \n
\n\n

Given a string s containing only digits, return all possible valid IP addresses that can be formed by inserting dots into s. You are not allowed to reorder or remove any digits in s. You may return the valid IP addresses in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "25525511135"\nOutput: ["255.255.11.135","255.255.111.35"]\n
\n\n

Example 2:

\n\n
\nInput: s = "0000"\nOutput: ["0.0.0.0"]\n
\n\n

Example 3:

\n\n
\nInput: s = "101023"\nOutput: ["1.0.10.23","1.0.102.3","10.1.0.23","10.10.2.3","101.0.2.3"]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 20
  • \n\t
  • s consists of digits only.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1='25525511135'", + "--arg1='0000'", + "--arg1='101023'" + ], + "sample_test_results": [ + "['255.255.11.135','255.255.111.35']", + "['0.0.0.0']", + "['1.0.10.23','1.0.102.3','10.1.0.23','10.10.2.3','101.0.2.3']" + ], + "hidden_test_cases": [ + "--arg1='1111'", + "--arg1='010010'", + "--arg1='0'", + "--arg1='999999'", + "--arg1='1921680'", + "--arg1='2552551113'", + "--arg1='00001'", + "--arg1='100100'", + "--arg1='12345'", + "--arg1='1111111'" + ], + "hidden_test_results": [ + "['1.1.1.1']", + "['0.10.0.10','0.100.1.0']", + "[]", + "['9.9.99.99','9.99.9.99','9.99.99.9','99.9.9.99','99.9.99.9','99.99.9.9']", + "['1.9.216.80','1.92.16.80','1.92.168.0','19.2.16.80','19.2.168.0','19.21.6.80','19.21.68.0','19.216.8.0','192.1.6.80','192.1.68.0','192.16.8.0']", + "['255.25.51.113','255.255.1.113','255.255.11.13','255.255.111.3']", + "[]", + "['1.0.0.100','10.0.10.0','100.1.0.0']", + "['1.2.3.45','1.2.34.5','1.23.4.5','12.3.4.5']", + "['1.1.11.111','1.1.111.11','1.11.1.111','1.11.11.11','1.11.111.1','1.111.1.11','1.111.11.1','11.1.1.111','11.1.11.11','11.1.111.1','11.11.1.11','11.11.11.1','11.111.1.1','111.1.1.11','111.1.11.1','111.11.1.1']" + ], + "boilerplate": { + "python": "class Solution:\n def restoreIpAddresses(self, s: str) -> List[str]:\n ", + "java": "class Solution {\n public List restoreIpAddresses(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector restoreIpAddresses(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "return Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray());", + "cpp": "std::sort(result.begin(), result.end());\nstd::sort(expected.begin(), expected.end());\nreturn result == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=61tN4YEdiTM&pp=ygUdTmVldENvZGUgUmVzdG9yZSBJUCBBZGRyZXNzZXM%3D", + "method_name": "restoreIpAddresses" + }, + { + "title": "Interleaving String", + "source": "https://leetcode.com/problems/interleaving-string/", + "description": "

Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2.

\n\n

An interleaving of two strings s and t is a configuration where s and t are divided into n and m substrings respectively, such that:

\n\n
    \n\t
  • s = s1 + s2 + ... + sn
  • \n\t
  • t = t1 + t2 + ... + tm
  • \n\t
  • |n - m| <= 1
  • \n\t
  • The interleaving is s1 + t1 + s2 + t2 + s3 + t3 + ... or t1 + s1 + t2 + s2 + t3 + s3 + ...
  • \n
\n\n

Note: a + b is the concatenation of strings a and b.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"\nOutput: true\nExplanation: One way to obtain s3 is:\nSplit s1 into s1 = "aa" + "bc" + "c", and s2 into s2 = "dbbc" + "a".\nInterleaving the two splits, we get "aa" + "dbbc" + "bc" + "a" + "c" = "aadbbcbcac".\nSince s3 can be obtained by interleaving s1 and s2, we return true.\n
\n\n

Example 2:

\n\n
\nInput: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc"\nOutput: false\nExplanation: Notice how it is impossible to interleave s2 with any other string to obtain s3.\n
\n\n

Example 3:

\n\n
\nInput: s1 = "", s2 = "", s3 = ""\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= s1.length, s2.length <= 100
  • \n\t
  • 0 <= s3.length <= 200
  • \n\t
  • s1, s2, and s3 consist of lowercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you solve it using only O(s2.length) additional memory space?

\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1='aabcc' --arg2='dbbca' --arg3='aadbbcbcac'", + "--arg1='aabcc' --arg2='dbbca' --arg3='aadbbbaccc'", + "--arg1='' --arg2='' --arg3=''" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1='abc' --arg2='def' --arg3='adbecf'", + "--arg1='a' --arg2='b' --arg3='ab'", + "--arg1='a' --arg2='b' --arg3='ba'", + "--arg1='aa' --arg2='ab' --arg3='aaba'", + "--arg1='aaa' --arg2='bbb' --arg3='ababab'", + "--arg1='' --arg2='abc' --arg3='abc'", + "--arg1='abc' --arg2='' --arg3='abc'", + "--arg1='abc' --arg2='def' --arg3='abcdef'", + "--arg1='aaa' --arg2='aaa' --arg3='aaaaaa'", + "--arg1='abc' --arg2='def' --arg3='abcef'" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "true", + "true", + "true", + "true", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isInterleave(self, s1: str, s2: str, s3: str) -> bool:\n ", + "java": "class Solution {\n public boolean isInterleave(String s1, String s2, String s3) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isInterleave(string s1, string s2, string s3) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "std::transform(result.begin(), result.end(), result.begin(), ::tolower);\nstd::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);\nreturn result == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=3Rw3p9LrgvE&pp=ygUcTmVldENvZGUgSW50ZXJsZWF2aW5nIFN0cmluZw%3D%3D", + "method_name": "isInterleave" + }, + { + "title": "Triangle", + "source": "https://leetcode.com/problems/triangle/", + "description": "

Given a triangle array, return the minimum path sum from top to bottom.

\n\n

For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i + 1 on the next row.

\n\n

 

\n

Example 1:

\n\n
\nInput: triangle = [[2],[3,4],[6,5,7],[4,1,8,3]]\nOutput: 11\nExplanation: The triangle looks like:\n   2\n  3 4\n 6 5 7\n4 1 8 3\nThe minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11 (underlined above).\n
\n\n

Example 2:

\n\n
\nInput: triangle = [[-10]]\nOutput: -10\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= triangle.length <= 200
  • \n\t
  • triangle[0].length == 1
  • \n\t
  • triangle[i].length == triangle[i - 1].length + 1
  • \n\t
  • -104 <= triangle[i][j] <= 104
  • \n
\n\n

 

\nFollow up: Could you do this using only O(n) extra space, where n is the total number of rows in the triangle?", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[[2],[3,4],[6,5,7],[4,1,8,3]]", + "--arg1=[[-10]]" + ], + "sample_test_results": [ + "11", + "-10" + ], + "hidden_test_cases": [ + "--arg1=[[1]]", + "--arg1=[[1],[2,3]]", + "--arg1=[[-1],[2,3],[1,-1,3]]", + "--arg1=[[1],[1,2],[1,2,3],[1,2,3,4]]", + "--arg1=[[0],[-1,2],[1,-2,3],[-3,1,-1,2]]", + "--arg1=[[1],[-5,2],[2,-1,3],[1,2,-4,5]]", + "--arg1=[[0],[0,0],[0,0,0]]", + "--arg1=[[1],[-1,-2],[3,-3,1],[-4,5,-6,2]]", + "--arg1=[[10],[-2,-3],[1,2,-1]]", + "--arg1=[[1],[2,1],[3,3,1]]" + ], + "hidden_test_results": [ + "1", + "3", + "0", + "4", + "-4", + "-9", + "0", + "-10", + "6", + "3" + ], + "boilerplate": { + "python": "class Solution:\n def minimumTotal(self, triangle: List[List[int]]) -> int:\n ", + "java": "class Solution {\n public int minimumTotal(List> triangle) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int minimumTotal(vector>& triangle) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=OM1MTokvxs4&pp=ygURTmVldENvZGUgVHJpYW5nbGU%3D", + "method_name": "minimumTotal" + }, + { + "title": "Longest Consecutive Sequence", + "source": "https://leetcode.com/problems/longest-consecutive-sequence/", + "description": "

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.

\n\n

You must write an algorithm that runs in O(n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [100,4,200,1,3,2]\nOutput: 4\nExplanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.\n
\n\n

Example 2:

\n\n
\nInput: nums = [0,3,7,2,5,8,4,6,0,1]\nOutput: 9\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 0 <= nums.length <= 105
  • \n\t
  • -109 <= nums[i] <= 109
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[100,4,200,1,3,2]", + "--arg1=[0,3,7,2,5,8,4,6,0,1]" + ], + "sample_test_results": [ + "4", + "9" + ], + "hidden_test_cases": [ + "--arg1=[]", + "--arg1=[1]", + "--arg1=[1,2,3,4,5]", + "--arg1=[1,3,5,7,9]", + "--arg1=[-5,-4,-3,-2,-1]", + "--arg1=[1,1,1,1,1]", + "--arg1=[1,2,0,1]", + "--arg1=[0,-1,2,-2,3,-3]", + "--arg1=[1000,1,2,3,4,999]", + "--arg1=[5,4,3,2,1,6,7,8,9]" + ], + "hidden_test_results": [ + "0", + "1", + "5", + "1", + "5", + "1", + "3", + "4", + "4", + "9" + ], + "boilerplate": { + "python": "class Solution:\n def longestConsecutive(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int longestConsecutive(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int longestConsecutive(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=P6RZZMu_maU&pp=ygUlTmVldENvZGUgTG9uZ2VzdCBDb25zZWN1dGl2ZSBTZXF1ZW5jZQ%3D%3D", + "method_name": "longestConsecutive" + }, + { + "title": "Gas Station", + "source": "https://leetcode.com/problems/gas-station/", + "description": "

There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i].

\n\n

You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from the ith station to its next (i + 1)th station. You begin the journey with an empty tank at one of the gas stations.

\n\n

Given two integer arrays gas and cost, return the starting gas station's index if you can travel around the circuit once in the clockwise direction, otherwise return -1. If there exists a solution, it is guaranteed to be unique.

\n\n

 

\n

Example 1:

\n\n
\nInput: gas = [1,2,3,4,5], cost = [3,4,5,1,2]\nOutput: 3\nExplanation:\nStart at station 3 (index 3) and fill up with 4 unit of gas. Your tank = 0 + 4 = 4\nTravel to station 4. Your tank = 4 - 1 + 5 = 8\nTravel to station 0. Your tank = 8 - 2 + 1 = 7\nTravel to station 1. Your tank = 7 - 3 + 2 = 6\nTravel to station 2. Your tank = 6 - 4 + 3 = 5\nTravel to station 3. The cost is 5. Your gas is just enough to travel back to station 3.\nTherefore, return 3 as the starting index.\n
\n\n

Example 2:

\n\n
\nInput: gas = [2,3,4], cost = [3,4,3]\nOutput: -1\nExplanation:\nYou can't start at station 0 or 1, as there is not enough gas to travel to the next station.\nLet's start at station 2 and fill up with 4 unit of gas. Your tank = 0 + 4 = 4\nTravel to station 0. Your tank = 4 - 3 + 2 = 3\nTravel to station 1. Your tank = 3 - 3 + 3 = 3\nYou cannot travel back to station 2, as it requires 4 unit of gas but you only have 3.\nTherefore, you can't travel around the circuit once no matter where you start.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == gas.length == cost.length
  • \n\t
  • 1 <= n <= 105
  • \n\t
  • 0 <= gas[i], cost[i] <= 104
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[1,2,3,4,5] --arg2=[3,4,5,1,2]", + "--arg1=[2,3,4] --arg2=[3,4,3]" + ], + "sample_test_results": [ + "3", + "-1" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=[1]", + "--arg1=[2] --arg2=[1]", + "--arg1=[1,2] --arg2=[2,1]", + "--arg1=[5,1,2,3,4] --arg2=[4,4,1,5,1]", + "--arg1=[4,5,2,6,5,3] --arg2=[3,2,7,3,2,9]", + "--arg1=[1,2,3] --arg2=[2,3,1]", + "--arg1=[3,1,1] --arg2=[1,2,2]", + "--arg1=[5,8,2,8] --arg2=[6,5,6,6]", + "--arg1=[1,1,1] --arg2=[1,1,1]", + "--arg1=[2,0,1] --arg2=[1,1,1]" + ], + "hidden_test_results": [ + "0", + "0", + "1", + "4", + "-1", + "2", + "0", + "3", + "0", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:\n ", + "java": "class Solution {\n public int canCompleteCircuit(int[] gas, int[] cost) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int canCompleteCircuit(vector& gas, vector& cost) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=lJwbPZGo05A&pp=ygUUTmVldENvZGUgR2FzIFN0YXRpb24%3D", + "method_name": "canCompleteCircuit" + }, + { + "title": "Word Break", + "source": "https://leetcode.com/problems/word-break/", + "description": "

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

\n\n

Note that the same word in the dictionary may be reused multiple times in the segmentation.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "leetcode", wordDict = ["leet","code"]\nOutput: true\nExplanation: Return true because "leetcode" can be segmented as "leet code".\n
\n\n

Example 2:

\n\n
\nInput: s = "applepenapple", wordDict = ["apple","pen"]\nOutput: true\nExplanation: Return true because "applepenapple" can be segmented as "apple pen apple".\nNote that you are allowed to reuse a dictionary word.\n
\n\n

Example 3:

\n\n
\nInput: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"]\nOutput: false\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 300
  • \n\t
  • 1 <= wordDict.length <= 1000
  • \n\t
  • 1 <= wordDict[i].length <= 20
  • \n\t
  • s and wordDict[i] consist of only lowercase English letters.
  • \n\t
  • All the strings of wordDict are unique.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1='leetcode' --arg2=['leet','code']", + "--arg1='applepenapple' --arg2=['apple','pen']", + "--arg1='catsandog' --arg2=['cats','dog','sand','and','cat']" + ], + "sample_test_results": [ + "true", + "true", + "false" + ], + "hidden_test_cases": [ + "--arg1='a' --arg2=['a']", + "--arg1='ab' --arg2=['a','b']", + "--arg1='cars' --arg2=['car','ca','rs']", + "--arg1='goalspecial' --arg2=['go','goal','goals','special']", + "--arg1='aaaaaaa' --arg2=['aaa','aaaa']", + "--arg1='impossible' --arg2=['imp','possible']", + "--arg1='python' --arg2=['py','thon']", + "--arg1='abcd' --arg2=['ab','abc','cd','abcd']", + "--arg1='helloworld' --arg2=['hello','world','hell','or']", + "--arg1='noway' --arg2=['no','way','now','ay']" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "true", + "false", + "true", + "true", + "true", + "true" + ], + "boilerplate": { + "python": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> bool:\n ", + "java": "class Solution {\n public boolean wordBreak(String s, List wordDict) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool wordBreak(string s, vector& wordDict) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toLowerCase().equals(expected.toLowerCase());", + "cpp": "return std::tolower(result) == std::tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=Sx9NNgInc3A&pp=ygUTTmVldENvZGUgV29yZCBCcmVhaw%3D%3D", + "method_name": "wordBreak" + }, + { + "title": "Evaluate Reverse Polish Notation", + "source": "https://leetcode.com/problems/evaluate-reverse-polish-notation/", + "description": "

You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation.

\n\n

Evaluate the expression. Return an integer that represents the value of the expression.

\n\n

Note that:

\n\n
    \n\t
  • The valid operators are '+', '-', '*', and '/'.
  • \n\t
  • Each operand may be an integer or another expression.
  • \n\t
  • The division between two integers always truncates toward zero.
  • \n\t
  • There will not be any division by zero.
  • \n\t
  • The input represents a valid arithmetic expression in a reverse polish notation.
  • \n\t
  • The answer and all the intermediate calculations can be represented in a 32-bit integer.
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: tokens = ["2","1","+","3","*"]\nOutput: 9\nExplanation: ((2 + 1) * 3) = 9\n
\n\n

Example 2:

\n\n
\nInput: tokens = ["4","13","5","/","+"]\nOutput: 6\nExplanation: (4 + (13 / 5)) = 6\n
\n\n

Example 3:

\n\n
\nInput: tokens = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"]\nOutput: 22\nExplanation: ((10 * (6 / ((9 + 3) * -11))) + 17) + 5\n= ((10 * (6 / (12 * -11))) + 17) + 5\n= ((10 * (6 / -132)) + 17) + 5\n= ((10 * 0) + 17) + 5\n= (0 + 17) + 5\n= 17 + 5\n= 22\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= tokens.length <= 104
  • \n\t
  • tokens[i] is either an operator: "+", "-", "*", or "/", or an integer in the range [-200, 200].
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[\"2\",\"1\",\"+\",\"3\",\"*\"]", + "--arg1=[\"4\",\"13\",\"5\",\"/\",\"+\"]", + "--arg1=[\"10\",\"6\",\"9\",\"3\",\"+\",\"-11\",\"*\",\"/\",\"*\",\"17\",\"+\",\"5\",\"+\"]" + ], + "sample_test_results": [ + "9", + "6", + "22" + ], + "hidden_test_cases": [ + "--arg1=[\"1\"]", + "--arg1=[\"2\",\"3\",\"+\"]", + "--arg1=[\"4\",\"5\",\"*\"]", + "--arg1=[\"10\",\"5\",\"/\"]", + "--arg1=[\"15\",\"7\",\"-\"]", + "--arg1=[\"2\",\"1\",\"3\",\"*\",\"+\"]", + "--arg1=[\"-2\",\"3\",\"*\",\"4\",\"+\"]", + "--arg1=[\"10\",\"2\",\"*\",\"3\",\"4\",\"*\",\"+\"]", + "--arg1=[\"5\",\"3\",\"/\",\"2\",\"*\"]", + "--arg1=[\"100\",\"200\",\"+\",\"2\",\"/\"]" + ], + "hidden_test_results": [ + "1", + "5", + "20", + "2", + "8", + "5", + "-2", + "32", + "2", + "150" + ], + "boilerplate": { + "python": "class Solution:\n def evalRPN(self, tokens: List[str]) -> int:\n ", + "java": "class Solution {\n public int evalRPN(String[] tokens) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int evalRPN(vector& tokens) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=iu0082c4HDE&pp=ygUpTmVldENvZGUgRXZhbHVhdGUgUmV2ZXJzZSBQb2xpc2ggTm90YXRpb24%3D", + "method_name": "evalRPN" + }, + { + "title": "Reverse Words in a String", + "source": "https://leetcode.com/problems/reverse-words-in-a-string/", + "description": "

Given an input string s, reverse the order of the words.

\n\n

A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space.

\n\n

Return a string of the words in reverse order concatenated by a single space.

\n\n

Note that s may contain leading or trailing spaces or multiple spaces between two words. The returned string should only have a single space separating the words. Do not include any extra spaces.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "the sky is blue"\nOutput: "blue is sky the"\n
\n\n

Example 2:

\n\n
\nInput: s = "  hello world  "\nOutput: "world hello"\nExplanation: Your reversed string should not contain leading or trailing spaces.\n
\n\n

Example 3:

\n\n
\nInput: s = "a good   example"\nOutput: "example good a"\nExplanation: You need to reduce multiple spaces between two words to a single space in the reversed string.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 104
  • \n\t
  • s contains English letters (upper-case and lower-case), digits, and spaces ' '.
  • \n\t
  • There is at least one word in s.
  • \n
\n\n

 

\n

Follow-up: If the string data type is mutable in your language, can you solve it in-place with O(1) extra space?

\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=\"the sky is blue\"", + "--arg1=\" hello world \"", + "--arg1=\"a good example\"" + ], + "sample_test_results": [ + "'blue is sky the'", + "'world hello'", + "'example good a'" + ], + "hidden_test_cases": [ + "--arg1=\"hello\"", + "--arg1=\" spaces \"", + "--arg1=\"first second third\"", + "--arg1=\" multiple spaces here \"", + "--arg1=\"1 2 3 4 5\"", + "--arg1=\"a\"", + "--arg1=\" start end \"", + "--arg1=\"comma, no space\"", + "--arg1=\"mixed Case woRDs\"", + "--arg1=\" lots of spaces \"" + ], + "hidden_test_results": [ + "'hello'", + "'spaces'", + "'third second first'", + "'here spaces multiple'", + "'5 4 3 2 1'", + "'a'", + "'end start'", + "'space comma,no'", + "'woRDs Case mixed'", + "'spaces of lots'" + ], + "boilerplate": { + "python": "class Solution:\n def reverseWords(self, s: str) -> str:\n ", + "java": "class Solution {\n public String reverseWords(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string reverseWords(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=7kUEwiwwnlA&pp=ygUiTmVldENvZGUgUmV2ZXJzZSBXb3JkcyBpbiBhIFN0cmluZw%3D%3D", + "method_name": "reverseWords" + }, + { + "title": "Find Minimum in Rotated Sorted Array", + "source": "https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/", + "description": "

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:

\n\n
    \n\t
  • [4,5,6,7,0,1,2] if it was rotated 4 times.
  • \n\t
  • [0,1,2,4,5,6,7] if it was rotated 7 times.
  • \n
\n\n

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

\n\n

Given the sorted rotated array nums of unique elements, return the minimum element of this array.

\n\n

You must write an algorithm that runs in O(log n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [3,4,5,1,2]\nOutput: 1\nExplanation: The original array was [1,2,3,4,5] rotated 3 times.\n
\n\n

Example 2:

\n\n
\nInput: nums = [4,5,6,7,0,1,2]\nOutput: 0\nExplanation: The original array was [0,1,2,4,5,6,7] and it was rotated 4 times.\n
\n\n

Example 3:

\n\n
\nInput: nums = [11,13,15,17]\nOutput: 11\nExplanation: The original array was [11,13,15,17] and it was rotated 4 times. \n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == nums.length
  • \n\t
  • 1 <= n <= 5000
  • \n\t
  • -5000 <= nums[i] <= 5000
  • \n\t
  • All the integers of nums are unique.
  • \n\t
  • nums is sorted and rotated between 1 and n times.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[3,4,5,1,2]", + "--arg1=[4,5,6,7,0,1,2]", + "--arg1=[11,13,15,17]" + ], + "sample_test_results": [ + "1", + "0", + "11" + ], + "hidden_test_cases": [ + "--arg1=[45,19,22,27,32,36,41]", + "--arg1=[-29]", + "--arg1=[29,30,35,38,41,46,50,54,59,61,63,68,20,22,26]", + "--arg1=[56,16,19,23,26,31,34,35,36,37,41,44,46,49,51]", + "--arg1=[11,16,19,21,26,30,35,37,41,-3,-2,0,5,6,7]", + "--arg1=[43,47,29,30,35,40,41]", + "--arg1=[14,19,20,25,28,29,-1,2,6,9]", + "--arg1=[14,19,20,25,28,29,-1,2,6,9]", + "--arg1=[31,33,29,30]", + "--arg1=[47,48,52,14,18,23,26,29,34,39,44]" + ], + "hidden_test_results": [ + "19", + "-29", + "20", + "16", + "-3", + "29", + "-1", + "-1", + "29", + "14" + ], + "boilerplate": { + "python": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int findMin(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findMin(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return static_cast(result) == static_cast(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=nIVW4P8b1VA&pp=ygUtTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5", + "method_name": "findMin" + }, + { + "title": "Find Peak Element", + "source": "https://leetcode.com/problems/find-peak-element/", + "description": "

A peak element is an element that is strictly greater than its neighbors.

\n\n

Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks.

\n\n

You may imagine that nums[-1] = nums[n] = -∞. In other words, an element is always considered to be strictly greater than a neighbor that is outside the array.

\n\n

You must write an algorithm that runs in O(log n) time.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,3,1]\nOutput: 2\nExplanation: 3 is a peak element and your function should return the index number 2.
\n\n

Example 2:

\n\n
\nInput: nums = [1,2,1,3,5,6,4]\nOutput: 5\nExplanation: Your function can return either index number 1 where the peak element is 2, or index number 5 where the peak element is 6.
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 1000
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n\t
  • nums[i] != nums[i + 1] for all valid i.
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[1,2,3,1]", + "--arg1=[1,2,1,3,5,6,4]" + ], + "sample_test_results": [ + "2", + "5" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,2]", + "--arg1=[2,1]", + "--arg1=[1,2,3]", + "--arg1=[3,2,1]", + "--arg1=[1,3,2,4,5]", + "--arg1=[5,4,3,2,1]", + "--arg1=[1,5,3,7,4]", + "--arg1=[1,2,3,4,3]", + "--arg1=[3,1,4,5,2]" + ], + "hidden_test_results": [ + "0", + "1", + "0", + "2", + "0", + "4", + "0", + "3", + "3", + "3" + ], + "boilerplate": { + "python": "class Solution:\n def findPeakElement(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int findPeakElement(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findPeakElement(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "return result == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=kMzJy9es7Hc&pp=ygUaTmVldENvZGUgRmluZCBQZWFrIEVsZW1lbnQ%3D", + "method_name": "findPeakElement" + }, + { + "title": "Maximum Gap", + "source": "https://leetcode.com/problems/maximum-gap/", + "description": "

Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the array contains less than two elements, return 0.

\n\n

You must write an algorithm that runs in linear time and uses linear extra space.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [3,6,9,1]\nOutput: 3\nExplanation: The sorted form of the array is [1,3,6,9], either (3,6) or (6,9) has the maximum difference 3.\n
\n\n

Example 2:

\n\n
\nInput: nums = [10]\nOutput: 0\nExplanation: The array contains less than 2 elements, therefore return 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • 0 <= nums[i] <= 109
  • \n
\n", + "difficulty": "medium", + "sample_test_cases": [ + "--arg1=[3,6,9,1]", + "--arg1=[10]" + ], + "sample_test_results": [ + "3", + "0" + ], + "hidden_test_cases": [ + "--arg1=[1,2,3,4]", + "--arg1=[1,10]", + "--arg1=[1,1,1,1]", + "--arg1=[1,3,100]", + "--arg1=[1]", + "--arg1=[1,5,2,8,3]", + "--arg1=[87,53,100,1]", + "--arg1=[1000,1,500,2]", + "--arg1=[1,10000,1,10000]", + "--arg1=[1,2,3,5,6,7,8,9,10,100]" + ], + "hidden_test_results": [ + "1", + "9", + "0", + "97", + "0", + "3", + "52", + "500", + "9999", + "90" + ], + "boilerplate": { + "python": "class Solution:\n def maximumGap(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int maximumGap(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maximumGap(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=imCKT3T2Oao&pp=ygUUTmVldENvZGUgTWF4aW11bSBHYXA%3D", + "method_name": "maximumGap" + }, + { + "title": "Median of Two Sorted Arrays", + "source": "https://leetcode.com/problems/median-of-two-sorted-arrays/", + "description": "

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

\n\n

The overall run time complexity should be O(log (m+n)).

\n\n

 

\n

Example 1:

\n\n
\nInput: nums1 = [1,3], nums2 = [2]\nOutput: 2.00000\nExplanation: merged array = [1,2,3] and median is 2.\n
\n\n

Example 2:

\n\n
\nInput: nums1 = [1,2], nums2 = [3,4]\nOutput: 2.50000\nExplanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • nums1.length == m
  • \n\t
  • nums2.length == n
  • \n\t
  • 0 <= m <= 1000
  • \n\t
  • 0 <= n <= 1000
  • \n\t
  • 1 <= m + n <= 2000
  • \n\t
  • -106 <= nums1[i], nums2[i] <= 106
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[1,3] --arg2=[2]", + "--arg1=[1,2] --arg2=[3,4]", + "--arg1=[] --arg2=[1]" + ], + "sample_test_results": [ + "2", + "2.5", + "1" + ], + "hidden_test_cases": [ + "--arg1=[1] --arg2=[1]", + "--arg1=[1,2,3,4,5] --arg2=[]", + "--arg1=[] --arg2=[1,2,3,4,5]", + "--arg1=[1] --arg2=[2,3,4,5,6]", + "--arg1=[1,2,3,4,5] --arg2=[6]", + "--arg1=[1,3,5,7] --arg2=[2,4,6,8]", + "--arg1=[1,1,1,1] --arg2=[1,1,1,1]", + "--arg1=[-1,0,1] --arg2=[-2,2]", + "--arg1=[10000] --arg2=[-10000]", + "--arg1=[1,2] --arg2=[1,2,3]" + ], + "hidden_test_results": [ + "1.0", + "3", + "3", + "3.5", + "3.5", + "4.5", + "1.0", + "0", + "0.0", + "2" + ], + "boilerplate": { + "python": "class Solution:\n def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:\n ", + "java": "class Solution {\n public double findMedianSortedArrays(int[] nums1, int[] nums2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n double findMedianSortedArrays(vector& nums1, vector& nums2) {\n \n }\n};" + }, + "compare_func": { + "python": "return abs(float(result) - float(expected)) < 0.00001", + "java": "return Math.abs(Double.parseDouble(result) - Double.parseDouble(expected)) < 0.00001;", + "cpp": "return std::abs(std::stof(result) - std::stof(expected)) < 0.00001;" + }, + "explanation": "https://www.youtube.com/watch?v=q6IEA26hvXc&pp=ygUkTmVldENvZGUgTWVkaWFuIG9mIFR3byBTb3J0ZWQgQXJyYXlz", + "method_name": "findMedianSortedArrays" + }, + { + "title": "First Missing Positive", + "source": "https://leetcode.com/problems/first-missing-positive/", + "description": "

Given an unsorted integer array nums. Return the smallest positive integer that is not present in nums.

\n\n

You must implement an algorithm that runs in O(n) time and uses O(1) auxiliary space.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,2,0]\nOutput: 3\nExplanation: The numbers in the range [1,2] are all in the array.\n
\n\n

Example 2:

\n\n
\nInput: nums = [3,4,-1,1]\nOutput: 2\nExplanation: 1 is in the array but 2 is missing.\n
\n\n

Example 3:

\n\n
\nInput: nums = [7,8,9,11,12]\nOutput: 1\nExplanation: The smallest positive integer 1 is missing.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -231 <= nums[i] <= 231 - 1
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[1,2,0]", + "--arg1=[3,4,-1,1]", + "--arg1=[7,8,9,11,12]" + ], + "sample_test_results": [ + "3", + "2", + "1" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,1]", + "--arg1=[-1,-2,-3]", + "--arg1=[1,2,3,4,5]", + "--arg1=[2]", + "--arg1=[1,2,4]", + "--arg1=[1,1,1,1,1]", + "--arg1=[2147483647]", + "--arg1=[-2147483648]", + "--arg1=[1,2,3,3,3]" + ], + "hidden_test_results": [ + "2", + "2", + "1", + "6", + "1", + "3", + "2", + "1", + "1", + "4" + ], + "boilerplate": { + "python": "class Solution:\n def firstMissingPositive(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int firstMissingPositive(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int firstMissingPositive(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=8g78yfzMlao&pp=ygUfTmVldENvZGUgRmlyc3QgTWlzc2luZyBQb3NpdGl2ZQ%3D%3D", + "method_name": "firstMissingPositive" + }, + { + "title": "Permutation Sequence", + "source": "https://leetcode.com/problems/permutation-sequence/", + "description": "

The set [1, 2, 3, ..., n] contains a total of n! unique permutations.

\n\n

By listing and labeling all of the permutations in order, we get the following sequence for n = 3:

\n\n
    \n\t
  1. "123"
  2. \n\t
  3. "132"
  4. \n\t
  5. "213"
  6. \n\t
  7. "231"
  8. \n\t
  9. "312"
  10. \n\t
  11. "321"
  12. \n
\n\n

Given n and k, return the kth permutation sequence.

\n\n

 

\n

Example 1:

\n
Input: n = 3, k = 3\nOutput: \"213\"\n

Example 2:

\n
Input: n = 4, k = 9\nOutput: \"2314\"\n

Example 3:

\n
Input: n = 3, k = 1\nOutput: \"123\"\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= n <= 9
  • \n\t
  • 1 <= k <= n!
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=3 --arg2=3", + "--arg1=4 --arg2=9", + "--arg1=3 --arg2=1" + ], + "sample_test_results": [ + "'213'", + "'2314'", + "'123'" + ], + "hidden_test_cases": [ + "--arg1=1 --arg2=1", + "--arg1=2 --arg2=1", + "--arg1=2 --arg2=2", + "--arg1=3 --arg2=6", + "--arg1=4 --arg2=1", + "--arg1=4 --arg2=24", + "--arg1=5 --arg2=5", + "--arg1=6 --arg2=720", + "--arg1=7 --arg2=1", + "--arg1=8 --arg2=40320" + ], + "hidden_test_results": [ + "'1'", + "'12'", + "'21'", + "'321'", + "'1234'", + "'4321'", + "'12534'", + "'654321'", + "'1234567'", + "'87654321'" + ], + "boilerplate": { + "python": "class Solution:\n def getPermutation(self, n: int, k: int) -> str:\n ", + "java": "class Solution {\n public String getPermutation(int n, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string getPermutation(int n, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try {\n Object expectedValue = engine.eval(expected);\n return result.equals(expectedValue);\n} catch (ScriptException e) {\n // Handle exception, maybe log it or return false\n return false;\n}", + "cpp": "#include \n#include \n#include \n\nbool compareFunction(const std::string& result, const std::string& expected) {\n std::istringstream iss(expected);\n int n;\n iss >> n; // Assuming the expected value is an integer for direct evaluation after comparison\n \n return std::to_string(n) == result; // Assuming result should also be a string representation of an integer\n}" + }, + "explanation": "https://www.youtube.com/watch?v=W9SIlE2jhBQ&pp=ygUdTmVldENvZGUgUGVybXV0YXRpb24gU2VxdWVuY2U%3D", + "method_name": "getPermutation" + }, + { + "title": "Text Justification", + "source": "https://leetcode.com/problems/text-justification/", + "description": "

Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified.

\n\n

You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces ' ' when necessary so that each line has exactly maxWidth characters.

\n\n

Extra spaces between words should be distributed as evenly as possible. If the number of spaces on a line does not divide evenly between words, the empty slots on the left will be assigned more spaces than the slots on the right.

\n\n

For the last line of text, it should be left-justified, and no extra space is inserted between words.

\n\n

Note:

\n\n
    \n\t
  • A word is defined as a character sequence consisting of non-space characters only.
  • \n\t
  • Each word's length is guaranteed to be greater than 0 and not exceed maxWidth.
  • \n\t
  • The input array words contains at least one word.
  • \n
\n\n

 

\n

Example 1:

\n\n
\nInput: words = ["This", "is", "an", "example", "of", "text", "justification."], maxWidth = 16\nOutput:\n[\n   "This    is    an",\n   "example  of text",\n   "justification.  "\n]
\n\n

Example 2:

\n\n
\nInput: words = ["What","must","be","acknowledgment","shall","be"], maxWidth = 16\nOutput:\n[\n  "What   must   be",\n  "acknowledgment  ",\n  "shall be        "\n]\nExplanation: Note that the last line is "shall be    " instead of "shall     be", because the last line must be left-justified instead of fully-justified.\nNote that the second line is also left-justified because it contains only one word.
\n\n

Example 3:

\n\n
\nInput: words = ["Science","is","what","we","understand","well","enough","to","explain","to","a","computer.","Art","is","everything","else","we","do"], maxWidth = 20\nOutput:\n[\n  "Science  is  what we",\n  "understand      well",\n  "enough to explain to",\n  "a  computer.  Art is",\n  "everything  else  we",\n  "do                  "\n]
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= words.length <= 300
  • \n\t
  • 1 <= words[i].length <= 20
  • \n\t
  • words[i] consists of only English letters and symbols.
  • \n\t
  • 1 <= maxWidth <= 100
  • \n\t
  • words[i].length <= maxWidth
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=['This','is','an','example','of','text','justification.'] --arg2=16", + "--arg1=['What','must','be','acknowledgment','shall','be'] --arg2=16", + "--arg1=['Science','is','what','we','understand','well','enough','to','explain','to','a','computer.','Art','is','everything','else','we','do'] --arg2=20" + ], + "sample_test_results": [ + "['This is an','example of text','justification. ']", + "['What must be','acknowledgment ','shall be ']", + "['Science is what we','understand well','enough to explain to','a computer. Art is','everything else we','do ']" + ], + "hidden_test_cases": [ + "--arg1=['a'] --arg2=1", + "--arg1=['a','b','c'] --arg2=1", + "--arg1=['hello'] --arg2=10", + "--arg1=['a','b','c','d'] --arg2=3", + "--arg1=['This','is','a','test'] --arg2=4", + "--arg1=['ab','cd','ef'] --arg2=10", + "--arg1=['a','b'] --arg2=4", + "--arg1=['word'] --arg2=5", + "--arg1=['a','b','c','d','e'] --arg2=3", + "--arg1=['Hello','World'] --arg2=12" + ], + "hidden_test_results": [ + "['a']", + "['a','b','c']", + "['hello ']", + "['a b','c d']", + "['This','is a','test']", + "['ab cd ef ']", + "['a b ']", + "['word ']", + "['a b','c d','e ']", + "['Hello World ']" + ], + "boilerplate": { + "python": "class Solution:\n def fullJustify(self, words: List[str], maxWidth: int) -> List[str]:\n ", + "java": "class Solution {\n public List fullJustify(String[] words, int maxWidth) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector fullJustify(vector& words, int maxWidth) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "return result.equals(eval(expected));", + "cpp": "#include \n#include \n\nbool compareFunction(const std::string& result, const std::string& expected) {\n std::stringstream ss;\n ss << expected; \n\n // Ensure that the expected string represents a valid number\n double evalExpected;\n if(!(ss >> evalExpected)) {\n return false; // Invalid expected string\n }\n\n double evalResult;\n std::stringstream resultStream(result);\n if(!(resultStream >> evalResult)) {\n return false; // Invalid result string\n }\n\n return evalResult == evalExpected;\n}" + }, + "explanation": "https://www.youtube.com/watch?v=TzMl4Z7pVh8&pp=ygUbTmVldENvZGUgVGV4dCBKdXN0aWZpY2F0aW9u", + "method_name": "fullJustify" + }, + { + "title": "Minimum Window Substring", + "source": "https://leetcode.com/problems/minimum-window-substring/", + "description": "

Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string "".

\n\n

The testcases will be generated such that the answer is unique.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "ADOBECODEBANC", t = "ABC"\nOutput: "BANC"\nExplanation: The minimum window substring "BANC" includes 'A', 'B', and 'C' from string t.\n
\n\n

Example 2:

\n\n
\nInput: s = "a", t = "a"\nOutput: "a"\nExplanation: The entire string s is the minimum window.\n
\n\n

Example 3:

\n\n
\nInput: s = "a", t = "aa"\nOutput: ""\nExplanation: Both 'a's from t must be included in the window.\nSince the largest window of s only has one 'a', return empty string.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • m == s.length
  • \n\t
  • n == t.length
  • \n\t
  • 1 <= m, n <= 105
  • \n\t
  • s and t consist of uppercase and lowercase English letters.
  • \n
\n\n

 

\n

Follow up: Could you find an algorithm that runs in O(m + n) time?

\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1='ADOBECODEBANC' --arg2='ABC'", + "--arg1='a' --arg2='a'", + "--arg1='a' --arg2='aa'" + ], + "sample_test_results": [ + "'BANC'", + "'a'", + "''" + ], + "hidden_test_cases": [ + "--arg1='a' --arg2='b'", + "--arg1='ab' --arg2='a'", + "--arg1='ABCDEFG' --arg2='AC'", + "--arg1='aaaaaaa' --arg2='a'", + "--arg1='ADOBECODEBANC' --arg2='ABBC'", + "--arg1='this is a test string' --arg2='tist'", + "--arg1='ADOBECODEBANC' --arg2='ABCDE'", + "--arg1='aaabbaaba' --arg2='abb'", + "--arg1='abc' --arg2='cba'", + "--arg1='bba' --arg2='ab'" + ], + "hidden_test_results": [ + "''", + "'a'", + "'ABC'", + "'a'", + "'BECODEBA'", + "'t stri'", + "'ADOBEC'", + "'abb'", + "'abc'", + "'ba'" + ], + "boilerplate": { + "python": "class Solution:\n def minWindow(self, s: str, t: str) -> str:\n ", + "java": "class Solution {\n public String minWindow(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n string minWindow(string s, string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try {\n Object evaluatedExpected = evaluate(expected);\n return result.equals(evaluatedExpected);\n} catch (ScriptException e) {\n e.printStackTrace();\n return false;\n}", + "cpp": "#include \n#include \n#include \n\nbool compareFunction(const std::string& result, const std::string& expected) {\n std::istringstream expectedStream(expected);\n double expectedValue;\n if (!(expectedStream >> expectedValue)) {\n // Handling the case if expected cannot be evaluated as a double\n return false;\n }\n\n std::istringstream resultStream(result);\n double resultValue;\n if (!(resultStream >> resultValue)) {\n // Handling the case if result cannot be evaluated as a double\n return false;\n }\n\n // Checking if the result and evaluated expected value are approximately equal for floating point comparisons\n return std::fabs(resultValue - expectedValue) < 1e-9; // Adjust the tolerance as needed\n}" + }, + "explanation": "https://www.youtube.com/watch?v=jSto0O4AJbM&pp=ygUhTmVldENvZGUgTWluaW11bSBXaW5kb3cgU3Vic3RyaW5n", + "method_name": "minWindow" + }, + { + "title": "Largest Rectangle in Histogram", + "source": "https://leetcode.com/problems/largest-rectangle-in-histogram/", + "description": "

Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: heights = [2,1,5,6,2,3]\nOutput: 10\nExplanation: The above is a histogram where width of each bar is 1.\nThe largest rectangle is shown in the red area, which has an area = 10 units.\n
\n\n

Example 2:

\n\"\"\n
\nInput: heights = [2,4]\nOutput: 4\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= heights.length <= 105
  • \n\t
  • 0 <= heights[i] <= 104
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[2,1,5,6,2,3]", + "--arg1=[2,4]" + ], + "sample_test_results": [ + "10", + "4" + ], + "hidden_test_cases": [ + "--arg1=[2,1,2]", + "--arg1=[1]", + "--arg1=[0]", + "--arg1=[1,1,1,1]", + "--arg1=[2,1,2,3,1]", + "--arg1=[5,4,3,2,1]", + "--arg1=[1,2,3,4,5]", + "--arg1=[2,2,2,2]", + "--arg1=[1,2,3,4,5,4,3,2,1]", + "--arg1=[0,0,0]" + ], + "hidden_test_results": [ + "3", + "1", + "0", + "4", + "5", + "9", + "9", + "8", + "15", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def largestRectangleArea(self, heights: List[int]) -> int:\n ", + "java": "class Solution {\n public int largestRectangleArea(int[] heights) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int largestRectangleArea(vector& heights) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=zx5Sw9130L0&pp=ygUnTmVldENvZGUgTGFyZ2VzdCBSZWN0YW5nbGUgaW4gSGlzdG9ncmFt", + "method_name": "largestRectangleArea" + }, + { + "title": "Maximal Rectangle", + "source": "https://leetcode.com/problems/maximal-rectangle/", + "description": "

Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]\nOutput: 6\nExplanation: The maximal rectangle is shown in the above picture.\n
\n\n

Example 2:

\n\n
\nInput: matrix = [["0"]]\nOutput: 0\n
\n\n

Example 3:

\n\n
\nInput: matrix = [["1"]]\nOutput: 1\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • rows == matrix.length
  • \n\t
  • cols == matrix[i].length
  • \n\t
  • 1 <= row, cols <= 200
  • \n\t
  • matrix[i][j] is '0' or '1'.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[[\"1\",\"0\",\"1\",\"0\",\"0\"],[\"1\",\"0\",\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\",\"1\",\"1\"],[\"1\",\"0\",\"0\",\"1\",\"0\"]]", + "--arg1=[[\"0\"]]", + "--arg1=[[\"1\"]]" + ], + "sample_test_results": [ + "6", + "0", + "1" + ], + "hidden_test_cases": [ + "--arg1=[[\"1\",\"1\"],[\"1\",\"1\"]]", + "--arg1=[[\"0\",\"0\"],[\"0\",\"0\"]]", + "--arg1=[[\"1\"],[\"1\"]]", + "--arg1=[[\"1\",\"0\"],[\"1\",\"0\"]]", + "--arg1=[[\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\"],[\"1\",\"1\",\"1\"]]", + "--arg1=[[\"1\",\"0\",\"1\"],[\"0\",\"1\",\"0\"],[\"1\",\"0\",\"1\"]]", + "--arg1=[[\"0\",\"1\"],[\"1\",\"0\"]]", + "--arg1=[[\"1\",\"1\",\"1\"],[\"1\",\"0\",\"1\"],[\"1\",\"1\",\"1\"]]", + "--arg1=[[\"1\"],[\"1\"],[\"1\"]]", + "--arg1=[[\"0\",\"0\",\"0\"],[\"0\",\"0\",\"0\"]]" + ], + "hidden_test_results": [ + "4", + "0", + "2", + "2", + "9", + "1", + "1", + "3", + "3", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def maximalRectangle(self, matrix: List[List[str]]) -> int:\n ", + "java": "class Solution {\n public int maximalRectangle(char[][] matrix) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maximalRectangle(vector>& matrix) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=tOylVCugy9k&pp=ygUaTmVldENvZGUgTWF4aW1hbCBSZWN0YW5nbGU%3D", + "method_name": "maximalRectangle" + }, + { + "title": "Scramble String", + "source": "https://leetcode.com/problems/scramble-string/", + "description": "

We can scramble a string s to get a string t using the following algorithm:

\n\n
    \n\t
  1. If the length of the string is 1, stop.
  2. \n\t
  3. If the length of the string is > 1, do the following:\n\t
      \n\t\t
    • Split the string into two non-empty substrings at a random index, i.e., if the string is s, divide it to x and y where s = x + y.
    • \n\t\t
    • Randomly decide to swap the two substrings or to keep them in the same order. i.e., after this step, s may become s = x + y or s = y + x.
    • \n\t\t
    • Apply step 1 recursively on each of the two substrings x and y.
    • \n\t
    \n\t
  4. \n
\n\n

Given two strings s1 and s2 of the same length, return true if s2 is a scrambled string of s1, otherwise, return false.

\n\n

 

\n

Example 1:

\n\n
\nInput: s1 = "great", s2 = "rgeat"\nOutput: true\nExplanation: One possible scenario applied on s1 is:\n"great" --> "gr/eat" // divide at random index.\n"gr/eat" --> "gr/eat" // random decision is not to swap the two substrings and keep them in order.\n"gr/eat" --> "g/r / e/at" // apply the same algorithm recursively on both substrings. divide at random index each of them.\n"g/r / e/at" --> "r/g / e/at" // random decision was to swap the first substring and to keep the second substring in the same order.\n"r/g / e/at" --> "r/g / e/ a/t" // again apply the algorithm recursively, divide "at" to "a/t".\n"r/g / e/ a/t" --> "r/g / e/ a/t" // random decision is to keep both substrings in the same order.\nThe algorithm stops now, and the result string is "rgeat" which is s2.\nAs one possible scenario led s1 to be scrambled to s2, we return true.\n
\n\n

Example 2:

\n\n
\nInput: s1 = "abcde", s2 = "caebd"\nOutput: false\n
\n\n

Example 3:

\n\n
\nInput: s1 = "a", s2 = "a"\nOutput: true\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • s1.length == s2.length
  • \n\t
  • 1 <= s1.length <= 30
  • \n\t
  • s1 and s2 consist of lowercase English letters.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=\"great\" --arg2=\"rgeat\"", + "--arg1=\"abcde\" --arg2=\"caebd\"", + "--arg1=\"a\" --arg2=\"a\"" + ], + "sample_test_results": [ + "true", + "false", + "true" + ], + "hidden_test_cases": [ + "--arg1=\"ab\" --arg2=\"ba\"", + "--arg1=\"abc\" --arg2=\"bac\"", + "--arg1=\"abc\" --arg2=\"cab\"", + "--arg1=\"abb\" --arg2=\"bba\"", + "--arg1=\"aaab\" --arg2=\"abaa\"", + "--arg1=\"abcd\" --arg2=\"bdac\"", + "--arg1=\"abcde\" --arg2=\"badce\"", + "--arg1=\"abc\" --arg2=\"acb\"", + "--arg1=\"abcdbdacbdac\" --arg2=\"bdacabcdbdac\"", + "--arg1=\"xstjzkfpkggnhjzkpfjoguxvkbuopi\" --arg2=\"xbouipkvxugojfpkzjhnggkpfzjts\"" + ], + "hidden_test_results": [ + "true", + "true", + "true", + "true", + "true", + "false", + "true", + "true", + "true", + "false" + ], + "boilerplate": { + "python": "class Solution:\n def isScramble(self, s1: str, s2: str) -> bool:\n ", + "java": "class Solution {\n public boolean isScramble(String s1, String s2) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n bool isScramble(string s1, string s2) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result).lower() == expected.lower()", + "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", + "cpp": "return tolower(result) == tolower(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=MDmZm_aVDF8&pp=ygUYTmVldENvZGUgU2NyYW1ibGUgU3RyaW5n", + "method_name": "isScramble" + }, + { + "title": "Distinct Subsequences", + "source": "https://leetcode.com/problems/distinct-subsequences/", + "description": "

Given two strings s and t, return the number of distinct subsequences of s which equals t.

\n\n

The test cases are generated so that the answer fits on a 32-bit signed integer.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "rabbbit", t = "rabbit"\nOutput: 3\nExplanation:\nAs shown below, there are 3 ways you can generate "rabbit" from s.\nrabbbit\nrabbbit\nrabbbit\n
\n\n

Example 2:

\n\n
\nInput: s = "babgbag", t = "bag"\nOutput: 5\nExplanation:\nAs shown below, there are 5 ways you can generate "bag" from s.\nbabgbag\nbabgbag\nbabgbag\nbabgbag\nbabgbag
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length, t.length <= 1000
  • \n\t
  • s and t consist of English letters.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=\"rabbbit\" --arg2=\"rabbit\"", + "--arg1=\"babgbag\" --arg2=\"bag\"" + ], + "sample_test_results": [ + "3", + "5" + ], + "hidden_test_cases": [ + "--arg1=\"a\" --arg2=\"a\"", + "--arg1=\"aa\" --arg2=\"a\"", + "--arg1=\"aaa\" --arg2=\"aa\"", + "--arg1=\"abc\" --arg2=\"abc\"", + "--arg1=\"abcde\" --arg2=\"ace\"", + "--arg1=\"aabb\" --arg2=\"ab\"", + "--arg1=\"xslledayhxhadmctrliaxqpokyezcfhzaskeykchkmhpyjipxtsuljkwkovmvelvwxzwieeuqnjozrfwmzsylcwvsthnxujvrkszqwtglewkycikdaiocglwzukwovsghkhyidevhbgffoqkpabthmqihcfxxzdejletqjoxmwftlxfcxgxgvpperwbqvhxgsbbkmphyomtbjzdjhcrcsggleiczpbfjcgtpycpmrjnckslrwduqlccqmgrdhxolfjafmsrfdghnatexyanldrdpxvvgujsztuffoymrfteholgonuaqndinadtumnuhkboyzaqguwqijwxxszngextfcozpetyownmyneehdwqmtpjloztswmzzdzqhuoxrblppqvyvsqhnhryvqsqogpnlqfulurexdtovqpqkfxxnqykgscxaskmksivoazlducanrqxynxlgvwonalpsyddqmaemcrrwvrjmjjnygyebwtqxehrclwsxzylbqexnxjcgspeynlbmetlkacnnbhmaizbadynajpibepbuacggxrqavfnwpcwxbzxfymhjcslghmajrirqzjqxpgtgisfjreqrqabssobbadmtmdknmakdigjqyqcruujlwmfoagrckdwyiglviyyrekjealvvigiesnvuumxgsveadrxlpwetioxibtdjblowblqvzpbrmhupyrdophjxvhgzclidzybajuxllacyhyphssvhcffxonysahvzhzbttyeeyiefhunbokiqrpqfcoxdxvefugapeevdoakxwzykmhbdytjbhigffkmbqmqxsoaiomgmmgwapzdosorcxxhejvgajyzdmzlcntqbapbpofdjtulstuzdrffafedufqwsknumcxbschdybosxkrabyfdejgyozwillcxpcaiehlelczioskqtptzaczobvyojdlyflilvwqgyrqmjaeepydrcchfyftjighntqzoo\" --arg2=\"rwmimatmhydhbujebqehjprarwfkoebcxxqfktayaaeheys\"", + "--arg1=\"aaaaaaaaaa\" --arg2=\"aaaaaaa\"", + "--arg1=\"abcdef\" --arg2=\"xyz\"", + "--arg1=\"wbyhqihmwwux\" --arg2=\"byhwu\"" + ], + "hidden_test_results": [ + "1", + "2", + "3", + "1", + "1", + "4", + "1456742400", + "120", + "0", + "4" + ], + "boilerplate": { + "python": "class Solution:\n def numDistinct(self, s: str, t: str) -> int:\n ", + "java": "class Solution {\n public int numDistinct(String s, String t) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int numDistinct(string s, string t) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=-RDzMJ33nx8&pp=ygUeTmVldENvZGUgRGlzdGluY3QgU3Vic2VxdWVuY2Vz", + "method_name": "numDistinct" + }, + { + "title": "Best Time to Buy and Sell Stock III", + "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/", + "description": "

You are given an array prices where prices[i] is the price of a given stock on the ith day.

\n\n

Find the maximum profit you can achieve. You may complete at most two transactions.

\n\n

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

\n\n

 

\n

Example 1:

\n\n
\nInput: prices = [3,3,5,0,0,3,1,4]\nOutput: 6\nExplanation: Buy on day 4 (price = 0) and sell on day 6 (price = 3), profit = 3-0 = 3.\nThen buy on day 7 (price = 1) and sell on day 8 (price = 4), profit = 4-1 = 3.
\n\n

Example 2:

\n\n
\nInput: prices = [1,2,3,4,5]\nOutput: 4\nExplanation: Buy on day 1 (price = 1) and sell on day 5 (price = 5), profit = 5-1 = 4.\nNote that you cannot buy on day 1, buy on day 2 and sell them later, as you are engaging multiple transactions at the same time. You must sell before buying again.\n
\n\n

Example 3:

\n\n
\nInput: prices = [7,6,4,3,1]\nOutput: 0\nExplanation: In this case, no transaction is done, i.e. max profit = 0.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= prices.length <= 105
  • \n\t
  • 0 <= prices[i] <= 105
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[3,3,5,0,0,3,1,4]", + "--arg1=[1,2,3,4,5]", + "--arg1=[7,6,4,3,1]" + ], + "sample_test_results": [ + "6", + "4", + "0" + ], + "hidden_test_cases": [ + "--arg1=[1]", + "--arg1=[1,2]", + "--arg1=[2,1]", + "--arg1=[1,2,4,2,5,7,2,4,9,0]", + "--arg1=[0,0,0,0]", + "--arg1=[1,2,3,4,5,4,3,2,1]", + "--arg1=[3,2,6,5,0,3]", + "--arg1=[1,4,5,7,6,3,2,9]", + "--arg1=[8,3,6,2,8,8,8,4,2,0,7,2,9,4,9]", + "--arg1=[1,2,4,2,5,7,2,4,9,0,9]" + ], + "hidden_test_results": [ + "0", + "1", + "0", + "13", + "0", + "4", + "7", + "13", + "15", + "17" + ], + "boilerplate": { + "python": "class Solution:\n def maxProfit(self, prices: List[int]) -> int:\n ", + "java": "class Solution {\n public int maxProfit(int[] prices) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxProfit(vector& prices) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=37s1_xBiqH0&pp=ygUsTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJSUk%3D", + "method_name": "maxProfit" + }, + { + "title": "Word Ladder", + "source": "https://leetcode.com/problems/word-ladder/", + "description": "

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that:

\n\n
    \n\t
  • Every adjacent pair of words differs by a single letter.
  • \n\t
  • Every si for 1 <= i <= k is in wordList. Note that beginWord does not need to be in wordList.
  • \n\t
  • sk == endWord
  • \n
\n\n

Given two words, beginWord and endWord, and a dictionary wordList, return the number of words in the shortest transformation sequence from beginWord to endWord, or 0 if no such sequence exists.

\n\n

 

\n

Example 1:

\n\n
\nInput: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]\nOutput: 5\nExplanation: One shortest transformation sequence is "hit" -> "hot" -> "dot" -> "dog" -> cog", which is 5 words long.\n
\n\n

Example 2:

\n\n
\nInput: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"]\nOutput: 0\nExplanation: The endWord "cog" is not in wordList, therefore there is no valid transformation sequence.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= beginWord.length <= 10
  • \n\t
  • endWord.length == beginWord.length
  • \n\t
  • 1 <= wordList.length <= 5000
  • \n\t
  • wordList[i].length == beginWord.length
  • \n\t
  • beginWord, endWord, and wordList[i] consist of lowercase English letters.
  • \n\t
  • beginWord != endWord
  • \n\t
  • All the words in wordList are unique.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1='hit' --arg2='cog' --arg3=['hot','dot','dog','lot','log','cog']", + "--arg1='hit' --arg2='cog' --arg3=['hot','dot','dog','lot','log']", + "--arg1='lost' --arg2='cost' --arg3=['most','cost','lost']" + ], + "sample_test_results": [ + "5", + "0", + "2" + ], + "hidden_test_cases": [ + "--arg1='hit' --arg2='dog' --arg3=['hot','dot','dog']", + "--arg1='cat' --arg2='rat' --arg3=['hat','rat','cat']", + "--arg1='a' --arg2='c' --arg3=['a','b','c']", + "--arg1='red' --arg2='tax' --arg3=['ted','tex','red','tax','tad']", + "--arg1='log' --arg2='dog' --arg3=['fog','fig','dig','dog','log']", + "--arg1='abc' --arg2='def' --arg3=['abf','acf','aef','def']", + "--arg1='hot' --arg2='dog' --arg3=['hot','dog']", + "--arg1='hit' --arg2='cog' --arg3=[]", + "--arg1='cat' --arg2='cat' --arg3=['cat']", + "--arg1='hit' --arg2='hat' --arg3=['hat','hot']" + ], + "hidden_test_results": [ + "4", + "2", + "2", + "4", + "2", + "4", + "0", + "0", + "2", + "2" + ], + "boilerplate": { + "python": "class Solution:\n def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:\n ", + "java": "class Solution {\n public int ladderLength(String beginWord, String endWord, List \nwordList) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int ladderLength(string beginWord, string endWord, vector& \nwordList) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=h9iTnkgv05E&pp=ygUUTmVldENvZGUgV29yZCBMYWRkZXI%3D", + "method_name": "ladderLength" + }, + { + "title": "Candy", + "source": "https://leetcode.com/problems/candy/", + "description": "

There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings.

\n\n

You are giving candies to these children subjected to the following requirements:

\n\n
    \n\t
  • Each child must have at least one candy.
  • \n\t
  • Children with a higher rating get more candies than their neighbors.
  • \n
\n\n

Return the minimum number of candies you need to have to distribute the candies to the children.

\n\n

 

\n

Example 1:

\n\n
\nInput: ratings = [1,0,2]\nOutput: 5\nExplanation: You can allocate to the first, second and third child with 2, 1, 2 candies respectively.\n
\n\n

Example 2:

\n\n
\nInput: ratings = [1,2,2]\nOutput: 4\nExplanation: You can allocate to the first, second and third child with 1, 2, 1 candies respectively.\nThe third child gets 1 candy because it satisfies the above two conditions.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • n == ratings.length
  • \n\t
  • 1 <= n <= 2 * 104
  • \n\t
  • 0 <= ratings[i] <= 2 * 104
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[1,0,2]", + "--arg1=[1,2,2]", + "--arg1=[1,3,2,2,1]" + ], + "sample_test_results": [ + "5", + "4", + "7" + ], + "hidden_test_cases": [ + "--arg1=[1,2,3,4,5]", + "--arg1=[5,4,3,2,1]", + "--arg1=[1,1,1,1,1]", + "--arg1=[1,3,4,5,2]", + "--arg1=[1,2,87,87,87,2,1]", + "--arg1=[1,2,2,3,1,2]", + "--arg1=[0]", + "--arg1=[1,0,1,0,1]", + "--arg1=[2,0,1,0,2]", + "--arg1=[1,6,10,8,7,3,2]" + ], + "hidden_test_results": [ + "15", + "15", + "5", + "11", + "13", + "9", + "1", + "8", + "8", + "18" + ], + "boilerplate": { + "python": "class Solution:\n def candy(self, ratings: List[int]) -> int:\n ", + "java": "class Solution {\n public int candy(int[] ratings) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int candy(vector& ratings) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=1IzCRCcK17A&pp=ygUOTmVldENvZGUgQ2FuZHk%3D", + "method_name": "candy" + }, + { + "title": "Word Break II", + "source": "https://leetcode.com/problems/word-break-ii/", + "description": "

Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order.

\n\n

Note that the same word in the dictionary may be reused multiple times in the segmentation.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "catsanddog", wordDict = ["cat","cats","and","sand","dog"]\nOutput: ["cats and dog","cat sand dog"]\n
\n\n

Example 2:

\n\n
\nInput: s = "pineapplepenapple", wordDict = ["apple","pen","applepen","pine","pineapple"]\nOutput: ["pine apple pen apple","pineapple pen apple","pine applepen apple"]\nExplanation: Note that you are allowed to reuse a dictionary word.\n
\n\n

Example 3:

\n\n
\nInput: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"]\nOutput: []\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 20
  • \n\t
  • 1 <= wordDict.length <= 1000
  • \n\t
  • 1 <= wordDict[i].length <= 10
  • \n\t
  • s and wordDict[i] consist of only lowercase English letters.
  • \n\t
  • All the strings of wordDict are unique.
  • \n\t
  • Input is generated in a way that the length of the answer doesn't exceed 105.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1='catsanddog' --arg2=['cat','cats','and','sand','dog']", + "--arg1='pineapplepenapple' --arg2=['apple','pen','applepen','pine','pineapple']", + "--arg1='catsandog' --arg2=['cats','dog','sand','and','cat']" + ], + "sample_test_results": [ + "['cat sand dog','cats and dog']", + "['pine apple pen apple','pine applepen apple','pineapple pen apple']", + "[]" + ], + "hidden_test_cases": [ + "--arg1='leetcode' --arg2=['leet','code']", + "--arg1='applepenapple' --arg2=['apple','pen']", + "--arg1='a' --arg2=['a']", + "--arg1='aaaa' --arg2=['a','aa','aaa']", + "--arg1='cars' --arg2=['car','ca','rs']", + "--arg1='bb' --arg2=['a','b','bbb']", + "--arg1='catsanddogs' --arg2=['cats','cat','and','sand','dog','dogs']", + "--arg1='ab' --arg2=['a','b']", + "--arg1='impossible' --arg2=['imp','possible']", + "--arg1='aaa' --arg2=['a','aa']" + ], + "hidden_test_results": [ + "['leet code']", + "['apple pen apple']", + "['a']", + "['a a a a','a a aa','a aa a','a aaa','aa a a','aa aa','aaa a']", + "['ca rs']", + "['b b']", + "['cat sand dogs','cats and dogs']", + "['a b']", + "[]", + "['a a a','a aa','aa a']" + ], + "boilerplate": { + "python": "class Solution:\n def wordBreak(self, s: str, wordDict: List[str]) -> List[str]:\n ", + "java": "class Solution {\n public List wordBreak(String s, List wordDict) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector wordBreak(string s, vector& wordDict) {\n \n }\n};" + }, + "compare_func": { + "python": "def normalize(s): return sorted([x.strip() for x in eval(s)])\n return normalize(str(result)) == normalize(expected)", + "java": "String normalize(String s) {\n return Arrays.stream(s.trim().substring(1, s.length() - 1).split(\",\"))\n .map(String::trim)\n .sorted()\n .collect(Collectors.joining(\",\"));\n}\n\nString resultNormalized = normalize(result.toString());\nString expectedNormalized = normalize(expected);\nreturn resultNormalized.equals(expectedNormalized);", + "cpp": "#include \n#include \n#include \n#include // for isspace\n\nstd::string trim(const std::string& str) {\n size_t first = str.find_first_not_of(\" \");\n if (first == std::string::npos) return \"\";\n size_t last = str.find_last_not_of(\" \");\n return str.substr(first, (last-first+1));\n}\n\nstd::vector normalize(const std::string& s) {\n std::vector elements;\n // Assuming the input format can be parsed as a comma-separated string\n size_t pos = 0;\n size_t comma_pos;\n while ((comma_pos = s.find(\",\", pos)) != std::string::npos) {\n elements.push_back(trim(s.substr(pos, comma_pos - pos)));\n pos = comma_pos + 1;\n }\n elements.push_back(trim(s.substr(pos)));\n std::sort(elements.begin(), elements.end());\n return elements;\n}\n\n// Comparison\nnormalize(std::to_string(result)) == normalize(expected)" + }, + "explanation": "https://www.youtube.com/watch?v=QgLKdluDo08&pp=ygUWTmVldENvZGUgV29yZCBCcmVhayBJSQ%3D%3D", + "method_name": "wordBreak" + }, + { + "title": "Find Minimum in Rotated Sorted Array II", + "source": "https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/", + "description": "

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become:

\n\n
    \n\t
  • [4,5,6,7,0,1,4] if it was rotated 4 times.
  • \n\t
  • [0,1,4,4,5,6,7] if it was rotated 7 times.
  • \n
\n\n

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

\n\n

Given the sorted rotated array nums that may contain duplicates, return the minimum element of this array.

\n\n

You must decrease the overall operation steps as much as possible.

\n\n

 

\n

Example 1:

\n
Input: nums = [1,3,5]\nOutput: 1\n

Example 2:

\n
Input: nums = [2,2,2,0,1]\nOutput: 0\n
\n

 

\n

Constraints:

\n\n
    \n\t
  • n == nums.length
  • \n\t
  • 1 <= n <= 5000
  • \n\t
  • -5000 <= nums[i] <= 5000
  • \n\t
  • nums is sorted and rotated between 1 and n times.
  • \n
\n\n

 

\n

Follow up: This problem is similar to Find Minimum in Rotated Sorted Array, but nums may contain duplicates. Would this affect the runtime complexity? How and why?

\n\n

 

\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[1,3,5]", + "--arg1=[2,2,2,0,1]", + "--arg1=[3,1,3]" + ], + "sample_test_results": [ + "1", + "0", + "1" + ], + "hidden_test_cases": [ + "--arg1=[1,1,1,1,1]", + "--arg1=[3,3,1,3]", + "--arg1=[2,2,2,0,1,2]", + "--arg1=[4,5,6,7,0,1,2]", + "--arg1=[1,1,1,0,1]", + "--arg1=[3,4,5,1,2]", + "--arg1=[5,1,2,3,4]", + "--arg1=[2,2,2,2,2,2]", + "--arg1=[3,1,1,1,1]", + "--arg1=[4,4,5,5,6,6,7,0]" + ], + "hidden_test_results": [ + "1", + "1", + "0", + "0", + "0", + "1", + "1", + "2", + "1", + "0" + ], + "boilerplate": { + "python": "class Solution:\n def findMin(self, nums: List[int]) -> int:\n ", + "java": "class Solution {\n public int findMin(int[] nums) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int findMin(vector& nums) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return String.valueOf(result).equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=oUnF7o88_Xc&pp=ygUwTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5IElJ", + "method_name": "findMin" + }, + { + "title": "Best Time to Buy and Sell Stock IV", + "source": "https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/", + "description": "

You are given an integer array prices where prices[i] is the price of a given stock on the ith day, and an integer k.

\n\n

Find the maximum profit you can achieve. You may complete at most k transactions: i.e. you may buy at most k times and sell at most k times.

\n\n

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

\n\n

 

\n

Example 1:

\n\n
\nInput: k = 2, prices = [2,4,1]\nOutput: 2\nExplanation: Buy on day 1 (price = 2) and sell on day 2 (price = 4), profit = 4-2 = 2.\n
\n\n

Example 2:

\n\n
\nInput: k = 2, prices = [3,2,6,5,0,3]\nOutput: 7\nExplanation: Buy on day 2 (price = 2) and sell on day 3 (price = 6), profit = 6-2 = 4. Then buy on day 5 (price = 0) and sell on day 6 (price = 3), profit = 3-0 = 3.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= k <= 100
  • \n\t
  • 1 <= prices.length <= 1000
  • \n\t
  • 0 <= prices[i] <= 1000
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=2 --arg2=[2,4,1]", + "--arg1=2 --arg2=[3,2,6,5,0,3]", + "--arg1=1 --arg2=[1,2]" + ], + "sample_test_results": [ + "2", + "7", + "1" + ], + "hidden_test_cases": [ + "--arg1=2 --arg2=[1,2,4,2,5,7,2,4,9,0]", + "--arg1=1 --arg2=[7,1,5,3,6,4]", + "--arg1=3 --arg2=[3,3,5,0,0,3,1,4]", + "--arg1=4 --arg2=[1,2,3,4,5]", + "--arg1=2 --arg2=[1,4,5,7,6,3,2,1]", + "--arg1=3 --arg2=[1]", + "--arg1=1 --arg2=[7,6,5,4,3,2]", + "--arg1=2 --arg2=[1,2,3,4,5,6]", + "--arg1=5 --arg2=[3,2,6,5,0,3,1,4]", + "--arg1=2 --arg2=[2,1,4,5,2,9,7]" + ], + "hidden_test_results": [ + "13", + "5", + "8", + "4", + "6", + "0", + "0", + "5", + "10", + "11" + ], + "boilerplate": { + "python": "class Solution:\n def maxProfit(self, k: int, prices: List[int]) -> int:\n ", + "java": "class Solution {\n public int maxProfit(int k, int[] prices) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int maxProfit(int k, vector& prices) {\n \n }\n};" + }, + "compare_func": { + "python": "return str(result) == expected", + "java": "return result.toString().equals(expected);", + "cpp": "return std::to_string(result) == expected;" + }, + "explanation": "https://www.youtube.com/watch?v=NshLjAWa03c&pp=ygUrTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJVg%3D%3D", + "method_name": "maxProfit" + }, + { + "title": "The Skyline Problem", + "source": "https://leetcode.com/problems/the-skyline-problem/", + "description": "

A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of all the buildings, return the skyline formed by these buildings collectively.

\n\n

The geometric information of each building is given in the array buildings where buildings[i] = [lefti, righti, heighti]:

\n\n
    \n\t
  • lefti is the x coordinate of the left edge of the ith building.
  • \n\t
  • righti is the x coordinate of the right edge of the ith building.
  • \n\t
  • heighti is the height of the ith building.
  • \n
\n\n

You may assume all buildings are perfect rectangles grounded on an absolutely flat surface at height 0.

\n\n

The skyline should be represented as a list of "key points" sorted by their x-coordinate in the form [[x1,y1],[x2,y2],...]. Each key point is the left endpoint of some horizontal segment in the skyline except the last point in the list, which always has a y-coordinate 0 and is used to mark the skyline's termination where the rightmost building ends. Any ground between the leftmost and rightmost buildings should be part of the skyline's contour.

\n\n

Note: There must be no consecutive horizontal lines of equal height in the output skyline. For instance, [...,[2 3],[4 5],[7 5],[11 5],[12 7],...] is not acceptable; the three lines of height 5 should be merged into one in the final output as such: [...,[2 3],[4 5],[12 7],...]

\n\n

 

\n

Example 1:

\n\"\"\n
\nInput: buildings = [[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]\nOutput: [[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]\nExplanation:\nFigure A shows the buildings of the input.\nFigure B shows the skyline formed by those buildings. The red points in figure B represent the key points in the output list.\n
\n\n

Example 2:

\n\n
\nInput: buildings = [[0,2,3],[2,5,3]]\nOutput: [[0,3],[5,0]]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= buildings.length <= 104
  • \n\t
  • 0 <= lefti < righti <= 231 - 1
  • \n\t
  • 1 <= heighti <= 231 - 1
  • \n\t
  • buildings is sorted by lefti in non-decreasing order.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]", + "--arg1=[[0,2,3],[2,5,3]]" + ], + "sample_test_results": [ + "[[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]", + "[[0,3],[5,0]]" + ], + "hidden_test_cases": [ + "--arg1=[[1,5,11],[2,7,6],[3,9,13],[12,16,7],[14,25,3],[19,22,18],[23,29,13],[24,28,4]]", + "--arg1=[[1,2,1],[1,2,2],[1,2,3]]", + "--arg1=[[1,10,10]]", + "--arg1=[[1,5,3],[2,4,4]]", + "--arg1=[[1,5,11],[2,3,13]]", + "--arg1=[[0,3,3],[1,5,3],[2,4,3]]", + "--arg1=[[2,4,70],[3,8,30],[6,100,41],[7,15,70],[10,30,102],[15,25,76],[60,80,91],[70,90,72],[85,120,59]]", + "--arg1=[[1,20,1],[1,21,2],[1,22,3]]", + "--arg1=[[0,5,7],[5,10,7],[5,10,12],[10,15,7],[15,20,7],[15,20,12],[20,25,7]]", + "--arg1=[[1,2,1]]" + ], + "hidden_test_results": [ + "[[1,11],[3,13],[9,0],[12,7],[16,3],[19,18],[22,3],[23,13],[29,0]]", + "[[1,3],[2,0]]", + "[[1,10],[10,0]]", + "[[1,3],[2,4],[4,3],[5,0]]", + "[[1,11],[2,13],[3,11],[5,0]]", + "[[0,3],[5,0]]", + "[[2,70],[4,30],[6,41],[7,70],[10,102],[30,41],[60,91],[80,72],[90,59],[120,0]]", + "[[1,3],[22,0]]", + "[[0,7],[5,12],[10,7],[15,12],[20,7],[25,0]]", + "[[1,1],[2,0]]" + ], + "boilerplate": { + "python": "class Solution:\n def getSkyline(self, buildings: List[List[int]]) -> List[List[int]]:\n ", + "java": "class Solution {\n public List> getSkyline(int[][] buildings) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector> getSkyline(vector>& buildings) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try {\n return Double.compare(result, Double.parseDouble(expected)) == 0;\n} catch (NumberFormatException e) {\n return result.equals(expected);\n}", + "cpp": "# include \n#include \n\nreturn std::system((\"echo \" + result + \" | \").c_str()) == std::system((\"echo \" + expected + \" | python\").c_str());" + }, + "explanation": "https://www.youtube.com/watch?v=XhzHXj7wrwo&pp=ygUcTmVldENvZGUgVGhlIFNreWxpbmUgUHJvYmxlbQ%3D%3D", + "method_name": "getSkyline" + }, + { + "title": "Basic Calculator", + "source": "https://leetcode.com/problems/basic-calculator/", + "description": "

Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation.

\n\n

Note: You are not allowed to use any built-in function which evaluates strings as mathematical expressions, such as eval().

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "1 + 1"\nOutput: 2\n
\n\n

Example 2:

\n\n
\nInput: s = " 2-1 + 2 "\nOutput: 3\n
\n\n

Example 3:

\n\n
\nInput: s = "(1+(4+5+2)-3)+(6+8)"\nOutput: 23\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 3 * 105
  • \n\t
  • s consists of digits, '+', '-', '(', ')', and ' '.
  • \n\t
  • s represents a valid expression.
  • \n\t
  • '+' is not used as a unary operation (i.e., "+1" and "+(2 + 3)" is invalid).
  • \n\t
  • '-' could be used as a unary operation (i.e., "-1" and "-(2 + 3)" is valid).
  • \n\t
  • There will be no two consecutive operators in the input.
  • \n\t
  • Every number and running calculation will fit in a signed 32-bit integer.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=\"1 + 1\"", + "--arg1=\" 2-1 + 2 \"", + "--arg1=\"(1+(4+5+2)-3)+(6+8)\"" + ], + "sample_test_results": [ + "2", + "3", + "23" + ], + "hidden_test_cases": [ + "--arg1=\"2147483647\"", + "--arg1=\"1 + (2 + 3)\"", + "--arg1=\"-(2 + 3)\"", + "--arg1=\"(1+(4+5+2)-3)+(6+8)\"", + "--arg1=\"2-4-(8+2-6+(8+4-(1)+8-10))\"", + "--arg1=\"(5-(1+(5)))\"", + "--arg1=\"(-2)+3\"", + "--arg1=\"1-(-2)\"", + "--arg1=\"1+2-3+(4+5-6)\"", + "--arg1=\"(7)-(0)+(4)\"" + ], + "hidden_test_results": [ + "2147483647", + "6", + "-5", + "23", + "-15", + "-1", + "1", + "3", + "3", + "11" + ], + "boilerplate": { + "python": "class Solution:\n def calculate(self, s: str) -> int:\n ", + "java": "class Solution {\n public int calculate(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n int calculate(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return int(result) == int(expected)", + "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", + "cpp": "return std::stoi(result) == std::stoi(expected);" + }, + "explanation": "https://www.youtube.com/watch?v=zsJ-J08Qgdk&pp=ygUZTmVldENvZGUgQmFzaWMgQ2FsY3VsYXRvcg%3D%3D", + "method_name": "calculate" + }, + { + "title": "Sliding Window Maximum", + "source": "https://leetcode.com/problems/sliding-window-maximum/", + "description": "

You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.

\n\n

Return the max sliding window.

\n\n

 

\n

Example 1:

\n\n
\nInput: nums = [1,3,-1,-3,5,3,6,7], k = 3\nOutput: [3,3,5,5,6,7]\nExplanation: \nWindow position                Max\n---------------               -----\n[1  3  -1] -3  5  3  6  7       3\n 1 [3  -1  -3] 5  3  6  7       3\n 1  3 [-1  -3  5] 3  6  7       5\n 1  3  -1 [-3  5  3] 6  7       5\n 1  3  -1  -3 [5  3  6] 7       6\n 1  3  -1  -3  5 [3  6  7]      7\n
\n\n

Example 2:

\n\n
\nInput: nums = [1], k = 1\nOutput: [1]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= nums.length <= 105
  • \n\t
  • -104 <= nums[i] <= 104
  • \n\t
  • 1 <= k <= nums.length
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=[1,3,-1,-3,5,3,6,7] --arg2=3", + "--arg1=[1] --arg2=1" + ], + "sample_test_results": [ + "[3,3,5,5,6,7]", + "[1]" + ], + "hidden_test_cases": [ + "--arg1=[1,3,1,2,0,5] --arg2=3", + "--arg1=[7,2,4] --arg2=2", + "--arg1=[1,-1] --arg2=1", + "--arg1=[1,2,3,4,5] --arg2=5", + "--arg1=[1,2,3,4,5,6] --arg2=1", + "--arg1=[-7,-8,7,5,7,1,6,0] --arg2=4", + "--arg1=[1,1,1,1] --arg2=2", + "--arg1=[4,2,0,-1,3,5] --arg2=3", + "--arg1=[-1,-2,-3,-4] --arg2=2", + "--arg1=[1,2,3,2,1] --arg2=3" + ], + "hidden_test_results": [ + "[3,3,2,5]", + "[7,4]", + "[1,-1]", + "[5]", + "[1,2,3,4,5,6]", + "[7,7,7,7,7]", + "[1,1,1]", + "[4,2,3,5]", + "[-1,-2,-3]", + "[3,3,3]" + ], + "boilerplate": { + "python": "class Solution:\n def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:\n ", + "java": "class Solution {\n public int[] maxSlidingWindow(int[] nums, int k) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector maxSlidingWindow(vector& nums, int k) {\n \n }\n};" + }, + "compare_func": { + "python": "return result == eval(expected)", + "java": "try {\n /* If the expected string is a valid expression, evaluate it */\n Object evaluatedExpected = javax.script.ScriptEngineManager()\n .getEngineByName(\"nashorn\")\n .eval(expected);\n return result.equals(evaluatedExpected);\n} catch (Exception e) {\n // In case of any exception during evaluation, return false;\n return false;\n}", + "cpp": "return result == std::atoi(expected.c_str());" + }, + "explanation": "https://www.youtube.com/watch?v=DfljaUwZsOk&pp=ygUfTmVldENvZGUgU2xpZGluZyBXaW5kb3cgTWF4aW11bQ%3D%3D", + "method_name": "maxSlidingWindow" + }, + { + "title": "Expression Add Operators", + "source": "https://leetcode.com/problems/expression-add-operators/", + "description": "

Given a string num that contains only digits and an integer target, return all possibilities to insert the binary operators '+', '-', and/or '*' between the digits of num so that the resultant expression evaluates to the target value.

\n\n

Note that operands in the returned expressions should not contain leading zeros.

\n\n

 

\n

Example 1:

\n\n
\nInput: num = "123", target = 6\nOutput: ["1*2*3","1+2+3"]\nExplanation: Both "1*2*3" and "1+2+3" evaluate to 6.\n
\n\n

Example 2:

\n\n
\nInput: num = "232", target = 8\nOutput: ["2*3+2","2+3*2"]\nExplanation: Both "2*3+2" and "2+3*2" evaluate to 8.\n
\n\n

Example 3:

\n\n
\nInput: num = "3456237490", target = 9191\nOutput: []\nExplanation: There are no expressions that can be created from "3456237490" to evaluate to 9191.\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= num.length <= 10
  • \n\t
  • num consists of only digits.
  • \n\t
  • -231 <= target <= 231 - 1
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=\"123\" --arg2=6", + "--arg1=\"232\" --arg2=8", + "--arg1=\"3456237490\" --arg2=9191" + ], + "sample_test_results": [ + "['1+2+3','1*2*3']", + "['2+3*2','2*3+2']", + "[]" + ], + "hidden_test_cases": [ + "--arg1=\"123\" --arg2=6", + "--arg1=\"232\" --arg2=8", + "--arg1=\"105\" --arg2=5", + "--arg1=\"00\" --arg2=0", + "--arg1=\"3456237490\" --arg2=9191", + "--arg1=\"1000000009\" --arg2=9", + "--arg1=\"2147483648\" --arg2=-2147483648", + "--arg1=\"999999999\" --arg2=999999999", + "--arg1=\"01\" --arg2=1", + "--arg1=\"1234\" --arg2=11" + ], + "hidden_test_results": [ + "['1+2+3','1*2*3']", + "['2+3*2','2*3+2']", + "['1*0+5','10-5']", + "['0+0','0-0','0*0']", + "[]", + "['1*0+0+0+0+0+0+0+0+9','1*0+0+0+0+0+0+0-0+9','1*0+0+0+0+0+0+0*0+9','1*0+0+0+0+0+0-0+0+9','1*0+0+0+0+0+0-0-0+9','1*0+0+0+0+0+0-0*0+9','1*0+0+0+0+0+0*0+0+9','1*0+0+0+0+0+0*0-0+9','1*0+0+0+0+0+0*0*0+9','1*0+0+0+0+0-0+0+0+9','1*0+0+0+0+0-0+0-0+9','1*0+0+0+0+0-0+0*0+9','1*0+0+0+0+0-0-0+0+9','1*0+0+0+0+0-0-0-0+9','1*0+0+0+0+0-0-0*0+9','1*0+0+0+0+0-0*0+0+9','1*0+0+0+0+0-0*0-0+9','1*0+0+0+0+0-0*0*0+9','1*0+0+0+0+0*0+0+0+9','1*0+0+0+0+0*0+0-0+9','1*0+0+0+0+0*0+0*0+9','1*0+0+0+0+0*0-0+0+9','1*0+0+0+0+0*0-0-0+9','1*0+0+0+0+0*0-0*0+9','1*0+0+0+0+0*0*0+0+9','1*0+0+0+0+0*0*0-0+9','1*0+0+0+0+0*0*0*0+9','1*0+0+0+0-0+0+0+0+9','1*0+0+0+0-0+0+0-0+9','1*0+0+0+0-0+0+0*0+9','1*0+0+0+0-0+0-0+0+9','1*0+0+0+0-0+0-0-0+9','1*0+0+0+0-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9','1*0+0+0-0*0+0+0+0+9','1*0+0+0-0*0+0+0-0+9','1*0+0+0-0*0+0+0*0+9','1*0+0+0-0*0+0-0+0+9','1*0+0+0-0*0+0-0-0+9','1*0+0+0-0*0+0-0*0+9','1*0+0+0-0*0+0*0+0+9','1*0+0+0-0*0+0*0-0+9','1*0+0+0-0*0+0*0*0+9','1*0+0+0-0*0-0+0+0+9','1*0+0+0-0*0-0+0-0+9','1*0+0+0-0*0-0+0*0+9','1*0+0+0-0*0-0-0+0+9','1*0+0+0-0*0-0-0-0+9','1*0+0+0-0*0-0-0*0+9','1*0+0+0-0*0-0*0+0+9','1*0+0+0-0*0-0*0-0+9','1*0+0+0-0*0-0*0*0+9','1*0+0+0-0*0*0+0+0+9','1*0+0+0-0*0*0+0-0+9','1*0+0+0-0*0*0+0*0+9','1*0+0+0-0*0*0-0+0+9','1*0+0+0-0*0*0-0-0+9','1*0+0+0-0*0*0-0*0+9','1*0+0+0-0*0*0*0+0+9','1*0+0+0-0*0*0*0-0+9','1*0+0+0-0*0*0*0*0+9','1*0+0+0*0+0+0+0+0+9','1*0+0+0*0+0+0+0-0+9','1*0+0+0*0+0+0+0*0+9','1*0+0+0*0+0+0-0+0+9','1*0+0+0*0+0+0-0-0+9','1*0+0+0*0+0+0-0*0+9','1*0+0+0*0+0+0*0+0+9','1*0+0+0*0+0+0*0-0+9','1*0+0+0*0+0+0*0*0+9','1*0+0+0*0+0-0+0+0+9','1*0+0+0*0+0-0+0-0+9','1*0+0+0*0+0-0+0*0+9','1*0+0+0*0+0-0-0+0+9','1*0+0+0*0+0-0-0-0+9','1*0+0+0*0+0-0-0*0+9','1*0+0+0*0+0-0*0+0+9','1*0+0+0*0+0-0*0-0+9','1*0+0+0*0+0-0*0*0+9','1*0+0+0*0+0*0+0+0+9','1*0+0+0*0+0*0+0-0+9','1*0+0+0*0+0*0+0*0+9','1*0+0+0*0+0*0-0+0+9','1*0+0+0*0+0*0-0-0+9','1*0+0+0*0+0*0-0*0+9','1*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9','1*0+0-0-0*0-0-0-0+9','1*0+0-0-0*0-0-0*0+9','1*0+0-0-0*0-0*0+0+9','1*0+0-0-0*0-0*0-0+9','1*0+0-0-0*0-0*0*0+9','1*0+0-0-0*0*0+0+0+9','1*0+0-0-0*0*0+0-0+9','1*0+0-0-0*0*0+0*0+9','1*0+0-0-0*0*0-0+0+9','1*0+0-0-0*0*0-0-0+9','1*0+0-0-0*0*0-0*0+9','1*0+0-0-0*0*0*0+0+9','1*0+0-0-0*0*0*0-0+9','1*0+0-0-0*0*0*0*0+9','1*0+0-0*0+0+0+0+0+9','1*0+0-0*0+0+0+0-0+9','1*0+0-0*0+0+0+0*0+9','1*0+0-0*0+0+0-0+0+9','1*0+0-0*0+0+0-0-0+9','1*0+0-0*0+0+0-0*0+9','1*0+0-0*0+0+0*0+0+9','1*0+0-0*0+0+0*0-0+9','1*0+0-0*0+0+0*0*0+9','1*0+0-0*0+0-0+0+0+9','1*0+0-0*0+0-0+0-0+9','1*0+0-0*0+0-0+0*0+9','1*0+0-0*0+0-0-0+0+9','1*0+0-0*0+0-0-0-0+9','1*0+0-0*0+0-0-0*0+9','1*0+0-0*0+0-0*0+0+9','1*0+0-0*0+0-0*0-0+9','1*0+0-0*0+0-0*0*0+9','1*0+0-0*0+0*0+0+0+9','1*0+0-0*0+0*0+0-0+9','1*0+0-0*0+0*0+0*0+9','1*0+0-0*0+0*0-0+0+9','1*0+0-0*0+0*0-0-0+9','1*0+0-0*0+0*0-0*0+9','1*0+0-0*0+0*0*0+0+9','1*0+0-0*0+0*0*0-0+9','1*0+0-0*0+0*0*0*0+9','1*0+0-0*0-0+0+0+0+9','1*0+0-0*0-0+0+0-0+9','1*0+0-0*0-0+0+0*0+9','1*0+0-0*0-0+0-0+0+9','1*0+0-0*0-0+0-0-0+9','1*0+0-0*0-0+0-0*0+9','1*0+0-0*0-0+0*0+0+9','1*0+0-0*0-0+0*0-0+9','1*0+0-0*0-0+0*0*0+9','1*0+0-0*0-0-0+0+0+9','1*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9','1*0+0*0-0*0*0*0*0+9','1*0+0*0*0+0+0+0+0+9','1*0+0*0*0+0+0+0-0+9','1*0+0*0*0+0+0+0*0+9','1*0+0*0*0+0+0-0+0+9','1*0+0*0*0+0+0-0-0+9','1*0+0*0*0+0+0-0*0+9','1*0+0*0*0+0+0*0+0+9','1*0+0*0*0+0+0*0-0+9','1*0+0*0*0+0+0*0*0+9','1*0+0*0*0+0-0+0+0+9','1*0+0*0*0+0-0+0-0+9','1*0+0*0*0+0-0+0*0+9','1*0+0*0*0+0-0-0+0+9','1*0+0*0*0+0-0-0-0+9','1*0+0*0*0+0-0-0*0+9','1*0+0*0*0+0-0*0+0+9','1*0+0*0*0+0-0*0-0+9','1*0+0*0*0+0-0*0*0+9','1*0+0*0*0+0*0+0+0+9','1*0+0*0*0+0*0+0-0+9','1*0+0*0*0+0*0+0*0+9','1*0+0*0*0+0*0-0+0+9','1*0+0*0*0+0*0-0-0+9','1*0+0*0*0+0*0-0*0+9','1*0+0*0*0+0*0*0+0+9','1*0+0*0*0+0*0*0-0+9','1*0+0*0*0+0*0*0*0+9','1*0+0*0*0-0+0+0+0+9','1*0+0*0*0-0+0+0-0+9','1*0+0*0*0-0+0+0*0+9','1*0+0*0*0-0+0-0+0+9','1*0+0*0*0-0+0-0-0+9','1*0+0*0*0-0+0-0*0+9','1*0+0*0*0-0+0*0+0+9','1*0+0*0*0-0+0*0-0+9','1*0+0*0*0-0+0*0*0+9','1*0+0*0*0-0-0+0+0+9','1*0+0*0*0-0-0+0-0+9','1*0+0*0*0-0-0+0*0+9','1*0+0*0*0-0-0-0+0+9','1*0+0*0*0-0-0-0-0+9','1*0+0*0*0-0-0-0*0+9','1*0+0*0*0-0-0*0+0+9','1*0+0*0*0-0-0*0-0+9','1*0+0*0*0-0-0*0*0+9','1*0+0*0*0-0*0+0+0+9','1*0+0*0*0-0*0+0-0+9','1*0+0*0*0-0*0+0*0+9','1*0+0*0*0-0*0-0+0+9','1*0+0*0*0-0*0-0-0+9','1*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9','1*0-0+0*0+0-0-0+0+9','1*0-0+0*0+0-0-0-0+9','1*0-0+0*0+0-0-0*0+9','1*0-0+0*0+0-0*0+0+9','1*0-0+0*0+0-0*0-0+9','1*0-0+0*0+0-0*0*0+9','1*0-0+0*0+0*0+0+0+9','1*0-0+0*0+0*0+0-0+9','1*0-0+0*0+0*0+0*0+9','1*0-0+0*0+0*0-0+0+9','1*0-0+0*0+0*0-0-0+9','1*0-0+0*0+0*0-0*0+9','1*0-0+0*0+0*0*0+0+9','1*0-0+0*0+0*0*0-0+9','1*0-0+0*0+0*0*0*0+9','1*0-0+0*0-0+0+0+0+9','1*0-0+0*0-0+0+0-0+9','1*0-0+0*0-0+0+0*0+9','1*0-0+0*0-0+0-0+0+9','1*0-0+0*0-0+0-0-0+9','1*0-0+0*0-0+0-0*0+9','1*0-0+0*0-0+0*0+0+9','1*0-0+0*0-0+0*0-0+9','1*0-0+0*0-0+0*0*0+9','1*0-0+0*0-0-0+0+0+9','1*0-0+0*0-0-0+0-0+9','1*0-0+0*0-0-0+0*0+9','1*0-0+0*0-0-0-0+0+9','1*0-0+0*0-0-0-0-0+9','1*0-0+0*0-0-0-0*0+9','1*0-0+0*0-0-0*0+0+9','1*0-0+0*0-0-0*0-0+9','1*0-0+0*0-0-0*0*0+9','1*0-0+0*0-0*0+0+0+9','1*0-0+0*0-0*0+0-0+9','1*0-0+0*0-0*0+0*0+9','1*0-0+0*0-0*0-0+0+9','1*0-0+0*0-0*0-0-0+9','1*0-0+0*0-0*0-0*0+9','1*0-0+0*0-0*0*0+0+9','1*0-0+0*0-0*0*0-0+9','1*0-0+0*0-0*0*0*0+9','1*0-0+0*0*0+0+0+0+9','1*0-0+0*0*0+0+0-0+9','1*0-0+0*0*0+0+0*0+9','1*0-0+0*0*0+0-0+0+9','1*0-0+0*0*0+0-0-0+9','1*0-0+0*0*0+0-0*0+9','1*0-0+0*0*0+0*0+0+9','1*0-0+0*0*0+0*0-0+9','1*0-0+0*0*0+0*0*0+9','1*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9','1*0-0-0*0+0*0*0-0+9','1*0-0-0*0+0*0*0*0+9','1*0-0-0*0-0+0+0+0+9','1*0-0-0*0-0+0+0-0+9','1*0-0-0*0-0+0+0*0+9','1*0-0-0*0-0+0-0+0+9','1*0-0-0*0-0+0-0-0+9','1*0-0-0*0-0+0-0*0+9','1*0-0-0*0-0+0*0+0+9','1*0-0-0*0-0+0*0-0+9','1*0-0-0*0-0+0*0*0+9','1*0-0-0*0-0-0+0+0+9','1*0-0-0*0-0-0+0-0+9','1*0-0-0*0-0-0+0*0+9','1*0-0-0*0-0-0-0+0+9','1*0-0-0*0-0-0-0-0+9','1*0-0-0*0-0-0-0*0+9','1*0-0-0*0-0-0*0+0+9','1*0-0-0*0-0-0*0-0+9','1*0-0-0*0-0-0*0*0+9','1*0-0-0*0-0*0+0+0+9','1*0-0-0*0-0*0+0-0+9','1*0-0-0*0-0*0+0*0+9','1*0-0-0*0-0*0-0+0+9','1*0-0-0*0-0*0-0-0+9','1*0-0-0*0-0*0-0*0+9','1*0-0-0*0-0*0*0+0+9','1*0-0-0*0-0*0*0-0+9','1*0-0-0*0-0*0*0*0+9','1*0-0-0*0*0+0+0+0+9','1*0-0-0*0*0+0+0-0+9','1*0-0-0*0*0+0+0*0+9','1*0-0-0*0*0+0-0+0+9','1*0-0-0*0*0+0-0-0+9','1*0-0-0*0*0+0-0*0+9','1*0-0-0*0*0+0*0+0+9','1*0-0-0*0*0+0*0-0+9','1*0-0-0*0*0+0*0*0+9','1*0-0-0*0*0-0+0+0+9','1*0-0-0*0*0-0+0-0+9','1*0-0-0*0*0-0+0*0+9','1*0-0-0*0*0-0-0+0+9','1*0-0-0*0*0-0-0-0+9','1*0-0-0*0*0-0-0*0+9','1*0-0-0*0*0-0*0+0+9','1*0-0-0*0*0-0*0-0+9','1*0-0-0*0*0-0*0*0+9','1*0-0-0*0*0*0+0+0+9','1*0-0-0*0*0*0+0-0+9','1*0-0-0*0*0*0+0*0+9','1*0-0-0*0*0*0-0+0+9','1*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9','1*0-0*0*0-0-0+0*0+9','1*0-0*0*0-0-0-0+0+9','1*0-0*0*0-0-0-0-0+9','1*0-0*0*0-0-0-0*0+9','1*0-0*0*0-0-0*0+0+9','1*0-0*0*0-0-0*0-0+9','1*0-0*0*0-0-0*0*0+9','1*0-0*0*0-0*0+0+0+9','1*0-0*0*0-0*0+0-0+9','1*0-0*0*0-0*0+0*0+9','1*0-0*0*0-0*0-0+0+9','1*0-0*0*0-0*0-0-0+9','1*0-0*0*0-0*0-0*0+9','1*0-0*0*0-0*0*0+0+9','1*0-0*0*0-0*0*0-0+9','1*0-0*0*0-0*0*0*0+9','1*0-0*0*0*0+0+0+0+9','1*0-0*0*0*0+0+0-0+9','1*0-0*0*0*0+0+0*0+9','1*0-0*0*0*0+0-0+0+9','1*0-0*0*0*0+0-0-0+9','1*0-0*0*0*0+0-0*0+9','1*0-0*0*0*0+0*0+0+9','1*0-0*0*0*0+0*0-0+9','1*0-0*0*0*0+0*0*0+9','1*0-0*0*0*0-0+0+0+9','1*0-0*0*0*0-0+0-0+9','1*0-0*0*0*0-0+0*0+9','1*0-0*0*0*0-0-0+0+9','1*0-0*0*0*0-0-0-0+9','1*0-0*0*0*0-0-0*0+9','1*0-0*0*0*0-0*0+0+9','1*0-0*0*0*0-0*0-0+9','1*0-0*0*0*0-0*0*0+9','1*0-0*0*0*0*0+0+0+9','1*0-0*0*0*0*0+0-0+9','1*0-0*0*0*0*0+0*0+9','1*0-0*0*0*0*0-0+0+9','1*0-0*0*0*0*0-0-0+9','1*0-0*0*0*0*0-0*0+9','1*0-0*0*0*0*0*0+0+9','1*0-0*0*0*0*0*0-0+9','1*0-0*0*0*0*0*0*0+9','1*0*0+0+0+0+0+0+0+9','1*0*0+0+0+0+0+0-0+9','1*0*0+0+0+0+0+0*0+9','1*0*0+0+0+0+0-0+0+9','1*0*0+0+0+0+0-0-0+9','1*0*0+0+0+0+0-0*0+9','1*0*0+0+0+0+0*0+0+9','1*0*0+0+0+0+0*0-0+9','1*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9','1*0*0+0*0-0*0*0+0+9','1*0*0+0*0-0*0*0-0+9','1*0*0+0*0-0*0*0*0+9','1*0*0+0*0*0+0+0+0+9','1*0*0+0*0*0+0+0-0+9','1*0*0+0*0*0+0+0*0+9','1*0*0+0*0*0+0-0+0+9','1*0*0+0*0*0+0-0-0+9','1*0*0+0*0*0+0-0*0+9','1*0*0+0*0*0+0*0+0+9','1*0*0+0*0*0+0*0-0+9','1*0*0+0*0*0+0*0*0+9','1*0*0+0*0*0-0+0+0+9','1*0*0+0*0*0-0+0-0+9','1*0*0+0*0*0-0+0*0+9','1*0*0+0*0*0-0-0+0+9','1*0*0+0*0*0-0-0-0+9','1*0*0+0*0*0-0-0*0+9','1*0*0+0*0*0-0*0+0+9','1*0*0+0*0*0-0*0-0+9','1*0*0+0*0*0-0*0*0+9','1*0*0+0*0*0*0+0+0+9','1*0*0+0*0*0*0+0-0+9','1*0*0+0*0*0*0+0*0+9','1*0*0+0*0*0*0-0+0+9','1*0*0+0*0*0*0-0-0+9','1*0*0+0*0*0*0-0*0+9','1*0*0+0*0*0*0*0+0+9','1*0*0+0*0*0*0*0-0+9','1*0*0+0*0*0*0*0*0+9','1*0*0-0+0+0+0+0+0+9','1*0*0-0+0+0+0+0-0+9','1*0*0-0+0+0+0+0*0+9','1*0*0-0+0+0+0-0+0+9','1*0*0-0+0+0+0-0-0+9','1*0*0-0+0+0+0-0*0+9','1*0*0-0+0+0+0*0+0+9','1*0*0-0+0+0+0*0-0+9','1*0*0-0+0+0+0*0*0+9','1*0*0-0+0+0-0+0+0+9','1*0*0-0+0+0-0+0-0+9','1*0*0-0+0+0-0+0*0+9','1*0*0-0+0+0-0-0+0+9','1*0*0-0+0+0-0-0-0+9','1*0*0-0+0+0-0-0*0+9','1*0*0-0+0+0-0*0+0+9','1*0*0-0+0+0-0*0-0+9','1*0*0-0+0+0-0*0*0+9','1*0*0-0+0+0*0+0+0+9','1*0*0-0+0+0*0+0-0+9','1*0*0-0+0+0*0+0*0+9','1*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9','1*0*0-0*0*0-0+0-0+9','1*0*0-0*0*0-0+0*0+9','1*0*0-0*0*0-0-0+0+9','1*0*0-0*0*0-0-0-0+9','1*0*0-0*0*0-0-0*0+9','1*0*0-0*0*0-0*0+0+9','1*0*0-0*0*0-0*0-0+9','1*0*0-0*0*0-0*0*0+9','1*0*0-0*0*0*0+0+0+9','1*0*0-0*0*0*0+0-0+9','1*0*0-0*0*0*0+0*0+9','1*0*0-0*0*0*0-0+0+9','1*0*0-0*0*0*0-0-0+9','1*0*0-0*0*0*0-0*0+9','1*0*0-0*0*0*0*0+0+9','1*0*0-0*0*0*0*0-0+9','1*0*0-0*0*0*0*0*0+9','1*0*0*0+0+0+0+0+0+9','1*0*0*0+0+0+0+0-0+9','1*0*0*0+0+0+0+0*0+9','1*0*0*0+0+0+0-0+0+9','1*0*0*0+0+0+0-0-0+9','1*0*0*0+0+0+0-0*0+9','1*0*0*0+0+0+0*0+0+9','1*0*0*0+0+0+0*0-0+9','1*0*0*0+0+0+0*0*0+9','1*0*0*0+0+0-0+0+0+9','1*0*0*0+0+0-0+0-0+9','1*0*0*0+0+0-0+0*0+9','1*0*0*0+0+0-0-0+0+9','1*0*0*0+0+0-0-0-0+9','1*0*0*0+0+0-0-0*0+9','1*0*0*0+0+0-0*0+0+9','1*0*0*0+0+0-0*0-0+9','1*0*0*0+0+0-0*0*0+9','1*0*0*0+0+0*0+0+0+9','1*0*0*0+0+0*0+0-0+9','1*0*0*0+0+0*0+0*0+9','1*0*0*0+0+0*0-0+0+9','1*0*0*0+0+0*0-0-0+9','1*0*0*0+0+0*0-0*0+9','1*0*0*0+0+0*0*0+0+9','1*0*0*0+0+0*0*0-0+9','1*0*0*0+0+0*0*0*0+9','1*0*0*0+0-0+0+0+0+9','1*0*0*0+0-0+0+0-0+9','1*0*0*0+0-0+0+0*0+9','1*0*0*0+0-0+0-0+0+9','1*0*0*0+0-0+0-0-0+9','1*0*0*0+0-0+0-0*0+9','1*0*0*0+0-0+0*0+0+9','1*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9','1*0*0*0*0*0*0-0*0+9','1*0*0*0*0*0*0*0+0+9','1*0*0*0*0*0*0*0-0+9','1*0*0*0*0*0*0*0*0+9','10*0+0+0+0+0+0+0+9','10*0+0+0+0+0+0-0+9','10*0+0+0+0+0+0*0+9','10*0+0+0+0+0-0+0+9','10*0+0+0+0+0-0-0+9','10*0+0+0+0+0-0*0+9','10*0+0+0+0+0*0+0+9','10*0+0+0+0+0*0-0+9','10*0+0+0+0+0*0*0+9','10*0+0+0+0-0+0+0+9','10*0+0+0+0-0+0-0+9','10*0+0+0+0-0+0*0+9','10*0+0+0+0-0-0+0+9','10*0+0+0+0-0-0-0+9','10*0+0+0+0-0-0*0+9','10*0+0+0+0-0*0+0+9','10*0+0+0+0-0*0-0+9','10*0+0+0+0-0*0*0+9','10*0+0+0+0*0+0+0+9','10*0+0+0+0*0+0-0+9','10*0+0+0+0*0+0*0+9','10*0+0+0+0*0-0+0+9','10*0+0+0+0*0-0-0+9','10*0+0+0+0*0-0*0+9','10*0+0+0+0*0*0+0+9','10*0+0+0+0*0*0-0+9','10*0+0+0+0*0*0*0+9','10*0+0+0-0+0+0+0+9','10*0+0+0-0+0+0-0+9','10*0+0+0-0+0+0*0+9','10*0+0+0-0+0-0+0+9','10*0+0+0-0+0-0-0+9','10*0+0+0-0+0-0*0+9','10*0+0+0-0+0*0+0+9','10*0+0+0-0+0*0-0+9','10*0+0+0-0+0*0*0+9','10*0+0+0-0-0+0+0+9','10*0+0+0-0-0+0-0+9','10*0+0+0-0-0+0*0+9','10*0+0+0-0-0-0+0+9','10*0+0+0-0-0-0-0+9','10*0+0+0-0-0-0*0+9','10*0+0+0-0-0*0+0+9','10*0+0+0-0-0*0-0+9','10*0+0+0-0-0*0*0+9','10*0+0+0-0*0+0+0+9','10*0+0+0-0*0+0-0+9','10*0+0+0-0*0+0*0+9','10*0+0+0-0*0-0+0+9','10*0+0+0-0*0-0-0+9','10*0+0+0-0*0-0*0+9','10*0+0+0-0*0*0+0+9','10*0+0+0-0*0*0-0+9','10*0+0+0-0*0*0*0+9','10*0+0+0*0+0+0+0+9','10*0+0+0*0+0+0-0+9','10*0+0+0*0+0+0*0+9','10*0+0+0*0+0-0+0+9','10*0+0+0*0+0-0-0+9','10*0+0+0*0+0-0*0+9','10*0+0+0*0+0*0+0+9','10*0+0+0*0+0*0-0+9','10*0+0+0*0+0*0*0+9','10*0+0+0*0-0+0+0+9','10*0+0+0*0-0+0-0+9','10*0+0+0*0-0+0*0+9','10*0+0+0*0-0-0+0+9','10*0+0+0*0-0-0-0+9','10*0+0+0*0-0-0*0+9','10*0+0+0*0-0*0+0+9','10*0+0+0*0-0*0-0+9','10*0+0+0*0-0*0*0+9','10*0+0+0*0*0+0+0+9','10*0+0+0*0*0+0-0+9','10*0+0+0*0*0+0*0+9','10*0+0+0*0*0-0+0+9','10*0+0+0*0*0-0-0+9','10*0+0+0*0*0-0*0+9','10*0+0+0*0*0*0+0+9','10*0+0+0*0*0*0-0+9','10*0+0+0*0*0*0*0+9','10*0+0-0+0+0+0+0+9','10*0+0-0+0+0+0-0+9','10*0+0-0+0+0+0*0+9','10*0+0-0+0+0-0+0+9','10*0+0-0+0+0-0-0+9','10*0+0-0+0+0-0*0+9','10*0+0-0+0+0*0+0+9','10*0+0-0+0+0*0-0+9','10*0+0-0+0+0*0*0+9','10*0+0-0+0-0+0+0+9','10*0+0-0+0-0+0-0+9','10*0+0-0+0-0+0*0+9','10*0+0-0+0-0-0+0+9','10*0+0-0+0-0-0-0+9','10*0+0-0+0-0-0*0+9','10*0+0-0+0-0*0+0+9','10*0+0-0+0-0*0-0+9','10*0+0-0+0-0*0*0+9','10*0+0-0+0*0+0+0+9','10*0+0-0+0*0+0-0+9','10*0+0-0+0*0+0*0+9','10*0+0-0+0*0-0+0+9','10*0+0-0+0*0-0-0+9','10*0+0-0+0*0-0*0+9','10*0+0-0+0*0*0+0+9','10*0+0-0+0*0*0-0+9','10*0+0-0+0*0*0*0+9','10*0+0-0-0+0+0+0+9','10*0+0-0-0+0+0-0+9','10*0+0-0-0+0+0*0+9','10*0+0-0-0+0-0+0+9','10*0+0-0-0+0-0-0+9','10*0+0-0-0+0-0*0+9','10*0+0-0-0+0*0+0+9','10*0+0-0-0+0*0-0+9','10*0+0-0-0+0*0*0+9','10*0+0-0-0-0+0+0+9','10*0+0-0-0-0+0-0+9','10*0+0-0-0-0+0*0+9','10*0+0-0-0-0-0+0+9','10*0+0-0-0-0-0-0+9','10*0+0-0-0-0-0*0+9','10*0+0-0-0-0*0+0+9','10*0+0-0-0-0*0-0+9','10*0+0-0-0-0*0*0+9','10*0+0-0-0*0+0+0+9','10*0+0-0-0*0+0-0+9','10*0+0-0-0*0+0*0+9','10*0+0-0-0*0-0+0+9','10*0+0-0-0*0-0-0+9','10*0+0-0-0*0-0*0+9','10*0+0-0-0*0*0+0+9','10*0+0-0-0*0*0-0+9','10*0+0-0-0*0*0*0+9','10*0+0-0*0+0+0+0+9','10*0+0-0*0+0+0-0+9','10*0+0-0*0+0+0*0+9','10*0+0-0*0+0-0+0+9','10*0+0-0*0+0-0-0+9','10*0+0-0*0+0-0*0+9','10*0+0-0*0+0*0+0+9','10*0+0-0*0+0*0-0+9','10*0+0-0*0+0*0*0+9','10*0+0-0*0-0+0+0+9','10*0+0-0*0-0+0-0+9','10*0+0-0*0-0+0*0+9','10*0+0-0*0-0-0+0+9','10*0+0-0*0-0-0-0+9','10*0+0-0*0-0-0*0+9','10*0+0-0*0-0*0+0+9','10*0+0-0*0-0*0-0+9','10*0+0-0*0-0*0*0+9','10*0+0-0*0*0+0+0+9','10*0+0-0*0*0+0-0+9','10*0+0-0*0*0+0*0+9','10*0+0-0*0*0-0+0+9','10*0+0-0*0*0-0-0+9','10*0+0-0*0*0-0*0+9','10*0+0-0*0*0*0+0+9','10*0+0-0*0*0*0-0+9','10*0+0-0*0*0*0*0+9','10*0+0*0+0+0+0+0+9','10*0+0*0+0+0+0-0+9','10*0+0*0+0+0+0*0+9','10*0+0*0+0+0-0+0+9','10*0+0*0+0+0-0-0+9','10*0+0*0+0+0-0*0+9','10*0+0*0+0+0*0+0+9','10*0+0*0+0+0*0-0+9','10*0+0*0+0+0*0*0+9','10*0+0*0+0-0+0+0+9','10*0+0*0+0-0+0-0+9','10*0+0*0+0-0+0*0+9','10*0+0*0+0-0-0+0+9','10*0+0*0+0-0-0-0+9','10*0+0*0+0-0-0*0+9','10*0+0*0+0-0*0+0+9','10*0+0*0+0-0*0-0+9','10*0+0*0+0-0*0*0+9','10*0+0*0+0*0+0+0+9','10*0+0*0+0*0+0-0+9','10*0+0*0+0*0+0*0+9','10*0+0*0+0*0-0+0+9','10*0+0*0+0*0-0-0+9','10*0+0*0+0*0-0*0+9','10*0+0*0+0*0*0+0+9','10*0+0*0+0*0*0-0+9','10*0+0*0+0*0*0*0+9','10*0+0*0-0+0+0+0+9','10*0+0*0-0+0+0-0+9','10*0+0*0-0+0+0*0+9','10*0+0*0-0+0-0+0+9','10*0+0*0-0+0-0-0+9','10*0+0*0-0+0-0*0+9','10*0+0*0-0+0*0+0+9','10*0+0*0-0+0*0-0+9','10*0+0*0-0+0*0*0+9','10*0+0*0-0-0+0+0+9','10*0+0*0-0-0+0-0+9','10*0+0*0-0-0+0*0+9','10*0+0*0-0-0-0+0+9','10*0+0*0-0-0-0-0+9','10*0+0*0-0-0-0*0+9','10*0+0*0-0-0*0+0+9','10*0+0*0-0-0*0-0+9','10*0+0*0-0-0*0*0+9','10*0+0*0-0*0+0+0+9','10*0+0*0-0*0+0-0+9','10*0+0*0-0*0+0*0+9','10*0+0*0-0*0-0+0+9','10*0+0*0-0*0-0-0+9','10*0+0*0-0*0-0*0+9','10*0+0*0-0*0*0+0+9','10*0+0*0-0*0*0-0+9','10*0+0*0-0*0*0*0+9','10*0+0*0*0+0+0+0+9','10*0+0*0*0+0+0-0+9','10*0+0*0*0+0+0*0+9','10*0+0*0*0+0-0+0+9','10*0+0*0*0+0-0-0+9','10*0+0*0*0+0-0*0+9','10*0+0*0*0+0*0+0+9','10*0+0*0*0+0*0-0+9','10*0+0*0*0+0*0*0+9','10*0+0*0*0-0+0+0+9','10*0+0*0*0-0+0-0+9','10*0+0*0*0-0+0*0+9','10*0+0*0*0-0-0+0+9','10*0+0*0*0-0-0-0+9','10*0+0*0*0-0-0*0+9','10*0+0*0*0-0*0+0+9','10*0+0*0*0-0*0-0+9','10*0+0*0*0-0*0*0+9','10*0+0*0*0*0+0+0+9','10*0+0*0*0*0+0-0+9','10*0+0*0*0*0+0*0+9','10*0+0*0*0*0-0+0+9','10*0+0*0*0*0-0-0+9','10*0+0*0*0*0-0*0+9','10*0+0*0*0*0*0+0+9','10*0+0*0*0*0*0-0+9','10*0+0*0*0*0*0*0+9','10*0-0+0+0+0+0+0+9','10*0-0+0+0+0+0-0+9','10*0-0+0+0+0+0*0+9','10*0-0+0+0+0-0+0+9','10*0-0+0+0+0-0-0+9','10*0-0+0+0+0-0*0+9','10*0-0+0+0+0*0+0+9','10*0-0+0+0+0*0-0+9','10*0-0+0+0+0*0*0+9','10*0-0+0+0-0+0+0+9','10*0-0+0+0-0+0-0+9','10*0-0+0+0-0+0*0+9','10*0-0+0+0-0-0+0+9','10*0-0+0+0-0-0-0+9','10*0-0+0+0-0-0*0+9','10*0-0+0+0-0*0+0+9','10*0-0+0+0-0*0-0+9','10*0-0+0+0-0*0*0+9','10*0-0+0+0*0+0+0+9','10*0-0+0+0*0+0-0+9','10*0-0+0+0*0+0*0+9','10*0-0+0+0*0-0+0+9','10*0-0+0+0*0-0-0+9','10*0-0+0+0*0-0*0+9','10*0-0+0+0*0*0+0+9','10*0-0+0+0*0*0-0+9','10*0-0+0+0*0*0*0+9','10*0-0+0-0+0+0+0+9','10*0-0+0-0+0+0-0+9','10*0-0+0-0+0+0*0+9','10*0-0+0-0+0-0+0+9','10*0-0+0-0+0-0-0+9','10*0-0+0-0+0-0*0+9','10*0-0+0-0+0*0+0+9','10*0-0+0-0+0*0-0+9','10*0-0+0-0+0*0*0+9','10*0-0+0-0-0+0+0+9','10*0-0+0-0-0+0-0+9','10*0-0+0-0-0+0*0+9','10*0-0+0-0-0-0+0+9','10*0-0+0-0-0-0-0+9','10*0-0+0-0-0-0*0+9','10*0-0+0-0-0*0+0+9','10*0-0+0-0-0*0-0+9','10*0-0+0-0-0*0*0+9','10*0-0+0-0*0+0+0+9','10*0-0+0-0*0+0-0+9','10*0-0+0-0*0+0*0+9','10*0-0+0-0*0-0+0+9','10*0-0+0-0*0-0-0+9','10*0-0+0-0*0-0*0+9','10*0-0+0-0*0*0+0+9','10*0-0+0-0*0*0-0+9','10*0-0+0-0*0*0*0+9','10*0-0+0*0+0+0+0+9','10*0-0+0*0+0+0-0+9','10*0-0+0*0+0+0*0+9','10*0-0+0*0+0-0+0+9','10*0-0+0*0+0-0-0+9','10*0-0+0*0+0-0*0+9','10*0-0+0*0+0*0+0+9','10*0-0+0*0+0*0-0+9','10*0-0+0*0+0*0*0+9','10*0-0+0*0-0+0+0+9','10*0-0+0*0-0+0-0+9','10*0-0+0*0-0+0*0+9','10*0-0+0*0-0-0+0+9','10*0-0+0*0-0-0-0+9','10*0-0+0*0-0-0*0+9','10*0-0+0*0-0*0+0+9','10*0-0+0*0-0*0-0+9','10*0-0+0*0-0*0*0+9','10*0-0+0*0*0+0+0+9','10*0-0+0*0*0+0-0+9','10*0-0+0*0*0+0*0+9','10*0-0+0*0*0-0+0+9','10*0-0+0*0*0-0-0+9','10*0-0+0*0*0-0*0+9','10*0-0+0*0*0*0+0+9','10*0-0+0*0*0*0-0+9','10*0-0+0*0*0*0*0+9','10*0-0-0+0+0+0+0+9','10*0-0-0+0+0+0-0+9','10*0-0-0+0+0+0*0+9','10*0-0-0+0+0-0+0+9','10*0-0-0+0+0-0-0+9','10*0-0-0+0+0-0*0+9','10*0-0-0+0+0*0+0+9','10*0-0-0+0+0*0-0+9','10*0-0-0+0+0*0*0+9','10*0-0-0+0-0+0+0+9','10*0-0-0+0-0+0-0+9','10*0-0-0+0-0+0*0+9','10*0-0-0+0-0-0+0+9','10*0-0-0+0-0-0-0+9','10*0-0-0+0-0-0*0+9','10*0-0-0+0-0*0+0+9','10*0-0-0+0-0*0-0+9','10*0-0-0+0-0*0*0+9','10*0-0-0+0*0+0+0+9','10*0-0-0+0*0+0-0+9','10*0-0-0+0*0+0*0+9','10*0-0-0+0*0-0+0+9','10*0-0-0+0*0-0-0+9','10*0-0-0+0*0-0*0+9','10*0-0-0+0*0*0+0+9','10*0-0-0+0*0*0-0+9','10*0-0-0+0*0*0*0+9','10*0-0-0-0+0+0+0+9','10*0-0-0-0+0+0-0+9','10*0-0-0-0+0+0*0+9','10*0-0-0-0+0-0+0+9','10*0-0-0-0+0-0-0+9','10*0-0-0-0+0-0*0+9','10*0-0-0-0+0*0+0+9','10*0-0-0-0+0*0-0+9','10*0-0-0-0+0*0*0+9','10*0-0-0-0-0+0+0+9','10*0-0-0-0-0+0-0+9','10*0-0-0-0-0+0*0+9','10*0-0-0-0-0-0+0+9','10*0-0-0-0-0-0-0+9','10*0-0-0-0-0-0*0+9','10*0-0-0-0-0*0+0+9','10*0-0-0-0-0*0-0+9','10*0-0-0-0-0*0*0+9','10*0-0-0-0*0+0+0+9','10*0-0-0-0*0+0-0+9','10*0-0-0-0*0+0*0+9','10*0-0-0-0*0-0+0+9','10*0-0-0-0*0-0-0+9','10*0-0-0-0*0-0*0+9','10*0-0-0-0*0*0+0+9','10*0-0-0-0*0*0-0+9','10*0-0-0-0*0*0*0+9','10*0-0-0*0+0+0+0+9','10*0-0-0*0+0+0-0+9','10*0-0-0*0+0+0*0+9','10*0-0-0*0+0-0+0+9','10*0-0-0*0+0-0-0+9','10*0-0-0*0+0-0*0+9','10*0-0-0*0+0*0+0+9','10*0-0-0*0+0*0-0+9','10*0-0-0*0+0*0*0+9','10*0-0-0*0-0+0+0+9','10*0-0-0*0-0+0-0+9','10*0-0-0*0-0+0*0+9','10*0-0-0*0-0-0+0+9','10*0-0-0*0-0-0-0+9','10*0-0-0*0-0-0*0+9','10*0-0-0*0-0*0+0+9','10*0-0-0*0-0*0-0+9','10*0-0-0*0-0*0*0+9','10*0-0-0*0*0+0+0+9','10*0-0-0*0*0+0-0+9','10*0-0-0*0*0+0*0+9','10*0-0-0*0*0-0+0+9','10*0-0-0*0*0-0-0+9','10*0-0-0*0*0-0*0+9','10*0-0-0*0*0*0+0+9','10*0-0-0*0*0*0-0+9','10*0-0-0*0*0*0*0+9','10*0-0*0+0+0+0+0+9','10*0-0*0+0+0+0-0+9','10*0-0*0+0+0+0*0+9','10*0-0*0+0+0-0+0+9','10*0-0*0+0+0-0-0+9','10*0-0*0+0+0-0*0+9','10*0-0*0+0+0*0+0+9','10*0-0*0+0+0*0-0+9','10*0-0*0+0+0*0*0+9','10*0-0*0+0-0+0+0+9','10*0-0*0+0-0+0-0+9','10*0-0*0+0-0+0*0+9','10*0-0*0+0-0-0+0+9','10*0-0*0+0-0-0-0+9','10*0-0*0+0-0-0*0+9','10*0-0*0+0-0*0+0+9','10*0-0*0+0-0*0-0+9','10*0-0*0+0-0*0*0+9','10*0-0*0+0*0+0+0+9','10*0-0*0+0*0+0-0+9','10*0-0*0+0*0+0*0+9','10*0-0*0+0*0-0+0+9','10*0-0*0+0*0-0-0+9','10*0-0*0+0*0-0*0+9','10*0-0*0+0*0*0+0+9','10*0-0*0+0*0*0-0+9','10*0-0*0+0*0*0*0+9','10*0-0*0-0+0+0+0+9','10*0-0*0-0+0+0-0+9','10*0-0*0-0+0+0*0+9','10*0-0*0-0+0-0+0+9','10*0-0*0-0+0-0-0+9','10*0-0*0-0+0-0*0+9','10*0-0*0-0+0*0+0+9','10*0-0*0-0+0*0-0+9','10*0-0*0-0+0*0*0+9','10*0-0*0-0-0+0+0+9','10*0-0*0-0-0+0-0+9','10*0-0*0-0-0+0*0+9','10*0-0*0-0-0-0+0+9','10*0-0*0-0-0-0-0+9','10*0-0*0-0-0-0*0+9','10*0-0*0-0-0*0+0+9','10*0-0*0-0-0*0-0+9','10*0-0*0-0-0*0*0+9','10*0-0*0-0*0+0+0+9','10*0-0*0-0*0+0-0+9','10*0-0*0-0*0+0*0+9','10*0-0*0-0*0-0+0+9','10*0-0*0-0*0-0-0+9','10*0-0*0-0*0-0*0+9','10*0-0*0-0*0*0+0+9','10*0-0*0-0*0*0-0+9','10*0-0*0-0*0*0*0+9','10*0-0*0*0+0+0+0+9','10*0-0*0*0+0+0-0+9','10*0-0*0*0+0+0*0+9','10*0-0*0*0+0-0+0+9','10*0-0*0*0+0-0-0+9','10*0-0*0*0+0-0*0+9','10*0-0*0*0+0*0+0+9','10*0-0*0*0+0*0-0+9','10*0-0*0*0+0*0*0+9','10*0-0*0*0-0+0+0+9','10*0-0*0*0-0+0-0+9','10*0-0*0*0-0+0*0+9','10*0-0*0*0-0-0+0+9','10*0-0*0*0-0-0-0+9','10*0-0*0*0-0-0*0+9','10*0-0*0*0-0*0+0+9','10*0-0*0*0-0*0-0+9','10*0-0*0*0-0*0*0+9','10*0-0*0*0*0+0+0+9','10*0-0*0*0*0+0-0+9','10*0-0*0*0*0+0*0+9','10*0-0*0*0*0-0+0+9','10*0-0*0*0*0-0-0+9','10*0-0*0*0*0-0*0+9','10*0-0*0*0*0*0+0+9','10*0-0*0*0*0*0-0+9','10*0-0*0*0*0*0*0+9','10*0*0+0+0+0+0+0+9','10*0*0+0+0+0+0-0+9','10*0*0+0+0+0+0*0+9','10*0*0+0+0+0-0+0+9','10*0*0+0+0+0-0-0+9','10*0*0+0+0+0-0*0+9','10*0*0+0+0+0*0+0+9','10*0*0+0+0+0*0-0+9','10*0*0+0+0+0*0*0+9','10*0*0+0+0-0+0+0+9','10*0*0+0+0-0+0-0+9','10*0*0+0+0-0+0*0+9','10*0*0+0+0-0-0+0+9','10*0*0+0+0-0-0-0+9','10*0*0+0+0-0-0*0+9','10*0*0+0+0-0*0+0+9','10*0*0+0+0-0*0-0+9','10*0*0+0+0-0*0*0+9','10*0*0+0+0*0+0+0+9','10*0*0+0+0*0+0-0+9','10*0*0+0+0*0+0*0+9','10*0*0+0+0*0-0+0+9','10*0*0+0+0*0-0-0+9','10*0*0+0+0*0-0*0+9','10*0*0+0+0*0*0+0+9','10*0*0+0+0*0*0-0+9','10*0*0+0+0*0*0*0+9','10*0*0+0-0+0+0+0+9','10*0*0+0-0+0+0-0+9','10*0*0+0-0+0+0*0+9','10*0*0+0-0+0-0+0+9','10*0*0+0-0+0-0-0+9','10*0*0+0-0+0-0*0+9','10*0*0+0-0+0*0+0+9','10*0*0+0-0+0*0-0+9','10*0*0+0-0+0*0*0+9','10*0*0+0-0-0+0+0+9','10*0*0+0-0-0+0-0+9','10*0*0+0-0-0+0*0+9','10*0*0+0-0-0-0+0+9','10*0*0+0-0-0-0-0+9','10*0*0+0-0-0-0*0+9','10*0*0+0-0-0*0+0+9','10*0*0+0-0-0*0-0+9','10*0*0+0-0-0*0*0+9','10*0*0+0-0*0+0+0+9','10*0*0+0-0*0+0-0+9','10*0*0+0-0*0+0*0+9','10*0*0+0-0*0-0+0+9','10*0*0+0-0*0-0-0+9','10*0*0+0-0*0-0*0+9','10*0*0+0-0*0*0+0+9','10*0*0+0-0*0*0-0+9','10*0*0+0-0*0*0*0+9','10*0*0+0*0+0+0+0+9','10*0*0+0*0+0+0-0+9','10*0*0+0*0+0+0*0+9','10*0*0+0*0+0-0+0+9','10*0*0+0*0+0-0-0+9','10*0*0+0*0+0-0*0+9','10*0*0+0*0+0*0+0+9','10*0*0+0*0+0*0-0+9','10*0*0+0*0+0*0*0+9','10*0*0+0*0-0+0+0+9','10*0*0+0*0-0+0-0+9','10*0*0+0*0-0+0*0+9','10*0*0+0*0-0-0+0+9','10*0*0+0*0-0-0-0+9','10*0*0+0*0-0-0*0+9','10*0*0+0*0-0*0+0+9','10*0*0+0*0-0*0-0+9','10*0*0+0*0-0*0*0+9','10*0*0+0*0*0+0+0+9','10*0*0+0*0*0+0-0+9','10*0*0+0*0*0+0*0+9','10*0*0+0*0*0-0+0+9','10*0*0+0*0*0-0-0+9','10*0*0+0*0*0-0*0+9','10*0*0+0*0*0*0+0+9','10*0*0+0*0*0*0-0+9','10*0*0+0*0*0*0*0+9','10*0*0-0+0+0+0+0+9','10*0*0-0+0+0+0-0+9','10*0*0-0+0+0+0*0+9','10*0*0-0+0+0-0+0+9','10*0*0-0+0+0-0-0+9','10*0*0-0+0+0-0*0+9','10*0*0-0+0+0*0+0+9','10*0*0-0+0+0*0-0+9','10*0*0-0+0+0*0*0+9','10*0*0-0+0-0+0+0+9','10*0*0-0+0-0+0-0+9','10*0*0-0+0-0+0*0+9','10*0*0-0+0-0-0+0+9','10*0*0-0+0-0-0-0+9','10*0*0-0+0-0-0*0+9','10*0*0-0+0-0*0+0+9','10*0*0-0+0-0*0-0+9','10*0*0-0+0-0*0*0+9','10*0*0-0+0*0+0+0+9','10*0*0-0+0*0+0-0+9','10*0*0-0+0*0+0*0+9','10*0*0-0+0*0-0+0+9','10*0*0-0+0*0-0-0+9','10*0*0-0+0*0-0*0+9','10*0*0-0+0*0*0+0+9','10*0*0-0+0*0*0-0+9','10*0*0-0+0*0*0*0+9','10*0*0-0-0+0+0+0+9','10*0*0-0-0+0+0-0+9','10*0*0-0-0+0+0*0+9','10*0*0-0-0+0-0+0+9','10*0*0-0-0+0-0-0+9','10*0*0-0-0+0-0*0+9','10*0*0-0-0+0*0+0+9','10*0*0-0-0+0*0-0+9','10*0*0-0-0+0*0*0+9','10*0*0-0-0-0+0+0+9','10*0*0-0-0-0+0-0+9','10*0*0-0-0-0+0*0+9','10*0*0-0-0-0-0+0+9','10*0*0-0-0-0-0-0+9','10*0*0-0-0-0-0*0+9','10*0*0-0-0-0*0+0+9','10*0*0-0-0-0*0-0+9','10*0*0-0-0-0*0*0+9','10*0*0-0-0*0+0+0+9','10*0*0-0-0*0+0-0+9','10*0*0-0-0*0+0*0+9','10*0*0-0-0*0-0+0+9','10*0*0-0-0*0-0-0+9','10*0*0-0-0*0-0*0+9','10*0*0-0-0*0*0+0+9','10*0*0-0-0*0*0-0+9','10*0*0-0-0*0*0*0+9','10*0*0-0*0+0+0+0+9','10*0*0-0*0+0+0-0+9','10*0*0-0*0+0+0*0+9','10*0*0-0*0+0-0+0+9','10*0*0-0*0+0-0-0+9','10*0*0-0*0+0-0*0+9','10*0*0-0*0+0*0+0+9','10*0*0-0*0+0*0-0+9','10*0*0-0*0+0*0*0+9','10*0*0-0*0-0+0+0+9','10*0*0-0*0-0+0-0+9','10*0*0-0*0-0+0*0+9','10*0*0-0*0-0-0+0+9','10*0*0-0*0-0-0-0+9','10*0*0-0*0-0-0*0+9','10*0*0-0*0-0*0+0+9','10*0*0-0*0-0*0-0+9','10*0*0-0*0-0*0*0+9','10*0*0-0*0*0+0+0+9','10*0*0-0*0*0+0-0+9','10*0*0-0*0*0+0*0+9','10*0*0-0*0*0-0+0+9','10*0*0-0*0*0-0-0+9','10*0*0-0*0*0-0*0+9','10*0*0-0*0*0*0+0+9','10*0*0-0*0*0*0-0+9','10*0*0-0*0*0*0*0+9','10*0*0*0+0+0+0+0+9','10*0*0*0+0+0+0-0+9','10*0*0*0+0+0+0*0+9','10*0*0*0+0+0-0+0+9','10*0*0*0+0+0-0-0+9','10*0*0*0+0+0-0*0+9','10*0*0*0+0+0*0+0+9','10*0*0*0+0+0*0-0+9','10*0*0*0+0+0*0*0+9','10*0*0*0+0-0+0+0+9','10*0*0*0+0-0+0-0+9','10*0*0*0+0-0+0*0+9','10*0*0*0+0-0-0+0+9','10*0*0*0+0-0-0-0+9','10*0*0*0+0-0-0*0+9','10*0*0*0+0-0*0+0+9','10*0*0*0+0-0*0-0+9','10*0*0*0+0-0*0*0+9','10*0*0*0+0*0+0+0+9','10*0*0*0+0*0+0-0+9','10*0*0*0+0*0+0*0+9','10*0*0*0+0*0-0+0+9','10*0*0*0+0*0-0-0+9','10*0*0*0+0*0-0*0+9','10*0*0*0+0*0*0+0+9','10*0*0*0+0*0*0-0+9','10*0*0*0+0*0*0*0+9','10*0*0*0-0+0+0+0+9','10*0*0*0-0+0+0-0+9','10*0*0*0-0+0+0*0+9','10*0*0*0-0+0-0+0+9','10*0*0*0-0+0-0-0+9','10*0*0*0-0+0-0*0+9','10*0*0*0-0+0*0+0+9','10*0*0*0-0+0*0-0+9','10*0*0*0-0+0*0*0+9','10*0*0*0-0-0+0+0+9','10*0*0*0-0-0+0-0+9','10*0*0*0-0-0+0*0+9','10*0*0*0-0-0-0+0+9','10*0*0*0-0-0-0-0+9','10*0*0*0-0-0-0*0+9','10*0*0*0-0-0*0+0+9','10*0*0*0-0-0*0-0+9','10*0*0*0-0-0*0*0+9','10*0*0*0-0*0+0+0+9','10*0*0*0-0*0+0-0+9','10*0*0*0-0*0+0*0+9','10*0*0*0-0*0-0+0+9','10*0*0*0-0*0-0-0+9','10*0*0*0-0*0-0*0+9','10*0*0*0-0*0*0+0+9','10*0*0*0-0*0*0-0+9','10*0*0*0-0*0*0*0+9','10*0*0*0*0+0+0+0+9','10*0*0*0*0+0+0-0+9','10*0*0*0*0+0+0*0+9','10*0*0*0*0+0-0+0+9','10*0*0*0*0+0-0-0+9','10*0*0*0*0+0-0*0+9','10*0*0*0*0+0*0+0+9','10*0*0*0*0+0*0-0+9','10*0*0*0*0+0*0*0+9','10*0*0*0*0-0+0+0+9','10*0*0*0*0-0+0-0+9','10*0*0*0*0-0+0*0+9','10*0*0*0*0-0-0+0+9','10*0*0*0*0-0-0-0+9','10*0*0*0*0-0-0*0+9','10*0*0*0*0-0*0+0+9','10*0*0*0*0-0*0-0+9','10*0*0*0*0-0*0*0+9','10*0*0*0*0*0+0+0+9','10*0*0*0*0*0+0-0+9','10*0*0*0*0*0+0*0+9','10*0*0*0*0*0-0+0+9','10*0*0*0*0*0-0-0+9','10*0*0*0*0*0-0*0+9','10*0*0*0*0*0*0+0+9','10*0*0*0*0*0*0-0+9','10*0*0*0*0*0*0*0+9','100*0+0+0+0+0+0+9','100*0+0+0+0+0-0+9','100*0+0+0+0+0*0+9','100*0+0+0+0-0+0+9','100*0+0+0+0-0-0+9','100*0+0+0+0-0*0+9','100*0+0+0+0*0+0+9','100*0+0+0+0*0-0+9','100*0+0+0+0*0*0+9','100*0+0+0-0+0+0+9','100*0+0+0-0+0-0+9','100*0+0+0-0+0*0+9','100*0+0+0-0-0+0+9','100*0+0+0-0-0-0+9','100*0+0+0-0-0*0+9','100*0+0+0-0*0+0+9','100*0+0+0-0*0-0+9','100*0+0+0-0*0*0+9','100*0+0+0*0+0+0+9','100*0+0+0*0+0-0+9','100*0+0+0*0+0*0+9','100*0+0+0*0-0+0+9','100*0+0+0*0-0-0+9','100*0+0+0*0-0*0+9','100*0+0+0*0*0+0+9','100*0+0+0*0*0-0+9','100*0+0+0*0*0*0+9','100*0+0-0+0+0+0+9','100*0+0-0+0+0-0+9','100*0+0-0+0+0*0+9','100*0+0-0+0-0+0+9','100*0+0-0+0-0-0+9','100*0+0-0+0-0*0+9','100*0+0-0+0*0+0+9','100*0+0-0+0*0-0+9','100*0+0-0+0*0*0+9','100*0+0-0-0+0+0+9','100*0+0-0-0+0-0+9','100*0+0-0-0+0*0+9','100*0+0-0-0-0+0+9','100*0+0-0-0-0-0+9','100*0+0-0-0-0*0+9','100*0+0-0-0*0+0+9','100*0+0-0-0*0-0+9','100*0+0-0-0*0*0+9','100*0+0-0*0+0+0+9','100*0+0-0*0+0-0+9','100*0+0-0*0+0*0+9','100*0+0-0*0-0+0+9','100*0+0-0*0-0-0+9','100*0+0-0*0-0*0+9','100*0+0-0*0*0+0+9','100*0+0-0*0*0-0+9','100*0+0-0*0*0*0+9','100*0+0*0+0+0+0+9','100*0+0*0+0+0-0+9','100*0+0*0+0+0*0+9','100*0+0*0+0-0+0+9','100*0+0*0+0-0-0+9','100*0+0*0+0-0*0+9','100*0+0*0+0*0+0+9','100*0+0*0+0*0-0+9','100*0+0*0+0*0*0+9','100*0+0*0-0+0+0+9','100*0+0*0-0+0-0+9','100*0+0*0-0+0*0+9','100*0+0*0-0-0+0+9','100*0+0*0-0-0-0+9','100*0+0*0-0-0*0+9','100*0+0*0-0*0+0+9','100*0+0*0-0*0-0+9','100*0+0*0-0*0*0+9','100*0+0*0*0+0+0+9','100*0+0*0*0+0-0+9','100*0+0*0*0+0*0+9','100*0+0*0*0-0+0+9','100*0+0*0*0-0-0+9','100*0+0*0*0-0*0+9','100*0+0*0*0*0+0+9','100*0+0*0*0*0-0+9','100*0+0*0*0*0*0+9','100*0-0+0+0+0+0+9','100*0-0+0+0+0-0+9','100*0-0+0+0+0*0+9','100*0-0+0+0-0+0+9','100*0-0+0+0-0-0+9','100*0-0+0+0-0*0+9','100*0-0+0+0*0+0+9','100*0-0+0+0*0-0+9','100*0-0+0+0*0*0+9','100*0-0+0-0+0+0+9','100*0-0+0-0+0-0+9','100*0-0+0-0+0*0+9','100*0-0+0-0-0+0+9','100*0-0+0-0-0-0+9','100*0-0+0-0-0*0+9','100*0-0+0-0*0+0+9','100*0-0+0-0*0-0+9','100*0-0+0-0*0*0+9','100*0-0+0*0+0+0+9','100*0-0+0*0+0-0+9','100*0-0+0*0+0*0+9','100*0-0+0*0-0+0+9','100*0-0+0*0-0-0+9','100*0-0+0*0-0*0+9','100*0-0+0*0*0+0+9','100*0-0+0*0*0-0+9','100*0-0+0*0*0*0+9','100*0-0-0+0+0+0+9','100*0-0-0+0+0-0+9','100*0-0-0+0+0*0+9','100*0-0-0+0-0+0+9','100*0-0-0+0-0-0+9','100*0-0-0+0-0*0+9','100*0-0-0+0*0+0+9','100*0-0-0+0*0-0+9','100*0-0-0+0*0*0+9','100*0-0-0-0+0+0+9','100*0-0-0-0+0-0+9','100*0-0-0-0+0*0+9','100*0-0-0-0-0+0+9','100*0-0-0-0-0-0+9','100*0-0-0-0-0*0+9','100*0-0-0-0*0+0+9','100*0-0-0-0*0-0+9','100*0-0-0-0*0*0+9','100*0-0-0*0+0+0+9','100*0-0-0*0+0-0+9','100*0-0-0*0+0*0+9','100*0-0-0*0-0+0+9','100*0-0-0*0-0-0+9','100*0-0-0*0-0*0+9','100*0-0-0*0*0+0+9','100*0-0-0*0*0-0+9','100*0-0-0*0*0*0+9','100*0-0*0+0+0+0+9','100*0-0*0+0+0-0+9','100*0-0*0+0+0*0+9','100*0-0*0+0-0+0+9','100*0-0*0+0-0-0+9','100*0-0*0+0-0*0+9','100*0-0*0+0*0+0+9','100*0-0*0+0*0-0+9','100*0-0*0+0*0*0+9','100*0-0*0-0+0+0+9','100*0-0*0-0+0-0+9','100*0-0*0-0+0*0+9','100*0-0*0-0-0+0+9','100*0-0*0-0-0-0+9','100*0-0*0-0-0*0+9','100*0-0*0-0*0+0+9','100*0-0*0-0*0-0+9','100*0-0*0-0*0*0+9','100*0-0*0*0+0+0+9','100*0-0*0*0+0-0+9','100*0-0*0*0+0*0+9','100*0-0*0*0-0+0+9','100*0-0*0*0-0-0+9','100*0-0*0*0-0*0+9','100*0-0*0*0*0+0+9','100*0-0*0*0*0-0+9','100*0-0*0*0*0*0+9','100*0*0+0+0+0+0+9','100*0*0+0+0+0-0+9','100*0*0+0+0+0*0+9','100*0*0+0+0-0+0+9','100*0*0+0+0-0-0+9','100*0*0+0+0-0*0+9','100*0*0+0+0*0+0+9','100*0*0+0+0*0-0+9','100*0*0+0+0*0*0+9','100*0*0+0-0+0+0+9','100*0*0+0-0+0-0+9','100*0*0+0-0+0*0+9','100*0*0+0-0-0+0+9','100*0*0+0-0-0-0+9','100*0*0+0-0-0*0+9','100*0*0+0-0*0+0+9','100*0*0+0-0*0-0+9','100*0*0+0-0*0*0+9','100*0*0+0*0+0+0+9','100*0*0+0*0+0-0+9','100*0*0+0*0+0*0+9','100*0*0+0*0-0+0+9','100*0*0+0*0-0-0+9','100*0*0+0*0-0*0+9','100*0*0+0*0*0+0+9','100*0*0+0*0*0-0+9','100*0*0+0*0*0*0+9','100*0*0-0+0+0+0+9','100*0*0-0+0+0-0+9','100*0*0-0+0+0*0+9','100*0*0-0+0-0+0+9','100*0*0-0+0-0-0+9','100*0*0-0+0-0*0+9','100*0*0-0+0*0+0+9','100*0*0-0+0*0-0+9','100*0*0-0+0*0*0+9','100*0*0-0-0+0+0+9','100*0*0-0-0+0-0+9','100*0*0-0-0+0*0+9','100*0*0-0-0-0+0+9','100*0*0-0-0-0-0+9','100*0*0-0-0-0*0+9','100*0*0-0-0*0+0+9','100*0*0-0-0*0-0+9','100*0*0-0-0*0*0+9','100*0*0-0*0+0+0+9','100*0*0-0*0+0-0+9','100*0*0-0*0+0*0+9','100*0*0-0*0-0+0+9','100*0*0-0*0-0-0+9','100*0*0-0*0-0*0+9','100*0*0-0*0*0+0+9','100*0*0-0*0*0-0+9','100*0*0-0*0*0*0+9','100*0*0*0+0+0+0+9','100*0*0*0+0+0-0+9','100*0*0*0+0+0*0+9','100*0*0*0+0-0+0+9','100*0*0*0+0-0-0+9','100*0*0*0+0-0*0+9','100*0*0*0+0*0+0+9','100*0*0*0+0*0-0+9','100*0*0*0+0*0*0+9','100*0*0*0-0+0+0+9','100*0*0*0-0+0-0+9','100*0*0*0-0+0*0+9','100*0*0*0-0-0+0+9','100*0*0*0-0-0-0+9','100*0*0*0-0-0*0+9','100*0*0*0-0*0+0+9','100*0*0*0-0*0-0+9','100*0*0*0-0*0*0+9','100*0*0*0*0+0+0+9','100*0*0*0*0+0-0+9','100*0*0*0*0+0*0+9','100*0*0*0*0-0+0+9','100*0*0*0*0-0-0+9','100*0*0*0*0-0*0+9','100*0*0*0*0*0+0+9','100*0*0*0*0*0-0+9','100*0*0*0*0*0*0+9','1000*0+0+0+0+0+9','1000*0+0+0+0-0+9','1000*0+0+0+0*0+9','1000*0+0+0-0+0+9','1000*0+0+0-0-0+9','1000*0+0+0-0*0+9','1000*0+0+0*0+0+9','1000*0+0+0*0-0+9','1000*0+0+0*0*0+9','1000*0+0-0+0+0+9','1000*0+0-0+0-0+9','1000*0+0-0+0*0+9','1000*0+0-0-0+0+9','1000*0+0-0-0-0+9','1000*0+0-0-0*0+9','1000*0+0-0*0+0+9','1000*0+0-0*0-0+9','1000*0+0-0*0*0+9','1000*0+0*0+0+0+9','1000*0+0*0+0-0+9','1000*0+0*0+0*0+9','1000*0+0*0-0+0+9','1000*0+0*0-0-0+9','1000*0+0*0-0*0+9','1000*0+0*0*0+0+9','1000*0+0*0*0-0+9','1000*0+0*0*0*0+9','1000*0-0+0+0+0+9','1000*0-0+0+0-0+9','1000*0-0+0+0*0+9','1000*0-0+0-0+0+9','1000*0-0+0-0-0+9','1000*0-0+0-0*0+9','1000*0-0+0*0+0+9','1000*0-0+0*0-0+9','1000*0-0+0*0*0+9','1000*0-0-0+0+0+9','1000*0-0-0+0-0+9','1000*0-0-0+0*0+9','1000*0-0-0-0+0+9','1000*0-0-0-0-0+9','1000*0-0-0-0*0+9','1000*0-0-0*0+0+9','1000*0-0-0*0-0+9','1000*0-0-0*0*0+9','1000*0-0*0+0+0+9','1000*0-0*0+0-0+9','1000*0-0*0+0*0+9','1000*0-0*0-0+0+9','1000*0-0*0-0-0+9','1000*0-0*0-0*0+9','1000*0-0*0*0+0+9','1000*0-0*0*0-0+9','1000*0-0*0*0*0+9','1000*0*0+0+0+0+9','1000*0*0+0+0-0+9','1000*0*0+0+0*0+9','1000*0*0+0-0+0+9','1000*0*0+0-0-0+9','1000*0*0+0-0*0+9','1000*0*0+0*0+0+9','1000*0*0+0*0-0+9','1000*0*0+0*0*0+9','1000*0*0-0+0+0+9','1000*0*0-0+0-0+9','1000*0*0-0+0*0+9','1000*0*0-0-0+0+9','1000*0*0-0-0-0+9','1000*0*0-0-0*0+9','1000*0*0-0*0+0+9','1000*0*0-0*0-0+9','1000*0*0-0*0*0+9','1000*0*0*0+0+0+9','1000*0*0*0+0-0+9','1000*0*0*0+0*0+9','1000*0*0*0-0+0+9','1000*0*0*0-0-0+9','1000*0*0*0-0*0+9','1000*0*0*0*0+0+9','1000*0*0*0*0-0+9','1000*0*0*0*0*0+9','10000*0+0+0+0+9','10000*0+0+0-0+9','10000*0+0+0*0+9','10000*0+0-0+0+9','10000*0+0-0-0+9','10000*0+0-0*0+9','10000*0+0*0+0+9','10000*0+0*0-0+9','10000*0+0*0*0+9','10000*0-0+0+0+9','10000*0-0+0-0+9','10000*0-0+0*0+9','10000*0-0-0+0+9','10000*0-0-0-0+9','10000*0-0-0*0+9','10000*0-0*0+0+9','10000*0-0*0-0+9','10000*0-0*0*0+9','10000*0*0+0+0+9','10000*0*0+0-0+9','10000*0*0+0*0+9','10000*0*0-0+0+9','10000*0*0-0-0+9','10000*0*0-0*0+9','10000*0*0*0+0+9','10000*0*0*0-0+9','10000*0*0*0*0+9','100000*0+0+0+9','100000*0+0-0+9','100000*0+0*0+9','100000*0-0+0+9','100000*0-0-0+9','100000*0-0*0+9','100000*0*0+0+9','100000*0*0-0+9','100000*0*0*0+9','1000000*0+0+9','1000000*0-0+9','1000000*0*0+9','10000000*0+9']", + "[]", + "['999999999']", + "['0+1']", + "['1+2*3+4','1-2+3*4','12+3-4']" + ], + "boilerplate": { + "python": "class Solution:\n def addOperators(self, num: str, target: int) -> List[str]:\n ", + "java": "class Solution {\n public List addOperators(String num, int target) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector addOperators(string num, int target) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "return Arrays.equals(\n Arrays.stream(result.split(\",\")).sorted().toArray(),\n Arrays.stream(eval(expected).split(\",\")).sorted().toArray()\n);", + "cpp": "std::vector sorted_result = result;\nstd::vector sorted_expected = expected;\n\nstd::sort(sorted_result.begin(), sorted_result.end());\nstd::sort(sorted_expected.begin(), sorted_expected.end());\n\nreturn sorted_result == sorted_expected;" + }, + "explanation": "https://www.youtube.com/watch?v=tunRDBsP7OQ&pp=ygUhTmVldENvZGUgRXhwcmVzc2lvbiBBZGQgT3BlcmF0b3Jz", + "method_name": "addOperators" + }, + { + "title": "Remove Invalid Parentheses", + "source": "https://leetcode.com/problems/remove-invalid-parentheses/", + "description": "

Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.

\n\n

Return a list of unique strings that are valid with the minimum number of removals. You may return the answer in any order.

\n\n

 

\n

Example 1:

\n\n
\nInput: s = "()())()"\nOutput: ["(())()","()()()"]\n
\n\n

Example 2:

\n\n
\nInput: s = "(a)())()"\nOutput: ["(a())()","(a)()()"]\n
\n\n

Example 3:

\n\n
\nInput: s = ")("\nOutput: [""]\n
\n\n

 

\n

Constraints:

\n\n
    \n\t
  • 1 <= s.length <= 25
  • \n\t
  • s consists of lowercase English letters and parentheses '(' and ')'.
  • \n\t
  • There will be at most 20 parentheses in s.
  • \n
\n", + "difficulty": "hard", + "sample_test_cases": [ + "--arg1=\"()())()\"", + "--arg1=\"(a)())()\"", + "--arg1=\")(\"" + ], + "sample_test_results": [ + "['(())()','()()()']", + "['(a())()','(a)()()']", + "['']" + ], + "hidden_test_cases": [ + "--arg1=\"()())()\"", + "--arg1=\"(a)())()\"", + "--arg1=\")(\"", + "--arg1=\"((()\"", + "--arg1=\")()\"", + "--arg1=\"(())())\"", + "--arg1=\"())()(((\"", + "--arg1=\"(a)(b)(c))(\"", + "--arg1=\")()(\"", + "--arg1=\"((())\"" + ], + "hidden_test_results": [ + "['(())()','()()()']", + "['(a())()','(a)()()']", + "['']", + "['()']", + "['()']", + "['(()())','(())()']", + "['()()']", + "['(a(b)(c))','(a)(b(c))','(a)(b)(c)']", + "['()']", + "['(())']" + ], + "boilerplate": { + "python": "class Solution:\n def removeInvalidParentheses(self, s: str) -> List[str]:\n ", + "java": "class Solution {\n public List removeInvalidParentheses(String s) {\n \n }\n}", + "cpp": "class Solution {\npublic:\n vector removeInvalidParentheses(string s) {\n \n }\n};" + }, + "compare_func": { + "python": "return sorted(result) == sorted(eval(expected))", + "java": "return Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray());", + "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedVec;\nstd::istringstream iss(expected);\nstd::string token;\nwhile (std::getline(iss, token, ',')) {\n expectedVec.push_back(token);\n}\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn result == expectedVec;" + }, + "explanation": "https://www.youtube.com/watch?v=mgQ4O9iUEbg&pp=ygUjTmVldENvZGUgUmVtb3ZlIEludmFsaWQgUGFyZW50aGVzZXM%3D", + "method_name": "removeInvalidParentheses" + } +] \ No newline at end of file diff --git a/app/services/execution/service.py b/app/services/execution/service.py index 8e9acf0..e8eeab7 100644 --- a/app/services/execution/service.py +++ b/app/services/execution/service.py @@ -70,7 +70,7 @@ async def execute_code( {"input": tc, "expected": er} for tc, er in zip(sample_test_cases, sample_expected_results) ] - import pdb; pdb.set_trace() + base_name = os.path.basename(f.name).split('.')[0] file_content = gen.generate_test_file(code, base_name, method_name, test_data, sample_data, compare_func) f.write(file_content) diff --git a/app/services/execution/templates.py b/app/services/execution/templates.py index acf9954..9feafe7 100644 --- a/app/services/execution/templates.py +++ b/app/services/execution/templates.py @@ -78,15 +78,17 @@ def run_tests(solution, test_data, is_sample: bool = False): print("GLOBAL_ERROR:\\n" + traceback.format_exc()) """ -JAVA_TEMPLATE = r"""import org.junit.*; +JAVA_TEMPLATE = r""" +import org.junit.*; import org.junit.runner.JUnitCore; import com.google.gson.*; import java.lang.reflect.*; +import java.util.*; {code} public class {file_name} {{ - private static JsonObject compareResults(Object result, String expected) {{ + private static JsonObject compareResults(Object result, Object expected) {{ JsonObject comparison = new JsonObject(); comparison.addProperty("passed", result.toString().equals(expected)); return comparison; @@ -105,10 +107,9 @@ def run_tests(solution, test_data, is_sample: bool = False): Class[] paramTypes = getParameterTypes(inputStr); Object[] args = parseArguments(inputStr); - // Replace "maxProfit" with the method you want to test if needed. - Method method = Solution.class.getMethod("maxProfit", paramTypes); + Method method = Solution.class.getMethod("{method_name}", paramTypes); Object output = method.invoke(solution, args); - JsonObject comparison = compareResults(output, test.get("expected").getAsString()); + JsonObject comparison = compareResults(output, parseValue(test.get("expected").getAsString()); // bad code alert result.addProperty("passed", comparison.get("passed").getAsBoolean()); result.addProperty("output", gson.toJson(output)); }} catch (Exception e) {{ @@ -120,25 +121,192 @@ def run_tests(solution, test_data, is_sample: bool = False): return results; }} + private static Class getArrayType(Object arr) {{ + if (!arr.getClass().isArray()) {{ + return arr.getClass(); + }} + + Class componentType = arr.getClass().getComponentType(); + if (componentType.isPrimitive()) {{ + return arr.getClass(); + }} + + Object[] array = (Object[]) arr; + if (array.length == 0) {{ + return Object[].class; + }} + + boolean allIntegers = true; + boolean allArrays = true; + + for (Object element : array) {{ + if (element == null) continue; + if (!(element instanceof Integer)) allIntegers = false; + if (!element.getClass().isArray()) allArrays = false; + }} + + if (allIntegers) return int[].class; + if (allArrays) {{ + Object firstNonNull = null; + for (Object element : array) {{ + if (element != null) {{ + firstNonNull = element; + break; + }} + }} + if (firstNonNull != null) {{ + Class deeperType = getArrayType(firstNonNull); + return Array.newInstance(deeperType.getComponentType(), 0).getClass(); + }} + }} + return Object[].class; + }} + private static Class[] getParameterTypes(String input) {{ - return new Class[] {{ int[].class }}; + Object[] args = parseArguments(input); + Class[] types = new Class[args.length]; + for (int i = 0; i < args.length; i++) {{ + if (args[i] == null) {{ + types[i] = Object.class; + }} else if (args[i].getClass().isArray()) {{ + types[i] = getArrayType(args[i]); + }} else if (args[i] instanceof Integer || args[i] instanceof Long) {{ + types[i] = int.class; + }} else if (args[i] instanceof Double || args[i] instanceof Float) {{ + types[i] = double.class; + }} else if (args[i] instanceof Boolean) {{ + types[i] = boolean.class; + }} else if (args[i] instanceof Character) {{ + types[i] = char.class; + }} else {{ + types[i] = args[i].getClass(); + }} + }} + return types; }} private static Object[] parseArguments(String input) {{ - int startBracket = input.indexOf('['); - int endBracket = input.lastIndexOf(']'); - if (startBracket != -1 && endBracket != -1) {{ - String[] numStrs = input.substring(startBracket + 1, endBracket).split(","); - int[] nums = new int[numStrs.length]; - for (int i = 0; i < numStrs.length; i++) {{ - nums[i] = Integer.parseInt(numStrs[i].trim()); + List arguments = new ArrayList<>(); + String[] parts = input.split("--arg\\d+"); + + for (String part : parts) {{ + if (part.trim().isEmpty()) continue; + + String value = part.trim(); + if (value.startsWith("=")) {{ + value = value.substring(1).trim(); + }} + + arguments.add(parseValue(value)); + }} + + return arguments.toArray(); + }} + + private static List parseArray(String arrayContent) {{ + List elements = new ArrayList<>(); + if (arrayContent.trim().isEmpty()) return elements; + + StringBuilder current = new StringBuilder(); + int depth = 0; + boolean inString = false; + char stringChar = 0; + + for (char c : arrayContent.toCharArray()) {{ + if (c == '"' || c == '\'') {{ + if (!inString) {{ + inString = true; + stringChar = c; + }} else if (c == stringChar) {{ + inString = false; + }} + current.append(c); + }} else if (!inString && (c == '[' || c == '{{')) {{ + depth++; + current.append(c); + }} else if (!inString && (c == ']' || c == '}}')) {{ + depth--; + current.append(c); + }} else if (!inString && c == ',' && depth == 0) {{ + elements.add(parseValue(current.toString().trim())); + current = new StringBuilder(); + }} else {{ + current.append(c); }} - return new Object[] {{ nums }}; }} - return new Object[0]; + + if (current.length() > 0) {{ + elements.add(parseValue(current.toString().trim())); + }} + + return elements; + }} + + private static Object parseValue(String value) {{ + value = value.trim(); + + // Keep quoted strings as is + if ((value.startsWith("'") && value.endsWith("'")) || + (value.startsWith("\"") && value.endsWith("\""))) {{ + return value.substring(1, value.length() - 1); + }} + + // Handle null + if (value.equals("null")) {{ + return null; + }} + + // Handle boolean + if (value.equals("true") || value.equals("false")) {{ + return Boolean.parseBoolean(value); + }} + + // Handle arrays + if (value.startsWith("[") && value.endsWith("]")) {{ + List elements = parseArray(value.substring(1, value.length() - 1)); + if (elements.isEmpty()) return new Object[0]; + + // Check if all elements are arrays + boolean allArrays = elements.stream() + .allMatch(e -> e != null && e.getClass().isArray()); + if (allArrays) {{ + return elements.toArray(); + }} + + // Check if all elements are integers + boolean allIntegers = elements.stream() + .allMatch(e -> e instanceof Integer); + if (allIntegers) {{ + int[] result = new int[elements.size()]; + for (int i = 0; i < elements.size(); i++) {{ + result[i] = (Integer)elements.get(i); + }} + return result; + }} + + return elements.toArray(); + }} + + // Handle objects/maps + if (value.startsWith("{{") && value.endsWith("}}")) {{ + Map map = new HashMap<>(); + // TODO: Implement object parsing if needed + return map; + }} + + // Handle numbers + try {{ + if (value.contains(".")) {{ + return Double.parseDouble(value); + }} + return Integer.parseInt(value); + }} catch (NumberFormatException e) {{ + // If not a number, return as string + return value; + }} }} - // This method now wraps the results in a "test_results" field and adds a "summary" field. + // Wraps the results in a "test_results" field and adds a "summary" field. private static JsonObject createResultObject(JsonArray results) {{ JsonObject summary = new JsonObject(); int totalTests = results.size(); @@ -176,9 +344,9 @@ def run_tests(solution, test_data, is_sample: bool = False): }} }} }} - """ + CPP_TEMPLATE = r"""{code} \#include diff --git a/app/services/execution/test_generator.py b/app/services/execution/test_generator.py index 7af3090..1233668 100644 --- a/app/services/execution/test_generator.py +++ b/app/services/execution/test_generator.py @@ -73,17 +73,20 @@ def generate_test_file(self, code: str, file_name: str, method_name: str, test_d def get_file_extension(self, lang: str) -> str: return ".java" + + def format_test_data(self, method_name: str, test_data: List[Dict]) -> List[Dict]: + return test_data def process_quotes(self, json_str: str) -> str: return json_str.replace('"', '\\"').replace('\\\\"', '\\\\\\"') # cursed code alert class CppTestGenerator(TestGenerator): - def generate_test_file(self, code: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + def generate_test_file(self, code: str, file_name: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: test_data = self.format_test_data(method_name, test_data) sample_data = self.format_test_data(method_name, sample_data) return CPP_TEMPLATE.format( code=code, - method_name=method_name, + method_name=method_name, compare_func=compare_func, test_data=json.dumps(test_data), sample_data=json.dumps(sample_data), diff --git a/app/tests/conftest.py b/app/tests/conftest.py new file mode 100644 index 0000000..fecdc9f --- /dev/null +++ b/app/tests/conftest.py @@ -0,0 +1,11 @@ +import pytest + +pytest_plugins = ["pytest_asyncio"] + +@pytest.fixture +def event_loop(): + """Create an instance of the default event loop for each test case.""" + import asyncio + loop = asyncio.get_event_loop_policy().new_event_loop() + yield loop + loop.close() diff --git a/requirements.txt b/requirements.txt index 8b43a97..e2920e8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,4 +11,5 @@ SQLAlchemy-Utils==0.41.2 SQLAlchemy==2.0.36 openai==1.58.1 google-auth-oauthlib==1.2.1 -google-api-python-client==2.158.0 \ No newline at end of file +google-api-python-client==2.158.0 +pytest_asyncio==0.25.3 \ No newline at end of file From 73d1c91b36ec32850930d2ce5b77c8bbde93aad8 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Sat, 8 Feb 2025 22:17:50 -0500 Subject: [PATCH 05/24] Fixed python template --- .github/workflows/tests.yml | 74 ----- app/services/execution/templates.py | 2 +- app/services/execution/test_generator.py | 1 + app/tests/conftest.py | 11 - app/tests/unit/code_execution_test.py | 359 +++++++++++------------ 5 files changed, 175 insertions(+), 272 deletions(-) delete mode 100644 .github/workflows/tests.yml delete mode 100644 app/tests/conftest.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index eedb1b1..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: BeatCode Server Tests - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - test: - runs-on: ubuntu-latest - - services: - postgres: - image: postgres:latest - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: beatcode_test - ports: - - 5432:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python 3.11 - uses: actions/setup-python@v3 - with: - python-version: '3.11' - - - name: Set up Docker - uses: docker/setup-buildx-action@v2 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Copy environment file - run: | - cp .env.example .env - # Set test database configurations - echo "TEST_DB_USER=postgres" >> .env - echo "TEST_DB_PASSWORD=postgres" >> .env - echo "TEST_DB_HOST=localhost" >> .env - echo "TESTING=True" >> .env - - - name: Initialize database - run: | - cd app - python -m db.init --drop --droptest - - - name: Run unit tests - run: | - cd app - pytest tests/unit -v - - - name: Start server for integration tests - run: | - cd app - nohup uvicorn main:app --host 0.0.0.0 --port 8000 & - sleep 5 # Wait for server to start - - - name: Run integration tests - run: | - cd app - python tests/integration/auth_test.py - python tests/integration/game_test.py - python tests/integration/room_test.py \ No newline at end of file diff --git a/app/services/execution/templates.py b/app/services/execution/templates.py index 9feafe7..a1bd741 100644 --- a/app/services/execution/templates.py +++ b/app/services/execution/templates.py @@ -58,7 +58,7 @@ def run_tests(solution, test_data, is_sample: bool = False): "test_results": results, "summary": {{ "total_tests": len(results), - "passed_tests": len([r for r in results if r["passed"]), + "passed_tests": len([r for r in results if r["passed"]]), }} }} diff --git a/app/services/execution/test_generator.py b/app/services/execution/test_generator.py index 1233668..f2fe0c5 100644 --- a/app/services/execution/test_generator.py +++ b/app/services/execution/test_generator.py @@ -42,6 +42,7 @@ def format_test_data(self, method_name: str, test_data: List[Dict]) -> List[Dict "input": f"{method_name}({', '.join(params)})", "expected": test["expected"] }) + # import pdb; pdb.set_trace() return formatted class PythonTestGenerator(TestGenerator): diff --git a/app/tests/conftest.py b/app/tests/conftest.py deleted file mode 100644 index fecdc9f..0000000 --- a/app/tests/conftest.py +++ /dev/null @@ -1,11 +0,0 @@ -import pytest - -pytest_plugins = ["pytest_asyncio"] - -@pytest.fixture -def event_loop(): - """Create an instance of the default event loop for each test case.""" - import asyncio - loop = asyncio.get_event_loop_policy().new_event_loop() - yield loop - loop.close() diff --git a/app/tests/unit/code_execution_test.py b/app/tests/unit/code_execution_test.py index a9abd22..e08b3ae 100644 --- a/app/tests/unit/code_execution_test.py +++ b/app/tests/unit/code_execution_test.py @@ -10,15 +10,14 @@ from services.execution.service import CodeExecutionService # fmt: on - -@pytest.fixture -def executor(): - return CodeExecutionService() - - -@pytest.fixture -def valid_solution(): - return """ +class TestPython: + @pytest.fixture + def executor(self): + return CodeExecutionService() + + @pytest.fixture + def valid_solution(self): + return """ class Solution: def add(self, a: int, b: int) -> int: return a + b @@ -33,28 +32,25 @@ def twoSum(self, nums: list[int], target: int) -> list[int]: return [] """ - -@pytest.fixture -def invalid_syntax_solution(): - return """ + @pytest.fixture + def invalid_syntax_solution(self): + return """ class Solution: def add(self, a: int, b: int) -> int return a + b """ - -@pytest.fixture -def undefined_variable_solution(): - return """ + @pytest.fixture + def undefined_variable_solution(self): + return """ class Solution: def add(self, a: int, b: int) -> int: return n """ - -@pytest.fixture -def infinite_loop_solution(): - return """ + @pytest.fixture + def infinite_loop_solution(self): + return """ class Solution: def add(self, a: int, b: int) -> int: while True: @@ -62,183 +58,174 @@ def add(self, a: int, b: int) -> int: return a + b """ - -@pytest.fixture -def memory_heavy_solution(): - return """ + @pytest.fixture + def memory_heavy_solution(self): + return """ class Solution: def add(self, a: int, b: int) -> int: x = [i for i in range(10**8)] return a + b """ + @pytest.mark.asyncio + async def test_successful_execution(self, executor, valid_solution): + result = await executor.execute_code( + code=valid_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + expected_results=["3", "0", "0"], + sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_expected_results=["3", "0", "0"], + difficulty="easy", + compare_func="return result == int(expected)" + ) -@pytest.mark.asyncio -async def test_successful_execution(executor, valid_solution): - result = await executor.execute_code( - code=valid_solution, - test_cases=["add(1, 2)", "add(0, 0)", "add(-1, 1)"], - expected_results=["3", "0", "0"], - sample_test_cases=["add(1, 2)", "add(0, 0)", "add(-1, 1)"], - sample_expected_results=["3", "0", "0"], - difficulty="easy", - compare_func="return str(result) == expected" - ) - - assert result.success - assert len(result.test_results) == 3 - assert all(test["passed"] for test in result.test_results) - - assert True - - -@pytest.mark.asyncio -async def test_failed_test_cases(executor, valid_solution): - result = await executor.execute_code( - code=valid_solution, - test_cases=["add(1, 2)", "add(0, 0)"], - expected_results=["4", "1"], - sample_test_cases=["add(1, 2)", "add(0, 0)", "add(-1, 1)"], - sample_expected_results=["3", "0", "0"], - difficulty="easy", - compare_func="return str(result) == expected" - ) - - assert result.success - assert len(result.test_results) == 2 - assert not any(test["passed"] for test in result.test_results) - assert all(test["error"] is None for test in result.test_results) - - -@pytest.mark.asyncio -async def test_syntax_error(executor, invalid_syntax_solution): - result = await executor.execute_code( - code=invalid_syntax_solution, - test_cases=["add(1, 2)"], - expected_results=["3"], - sample_test_cases=["add(1, 2)", "add(0, 0)", "add(-1, 1)"], - sample_expected_results=["3", "0", "0"], - difficulty="easy", - compare_func="return str(result) == expected" - ) - - assert not result.success - assert "SyntaxError" in result.message - - -@pytest.mark.asyncio -async def test_undefined_error(executor, undefined_variable_solution): - result = await executor.execute_code( - code=undefined_variable_solution, - test_cases=["add(1, 2)", "add(2, 2)"], - expected_results=["3", "4"], - sample_test_cases=["add(1, 2)", "add(0, 0)", "add(-1, 1)"], - sample_expected_results=["3", "0", "0"], - difficulty="easy", - compare_func="return str(result) == expected" - ) - - assert result.success - assert len(result.test_results) == 2 - assert not all(test["passed"] for test in result.test_results) - assert all(test["error"] is not None for test in result.test_results) - - -@pytest.mark.asyncio -async def test_timeout(executor, infinite_loop_solution): - result = await executor.execute_code( - code=infinite_loop_solution, - test_cases=["add(1, 2)"], - expected_results=["3"], - sample_test_cases=["add(1, 2)", "add(0, 0)", "add(-1, 1)"], - sample_expected_results=["3", "0", "0"], - difficulty="easy", - compare_func="return str(result) == expected" - ) - - assert not result.success - assert "Time Limit Exceeded" in result.message - - -@pytest.mark.asyncio -async def test_memory_limit(executor, memory_heavy_solution): - result = await executor.execute_code( - code=memory_heavy_solution, - test_cases=["add(1, 2)"], - expected_results=["3"], - sample_test_cases=["add(1, 2)", "add(0, 0)", "add(-1, 1)"], - sample_expected_results=["3", "0", "0"], - difficulty="easy", - compare_func="return str(result) == expected" - ) - - assert not result.success - assert "Memory Limit Exceeded" in result.message - - -@pytest.mark.asyncio -async def test_complex_problem(executor, valid_solution): - result = await executor.execute_code( - code=valid_solution, - test_cases=[ - "twoSum([2,7,11,15], 9)", - "twoSum([3,2,4], 6)", - "twoSum([3,3], 6)" - ], - expected_results=[ - "[0,1]", - "[1,2]", - "[0,1]" - ], - sample_test_cases=[ - "twoSum([2,7,11,15], 9)", - "twoSum([3,2,4], 6)", - "twoSum([3,3], 6)" - ], - sample_expected_results=[ - "[0,1]", - "[1,2]", - "[0,1]" - ], - difficulty="easy", - compare_func=""" -def normalize(s): - return str(sorted(eval(s))) -return normalize(str(result)) == normalize(expected) -""" - ) - - assert result.success - assert len(result.test_results) == 3 - assert all(test["passed"] for test in result.test_results) - - -@pytest.mark.asyncio -async def test_concurrent_executions(executor, valid_solution): - tasks = [] - for _ in range(20): - tasks.append( - executor.execute_code( - code=valid_solution, - test_cases=["add(1, 2)"], - expected_results=["3"], - sample_test_cases=["add(1, 2)"], - sample_expected_results=["3"], - difficulty="hard", - compare_func="return str(result) == expected" - ) + assert result.success + assert len(result.test_results) == 3 + assert all(test["passed"] for test in result.test_results) + + @pytest.mark.asyncio + async def test_failed_test_cases(self, executor, valid_solution): + result = await executor.execute_code( + code=valid_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0"], + expected_results=["4", "1"], + sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_expected_results=["3", "0", "0"], + difficulty="easy", + compare_func="return result == int(expected)" ) - results = await asyncio.gather(*tasks) - assert all(r.success for r in results) - assert len(results) == 20 + assert result.success + assert len(result.test_results) == 2 + assert not any(test["passed"] for test in result.test_results) + assert all(test["error"] is None for test in result.test_results) + + @pytest.mark.asyncio + async def test_syntax_error(self, executor, invalid_syntax_solution): + result = await executor.execute_code( + code=invalid_syntax_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_expected_results=["3", "0", "0"], + difficulty="easy", + compare_func="return result == int(expected)" + ) + + assert not result.success + assert "SyntaxError" in result.message + + @pytest.mark.asyncio + async def test_undefined_error(self, executor, undefined_variable_solution): + result = await executor.execute_code( + code=undefined_variable_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2", "--arg1=2 --arg2=2"], + expected_results=["3", "4"], + sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_expected_results=["3", "0", "0"], + difficulty="easy", + compare_func="return result == int(expected)" + ) + + assert result.success + assert len(result.test_results) == 2 + assert not all(test["passed"] for test in result.test_results) + assert all(test["error"] is not None for test in result.test_results) + + @pytest.mark.asyncio + async def test_timeout(self, executor, infinite_loop_solution): + result = await executor.execute_code( + code=infinite_loop_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_expected_results=["3", "0", "0"], + difficulty="easy", + compare_func="return result == int(expected)" + ) + assert not result.success + assert "Time Limit Exceeded" in result.message + + @pytest.mark.asyncio + async def test_memory_limit(self, executor, memory_heavy_solution): + result = await executor.execute_code( + code=memory_heavy_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_expected_results=["3", "0", "0"], + difficulty="easy", + compare_func="return result == int(expected)" + ) + + assert not result.success + assert "Memory Limit Exceeded" in result.message + + @pytest.mark.asyncio + async def test_complex_problem(self, executor, valid_solution): + result = await executor.execute_code( + code=valid_solution, + method_name="twoSum", + test_cases=[ + "--arg1=[2,7,11,15] --arg2=9", + "--arg1=[3,2,4] --arg2=6", + "--arg1=[3,3] --arg2=6" + ], + expected_results=[ + "[0,1]", + "[1,2]", + "[0,1]" + ], + sample_test_cases=[ + "--arg1=[2,7,11,15] --arg2=9", + "--arg1=[3,2,4] --arg2=6", + "--arg1=[3,3] --arg2=6" + ], + sample_expected_results=[ + "[0,1]", + "[1,2]", + "[0,1]" + ], + difficulty="easy", + compare_func="return sorted(result) == sorted(eval(expected))" + ) + + assert result.success + assert len(result.test_results) == 3 + assert all(test["passed"] for test in result.test_results) + + @pytest.mark.asyncio + async def test_concurrent_executions(self, executor, valid_solution): + tasks = [] + for _ in range(20): + tasks.append( + executor.execute_code( + code=valid_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2"], + sample_expected_results=["3"], + difficulty="hard", + compare_func="return result == int(expected)" + ) + ) -def test_different_difficulty_semaphores(executor): - assert executor._execution_semaphores["easy"]._value > \ - executor._execution_semaphores["medium"]._value > \ - executor._execution_semaphores["hard"]._value + results = await asyncio.gather(*tasks) + assert all(r.success for r in results) + assert len(results) == 20 + def test_different_difficulty_semaphores(self, executor): + assert executor._execution_semaphores["easy"]._value > \ + executor._execution_semaphores["medium"]._value > \ + executor._execution_semaphores["hard"]._value if __name__ == "__main__": pytest.main([__file__, "-v"]) From df6f6033d929c2b944097f6ce8dc6ebfed7945ee Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Sat, 8 Feb 2025 22:19:11 -0500 Subject: [PATCH 06/24] Add tests for python --- .github/workflows/test.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c141472 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: Unit Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Create and activate virtual environment + run: | + python -m venv venv + source venv/bin/activate + + - name: Install dependencies + run: python -m pip install -r requirements.txt + + - name: Run unit tests + run: | + cd app + pytest tests/unit \ No newline at end of file From 091986d3dc7b7e75b9b2914f9c4ae54369702239 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Sat, 8 Feb 2025 22:21:47 -0500 Subject: [PATCH 07/24] Add env --- .env.example | 3 +++ .github/workflows/test.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.env.example b/.env.example index e7f2bca..49c4cd9 100644 --- a/.env.example +++ b/.env.example @@ -45,6 +45,9 @@ MAX_CONCURRENT="20, 10, 5" OPENAI_API_KEY="your_api_key_here" ### Docker Settings ### +DOCKER_IMAGE_PYTHON=beatcode-python:latest +DOCKER_IMAGE_JAVA=beatcode-java:latest +DOCKER_IMAGE_CPP=beatcode-cpp:latest DOCKER_IMAGE=python:3.11-alpine DOCKER_MEMORY_LIMIT="128, 256, 512" DOCKER_TIME_LIMIT="2000, 3000, 5000" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c141472..29f258f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,9 @@ jobs: - name: Install dependencies run: python -m pip install -r requirements.txt + - name: Setup environment file + run: cp .env.example .env + - name: Run unit tests run: | cd app From 922a0f3983b40d45ced4f70001a936df8ab96760 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Sun, 9 Feb 2025 01:24:07 -0500 Subject: [PATCH 08/24] Fixed java parsing and added tests --- app/core/config.py | 2 - app/services/execution/templates.py | 46 +++-- app/services/execution/test_generator.py | 1 - app/tests/unit/code_execution_test.py | 240 ++++++++++++++++++++++- 4 files changed, 264 insertions(+), 25 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 97a6b68..7dc5a69 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -48,8 +48,6 @@ class Settings(BaseSettings): REFRESH_TOKEN_EXPIRE_DAYS: int # Time in days for the refresh token to expire # Code Execution - JAVA_PACKAGES: str # Packages to install for running Java codes - CPP_PACKAGES: str # Packages to install for running C++ codes MAX_CONCURRENT: str # Maximum number of problems that can be executed concurrently for each difficulty OPENAI_API_KEY: str # API key for OpenAI (Used for Runtime Analysis) diff --git a/app/services/execution/templates.py b/app/services/execution/templates.py index a1bd741..1c8c3ee 100644 --- a/app/services/execution/templates.py +++ b/app/services/execution/templates.py @@ -88,10 +88,8 @@ def run_tests(solution, test_data, is_sample: bool = False): {code} public class {file_name} {{ - private static JsonObject compareResults(Object result, Object expected) {{ - JsonObject comparison = new JsonObject(); - comparison.addProperty("passed", result.toString().equals(expected)); - return comparison; + private static boolean compare(Object result, Object expected) {{ + {compare_func} }} public static JsonArray runTests(Solution solution, JsonArray testData) {{ @@ -109,8 +107,8 @@ def run_tests(solution, test_data, is_sample: bool = False): Method method = Solution.class.getMethod("{method_name}", paramTypes); Object output = method.invoke(solution, args); - JsonObject comparison = compareResults(output, parseValue(test.get("expected").getAsString()); // bad code alert - result.addProperty("passed", comparison.get("passed").getAsBoolean()); + boolean passed = compare(output, parseValue(test.get("expected").getAsString())); + result.addProperty("passed", passed); result.addProperty("output", gson.toJson(output)); }} catch (Exception e) {{ result.addProperty("error", e.toString()); @@ -203,10 +201,12 @@ def run_tests(solution, test_data, is_sample: bool = False): return arguments.toArray(); }} - private static List parseArray(String arrayContent) {{ + private static Object[] parseArray(String arrayContent) {{ List elements = new ArrayList<>(); - if (arrayContent.trim().isEmpty()) return elements; - + if (arrayContent.trim().isEmpty()) {{ + return new Object[0]; + }} + StringBuilder current = new StringBuilder(); int depth = 0; boolean inString = false; @@ -229,7 +229,7 @@ def run_tests(solution, test_data, is_sample: bool = False): current.append(c); }} else if (!inString && c == ',' && depth == 0) {{ elements.add(parseValue(current.toString().trim())); - current = new StringBuilder(); + current.setLength(0); // reset the StringBuilder }} else {{ current.append(c); }} @@ -239,7 +239,7 @@ def run_tests(solution, test_data, is_sample: bool = False): elements.add(parseValue(current.toString().trim())); }} - return elements; + return elements.toArray(new Object[0]); }} private static Object parseValue(String value) {{ @@ -263,28 +263,28 @@ def run_tests(solution, test_data, is_sample: bool = False): // Handle arrays if (value.startsWith("[") && value.endsWith("]")) {{ - List elements = parseArray(value.substring(1, value.length() - 1)); - if (elements.isEmpty()) return new Object[0]; + Object[] elements = parseArray(value.substring(1, value.length() - 1)); + if (elements.length == 0) return elements; // Check if all elements are arrays - boolean allArrays = elements.stream() + boolean allArrays = Arrays.stream(elements) .allMatch(e -> e != null && e.getClass().isArray()); if (allArrays) {{ - return elements.toArray(); + return elements; }} // Check if all elements are integers - boolean allIntegers = elements.stream() + boolean allIntegers = Arrays.stream(elements) .allMatch(e -> e instanceof Integer); if (allIntegers) {{ - int[] result = new int[elements.size()]; - for (int i = 0; i < elements.size(); i++) {{ - result[i] = (Integer)elements.get(i); + int[] result = new int[elements.length]; + for (int i = 0; i < elements.length; i++) {{ + result[i] = (Integer)elements[i]; }} return result; }} - return elements.toArray(); + return elements; }} // Handle objects/maps @@ -340,7 +340,11 @@ def run_tests(solution, test_data, is_sample: bool = False): System.out.println("EXECUTION_RESULTS:" + results); }} catch (Exception e) {{ - System.out.println("GLOBAL_ERROR:\n" + e); + Throwable cause = e; + if (e instanceof InvocationTargetException && e.getCause() != null) {{ + cause = e.getCause(); + }} + System.out.println("GLOBAL_ERROR:\n" + cause.toString()); }} }} }} diff --git a/app/services/execution/test_generator.py b/app/services/execution/test_generator.py index f2fe0c5..1233668 100644 --- a/app/services/execution/test_generator.py +++ b/app/services/execution/test_generator.py @@ -42,7 +42,6 @@ def format_test_data(self, method_name: str, test_data: List[Dict]) -> List[Dict "input": f"{method_name}({', '.join(params)})", "expected": test["expected"] }) - # import pdb; pdb.set_trace() return formatted class PythonTestGenerator(TestGenerator): diff --git a/app/tests/unit/code_execution_test.py b/app/tests/unit/code_execution_test.py index e08b3ae..a53befe 100644 --- a/app/tests/unit/code_execution_test.py +++ b/app/tests/unit/code_execution_test.py @@ -134,7 +134,7 @@ async def test_undefined_error(self, executor, undefined_variable_solution): assert result.success assert len(result.test_results) == 2 assert not all(test["passed"] for test in result.test_results) - assert all(test["error"] is not None for test in result.test_results) + assert all("error" in test for test in result.test_results) @pytest.mark.asyncio async def test_timeout(self, executor, infinite_loop_solution): @@ -227,5 +227,243 @@ def test_different_difficulty_semaphores(self, executor): executor._execution_semaphores["medium"]._value > \ executor._execution_semaphores["hard"]._value +class TestJava: + @pytest.fixture + def executor(self): + return CodeExecutionService() + + @pytest.fixture + def valid_solution(self): + return """ +class Solution { + public int add(int a, int b) { + return a + b; + } + + public int[] twoSum(int[] nums, int target) { + Map seen = new HashMap<>(); + for (int i = 0; i < nums.length; i++) { + int complement = target - nums[i]; + if (seen.containsKey(complement)) { + return new int[] {seen.get(complement), i}; + } + seen.put(nums[i], i); + } + return new int[]{}; + } +} +""" + + @pytest.fixture + def invalid_syntax_solution(self): + return """ +class Solution { + public int add(int a, int b) { + return a + b + } +} +""" + + @pytest.fixture + def undefined_variable_solution(self): + return """ +class Solution { + public int add(int a, int b) { + return n; + } +} +""" + + @pytest.fixture + def infinite_loop_solution(self): + return """ +class Solution { + public int add(int a, int b) { + while(true) {} + return a + b; + } +} +""" + + @pytest.fixture + def memory_heavy_solution(self): + return """ + class Solution { + public int add(int a, int b) { + List x = new ArrayList<>(); + for (int i = 0; i < 10000000; i++) { + x.add(i); + } + return a + b; + } + } + """ + + @pytest.mark.asyncio + async def test_successful_execution(self, executor, valid_solution): + result = await executor.execute_code( + code=valid_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + expected_results=["3", "0", "0"], + sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_expected_results=["3", "0", "0"], + difficulty="easy", + compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", + lang="java" + ) + + assert result.success + assert len(result.test_results) == 3 + assert all(test["passed"] for test in result.test_results) + + @pytest.mark.asyncio + async def test_failed_test_cases(self, executor, valid_solution): + result = await executor.execute_code( + code=valid_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0"], + expected_results=["4", "1"], + sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0"], + sample_expected_results=["3", "0"], + difficulty="easy", + compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", + lang="java" + ) + + assert result.success + assert len(result.test_results) == 2 + assert not any(test["passed"] for test in result.test_results) + assert all("error" not in test for test in result.test_results) + + @pytest.mark.asyncio + async def test_syntax_error(self, executor, invalid_syntax_solution): + result = await executor.execute_code( + code=invalid_syntax_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2"], + sample_expected_results=["3"], + difficulty="easy", + compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", + lang="java" + ) + + assert not result.success + assert "error" in result.message.lower() + + @pytest.mark.asyncio + async def test_undefined_error(self, executor, undefined_variable_solution): + result = await executor.execute_code( + code=undefined_variable_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2"], + sample_expected_results=["3"], + difficulty="easy", + compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", + lang="java" + ) + + assert not result.success + assert "error" in result.message.lower() + + @pytest.mark.asyncio + async def test_timeout(self, executor, infinite_loop_solution): + result = await executor.execute_code( + code=infinite_loop_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2"], + sample_expected_results=["3"], + difficulty="easy", + compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", + lang="java" + ) + + assert not result.success + assert "error" in result.message.lower() + + @pytest.mark.asyncio + async def test_memory_limit(self, executor, memory_heavy_solution): + result = await executor.execute_code( + code=memory_heavy_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2"], + sample_expected_results=["3"], + difficulty="easy", + compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", + lang="java" + ) + + assert all("error" in test for test in result.test_results) + + @pytest.mark.asyncio + async def test_complex_problem(self, executor, valid_solution): + result = await executor.execute_code( + code=valid_solution, + method_name="twoSum", + test_cases=[ + "--arg1=[2,7,11,15] --arg2=9", + "--arg1=[3,2,4] --arg2=6", + "--arg1=[3,3] --arg2=6" + ], + expected_results=[ + "[0,1]", + "[1,2]", + "[0,1]" + ], + sample_test_cases=[ + "--arg1=[2,7,11,15] --arg2=9", + "--arg1=[3,2,4] --arg2=6", + "--arg1=[3,3] --arg2=6" + ], + sample_expected_results=[ + "[0,1]", + "[1,2]", + "[0,1]" + ], + difficulty="easy", + compare_func="return Arrays.equals((int[]) result, (int[]) expected);", + lang="java" + ) + + assert result.success + assert len(result.test_results) == 3 + assert all(test["passed"] for test in result.test_results) + + @pytest.mark.asyncio + async def test_concurrent_executions(self, executor, valid_solution): + tasks = [] + for _ in range(20): + tasks.append( + executor.execute_code( + code=valid_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2"], + sample_expected_results=["3"], + difficulty="hard", + compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", + lang="java" + ) + ) + + results = await asyncio.gather(*tasks) + assert all(r.success for r in results) + assert len(results) == 20 + + def test_different_difficulty_semaphores(self, executor): + assert executor._execution_semaphores["easy"]._value > \ + executor._execution_semaphores["medium"]._value > \ + executor._execution_semaphores["hard"]._value + + if __name__ == "__main__": pytest.main([__file__, "-v"]) From af522ba33c37b8f2645ff1dfcec192b3a5c2e4fc Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Sun, 9 Feb 2025 01:30:52 -0500 Subject: [PATCH 09/24] Build image for workflow --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 29f258f..0a5ccab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,6 +29,13 @@ jobs: - name: Setup environment file run: cp .env.example .env + - name: Build Docker image + run: | + docker build -t beatcode-python ./docker/python/ + docker build -t beatcode-java ./docker/java/ + docker build -t beatcode-cpp ./docker/cpp/ + working-directory: ./app + - name: Run unit tests run: | cd app From a420b53f8091f619d5af89723831370fc0022d78 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Sun, 9 Feb 2025 01:34:50 -0500 Subject: [PATCH 10/24] Fix dockerfile path for workflow --- .github/workflows/test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0a5ccab..91b694b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,10 +31,9 @@ jobs: - name: Build Docker image run: | - docker build -t beatcode-python ./docker/python/ - docker build -t beatcode-java ./docker/java/ - docker build -t beatcode-cpp ./docker/cpp/ - working-directory: ./app + docker build -t beatcode-python -f ./docker/python/Dockerfile . + docker build -t beatcode-java -f ./docker/java/Dockerfile . + docker build -t beatcode-cpp -f ./docker/cpp/Dockerfile . - name: Run unit tests run: | From 901a8ba85b3f73cb33185dc3c8fa4b2a5adacd16 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Sun, 9 Feb 2025 01:40:17 -0500 Subject: [PATCH 11/24] Removed problem tests since they need db connection --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 91b694b..e29f83e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,4 +38,4 @@ jobs: - name: Run unit tests run: | cd app - pytest tests/unit \ No newline at end of file + pytest tests/unit/code_execution_test.py -v \ No newline at end of file From de8e34476241748f3245684de2ca26c6415c1908 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Sun, 9 Feb 2025 01:52:41 -0500 Subject: [PATCH 12/24] Removed workflow since it denies access to write files and doesn't have enough memory to run :( --- .github/workflows/test.yml | 41 -------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index e29f83e..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Unit Tests - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Create and activate virtual environment - run: | - python -m venv venv - source venv/bin/activate - - - name: Install dependencies - run: python -m pip install -r requirements.txt - - - name: Setup environment file - run: cp .env.example .env - - - name: Build Docker image - run: | - docker build -t beatcode-python -f ./docker/python/Dockerfile . - docker build -t beatcode-java -f ./docker/java/Dockerfile . - docker build -t beatcode-cpp -f ./docker/cpp/Dockerfile . - - - name: Run unit tests - run: | - cd app - pytest tests/unit/code_execution_test.py -v \ No newline at end of file From e0c840860296e6c96dff272255a7790a84445513 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Mon, 10 Feb 2025 00:01:14 -0500 Subject: [PATCH 13/24] Finished setting up cpp container --- app/api/endpoints/game.py | 2 - app/db/combined.json | 344 +++++++++++------------ app/services/execution/docker.py | 2 +- app/services/execution/templates.py | 235 +++++++++++++--- app/services/execution/test_generator.py | 58 ++-- app/tests/unit/code_execution_test.py | 257 ++++++++++++++++- docker/cpp/Dockerfile | 6 +- 7 files changed, 655 insertions(+), 249 deletions(-) diff --git a/app/api/endpoints/game.py b/app/api/endpoints/game.py index 6d76252..6fe446c 100644 --- a/app/api/endpoints/game.py +++ b/app/api/endpoints/game.py @@ -243,8 +243,6 @@ async def game_websocket( "data": game_view.model_dump() }) - print(game_state.problems[0]) - # Send the current problem if the game is in progress if game_state.status == GameStatus.IN_PROGRESS and player.current_problem_index < len(game_state.problems): current_problem = ProblemManager.prepare_problem_for_client( diff --git a/app/db/combined.json b/app/db/combined.json index c445b21..bd20d90 100644 --- a/app/db/combined.json +++ b/app/db/combined.json @@ -45,8 +45,8 @@ }, "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", - "java": "return Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray());", - "cpp": "std::sort(result.begin(), result.end());\nstd::vector expected_vector;\n// Convert expected string to vector (example using integer parsing)\nstd::stringstream ss(expected);\nint number;\nwhile (ss >> number) {\n expected_vector.push_back(number);\n if (ss.peek() == ',') {\n ss.ignore();\n }\n}\nstd::sort(expected_vector.begin(), expected_vector.end());\nreturn result == expected_vector;" + "java": "int[] expectedArray = gson.fromJson((String) expected, int[].class);\nArrays.sort((int[]) result);\nArrays.sort(expectedArray);\nreturn Arrays.equals((int[]) result, expectedArray);", + "cpp": "std::sort(result.begin(), result.end());\nstd::vector expected_vector;\nstd::stringstream ss(expected.asString());\nint number;\nwhile (ss >> number) {\n expected_vector.push_back(number);\n if (ss.peek() == ',') {\n ss.ignore();\n }\n}\nstd::sort(expected_vector.begin(), expected_vector.end());\nreturn result == expected_vector;" }, "explanation": "https://www.youtube.com/watch?v=KLlXCFG5TnA&pp=ygUQTmVldENvZGUgVHdvIFN1bQ%3D%3D", "method_name": "twoSum" @@ -97,8 +97,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "try {\n return result.equals(evaluateExpression(expected));\n} catch (Exception e) {\n return false;\n}\n\nString evaluateExpression(String expression) {\n // This section requires a method to safely evaluate the expression in the expected string.\n // Using a scripting engine or library for mathematical/eval expression such as \"javax.script.ScriptEngineManager\"\n // would typically be safe and effective here.\n ScriptEngineManager manager = new ScriptEngineManager();\n ScriptEngine engine = manager.getEngineByName(\"js\"); // Using JavaScript for simple evaluation\n try {\n Object evaluatedResult = engine.eval(expression);\n return String.valueOf(evaluatedResult);\n } catch (ScriptException e) {\n throw new RuntimeException(\"Error evaluating expression\", e);\n }\n}", - "cpp": "#include \n#include \n#include \n\n// This function will evaluate a string expression and return the corresponding result\nbool evaluateExpression(double result, const std::string& expression) {\n // Defining possible operations\n std::unordered_map> operations = {\n {'+', std::plus()},\n {'-', std::minus()},\n {'*', std::multiplies()},\n {'/', std::divides()}\n };\n\n // Scan the expression to evaluate it\n size_t pos = expression.find_first_of(\"+-*/\");\n if (pos != std::string::npos) {\n char op = expression[pos];\n double left = std::stod(expression.substr(0, pos));\n double right = std::stod(expression.substr(pos + 1));\n double evalResult = operations[op](left, right);\n return result == evalResult;\n }\n\n return false; // Return false if no operation found or invalid expression\n}\n\n// Usage:\n// bool isEqual = evaluateExpression(result, expected);" + "java": "return result.equals(Boolean.valueOf(expected.toString()));", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=yubRKwixN-U&pp=ygUaTmVldENvZGUgUGFsaW5kcm9tZSBOdW1iZXI%3D", "method_name": "isPalindrome" @@ -147,8 +147,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "try {\n return result == (Boolean) engine.eval(expected);\n} catch (ScriptException e) {\n e.printStackTrace();\n return false;\n}", - "cpp": "return result == std::stoi(expected);" + "java": "return result.equals(expected);", + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=0sWShKIJoo4&pp=ygUeTmVldENvZGUgTG9uZ2VzdCBDb21tb24gUHJlZml4", "method_name": "longestCommonPrefix" @@ -201,8 +201,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "try {\n // Assuming the expected is a Java expression as a string.\n Object expectedResult = eval(expected); // Evaluate the expression\n return result.equals(expectedResult);\n} catch (Exception e) {\n return false; // Return false if there's any error in evaluation\n}", - "cpp": "#include \n#include \n#include \n\nbool isNumber(const std::string& str) {\n for (char const &c : str) {\n if (std::isdigit(c) == 0) return false;\n }\n return true;\n}\n\ndouble calculateExpression(const std::string& expr);\n\ndouble evalExpression(const std::string& expr) {\n return calculateExpression(expr);\n}\n\nbool compareFunction(const std::string& result, const std::string& expected) {\n if (isNumber(result) && isNumber(expected)) {\n return std::stod(result) == evalExpression(expected);\n }\n throw std::invalid_argument(\"Both inputs must be numeric in string format.\");\n}" + "java": "return result.equals(Boolean.parseBoolean((String) expected));", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=WTzjTskDFMg&pp=ygUaTmVldENvZGUgVmFsaWQgUGFyZW50aGVzZXM%3D", "method_name": "isValid" @@ -251,8 +251,8 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return Integer.parseInt(expected) == result;", - "cpp": "return result == static_cast(expected);" + "java": "return Integer.parseInt(expected.toString()) == (int) result;", + "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=Gjkhm1gYIMw&pp=ygU7TmVldENvZGUgRmluZCB0aGUgSW5kZXggb2YgdGhlIEZpcnN0IE9jY3VycmVuY2UgaW4gYSBTdHJpbmc%3D", "method_name": "strStr" @@ -304,7 +304,7 @@ "compare_func": { "python": "return result == int(expected)", "java": "return Integer.valueOf(result).equals(Integer.valueOf(expected));", - "cpp": "return result == std::stoi(expected);" + "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=K-RYzDZkzCI&pp=ygUfTmVldENvZGUgU2VhcmNoIEluc2VydCBQb3NpdGlvbg%3D%3D", "method_name": "searchInsert" @@ -355,8 +355,8 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == static_cast(expected);" + "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=KT9rltZTybQ&pp=ygUcTmVldENvZGUgTGVuZ3RoIG9mIExhc3QgV29yZA%3D%3D", "method_name": "lengthOfLastWord" @@ -407,8 +407,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return Arrays.equals((int[]) result, gson.fromJson((String) expected, int[].class));", + "cpp": "std::vector expectedVec = jsonToValue>(expected);\nreturn result == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=jIaA8boiG1s&pp=ygURTmVldENvZGUgUGx1cyBPbmU%3D", "method_name": "plusOne" @@ -457,8 +457,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return Objects.equals(result, expected);", - "cpp": "return result == std::stoi(expected);" + "java": "return Objects.equals((String) result, (String) expected);", + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=keuWJ47xG8g&pp=ygUTTmVldENvZGUgQWRkIEJpbmFyeQ%3D%3D", "method_name": "addBinary" @@ -507,8 +507,8 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return result == Integer.parseInt(expected);", - "cpp": "return result == std::stoi(expected);" + "java": "return result == Integer.parseInt((String) expected);", + "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=Y0lT9Fck7qI&pp=ygUYTmVldENvZGUgQ2xpbWJpbmcgU3RhaXJz", "method_name": "climbStairs" @@ -559,8 +559,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=1pkOgXD63yU&pp=ygUoTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jaw%3D%3D", "method_name": "maxProfit" @@ -611,8 +611,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=jJXJ16kPFWg&pp=ygUZTmVldENvZGUgVmFsaWQgUGFsaW5kcm9tZQ%3D%3D", "method_name": "isPalindrome" @@ -663,8 +663,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "#include \n#include \n#include \n#include \n#include \n\n// Function to evaluate mathematical expressions from a string\n// Simple implementation just for demonstration, assumed input well-formed\nstd::pair evaluateExpression(const std::string& expr) {\n std::istringstream iss(expr);\n double result;\n iss >> result; // just evaluates the first number for simplicity\n return std::make_pair(result, !iss.fail());\n}\n\ntemplate \nbool compareFunction(T result, const std::string& expected) {\n auto [evaluated, valid] = evaluateExpression(expected);\n return valid && result == evaluated;\n}\n\n// Example usage\nint main() {\n // Suppose we have result as double from some calculations\n double result = 42.0;\n std::string expected = \"42\";\n \n if (compareFunction(result, expected)) {\n std::cout << \"Result matches the expected expression.\" << std::endl;\n } else {\n std::cout << \"Result does not match the expected expression.\" << std::endl;\n }\n \n return 0;\n}" + "java": "return result.equals(expected);", + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=X_vJDpCCuoA&pp=ygUhTmVldENvZGUgRXhjZWwgU2hlZXQgQ29sdW1uIFRpdGxl", "method_name": "convertToTitle" @@ -715,8 +715,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return result.compare(expected) == 0;" + "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=ljz85bxOYJ0&pp=ygUVTmVldENvZGUgSGFwcHkgTnVtYmVy", "method_name": "isHappy" @@ -767,8 +767,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return Boolean.parseBoolean(result.toString()) == Boolean.parseBoolean(expected.toString());", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=7yF-U1hLEqQ&pp=ygUbTmVldENvZGUgSXNvbW9ycGhpYyBTdHJpbmdz", "method_name": "isIsomorphic" @@ -819,8 +819,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=ypn0aZ0nrL4&pp=ygUeTmVldENvZGUgQ29udGFpbnMgRHVwbGljYXRlIElJ", "method_name": "containsNearbyDuplicate" @@ -871,8 +871,8 @@ }, "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", - "java": "return Arrays.equals(Arrays.sort(result), Arrays.sort(new Gson().fromJson(expected, Object[].class)));", - "cpp": "std::sort(result.begin(), result.end());\nstd::vector expected_result;\neval(expected, expected_result); // Assume eval is a function that populates expected_result\nstd::sort(expected_result.begin(), expected_result.end());\nreturn result == expected_result;" + "java": "List resultList = (List) result;\nList expectedList = new Gson().fromJson((String) expected, List.class);\nCollections.sort(resultList);\nCollections.sort(expectedList);\nreturn resultList.equals(expectedList);", + "cpp": "std::vector expected_result;\neval(expected, expected_result); // Assume eval is a function that populates expected_result\nstd::sort(result.begin(), result.end());\nstd::sort(expected_result.begin(), expected_result.end());\nreturn result == expected_result;" }, "explanation": "https://www.youtube.com/watch?v=ZHJDwbfqoa8&pp=ygUXTmVldENvZGUgU3VtbWFyeSBSYW5nZXM%3D", "method_name": "summaryRanges" @@ -923,8 +923,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return ((Boolean) result).toString().equalsIgnoreCase(expected.toString());", + "cpp": "return result.asBool() == (expected.asString() == \"true\");" }, "explanation": "https://www.youtube.com/watch?v=H2bjttEV4Vc&pp=ygUVTmVldENvZGUgUG93ZXIgb2YgVHdv", "method_name": "isPowerOfTwo" @@ -975,8 +975,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=M0Zay1Qr9ws&pp=ygUUTmVldENvZGUgVWdseSBOdW1iZXI%3D", "method_name": "isUgly" @@ -1027,8 +1027,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return ((Boolean) result).equals(Boolean.parseBoolean((String) expected));", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=W_akoecmCbM&pp=ygUVTmVldENvZGUgV29yZCBQYXR0ZXJu", "method_name": "wordPattern" @@ -1079,8 +1079,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "cpp": "return result.asBool() == (expected.asString() == \"true\");" }, "explanation": "https://www.youtube.com/watch?v=ndR2buBWVc8&pp=ygURTmVldENvZGUgTmltIEdhbWU%3D", "method_name": "canWinNim" @@ -1131,8 +1131,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return std::tolower(std::string(result).compare(expected)) == 0;" + "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=M2P2BAFmLlo&pp=ygUXTmVldENvZGUgUG93ZXIgb2YgVGhyZWU%3D", "method_name": "isPowerOfThree" @@ -1183,8 +1183,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return String.valueOf(result).toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return String.valueOf(result).equalsIgnoreCase(expected);", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=qEYZPwnlM0U&pp=ygUWTmVldENvZGUgUG93ZXIgb2YgRm91cg%3D%3D", "method_name": "isPowerOfFour" @@ -1233,8 +1233,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "#include \n#include \n#include \n\nbool evaluateAndCompare(const std::string& result, const std::string& expected) {\n try {\n // Evaluate the expected expression\n int expectedValue = std::stoi(expected);\n int resultValue = std::stoi(result);\n // Compare result and evaluated expected value\n return resultValue == expectedValue;\n } catch (const std::invalid_argument& e) {\n // Handle conversion errors\n return false;\n } catch (const std::out_of_range& e) {\n // Handle out of range errors\n return false;\n }\n}" + "java": "return result.equals(expected);", + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=uHYjUMR3Tg8&pp=ygUjTmVldENvZGUgUmV2ZXJzZSBWb3dlbHMgb2YgYSBTdHJpbmc%3D", "method_name": "reverseVowels" @@ -1283,7 +1283,7 @@ }, "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", - "java": "return Arrays.equals(result.toArray(), Arrays.stream(eval(expected)).sorted().toArray())", + "java": "int[] resultArray = (int[]) result;\nint[] expectedArray = gson.fromJson(expected, int[].class);\nArrays.sort(resultArray);\nArrays.sort(expectedArray);\nreturn Arrays.equals(resultArray, expectedArray);", "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedVec;\nistringstream iss(expected.substr(1, expected.size() - 2));\nint number;\nwhile (iss >> number) {\n expectedVec.push_back(number);\n if (iss.peek() == ',')\n iss.ignore();\n}\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn result == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=fwUTXaMom6U&pp=ygUmTmVldENvZGUgSW50ZXJzZWN0aW9uIG9mIFR3byBBcnJheXMgSUk%3D", @@ -1335,8 +1335,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=Cg_wWPHJ2Sk&pp=ygUdTmVldENvZGUgVmFsaWQgUGVyZmVjdCBTcXVhcmU%3D", "method_name": "isPerfectSquare" @@ -1387,8 +1387,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return Objects.equals(result, Integer.parseInt(expected));", - "cpp": "return (result == std::stoi(expected)); // assuming expected is a string representation of an integer" + "java": "return result.equals(expected);", + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=a4wqKR-znBE&pp=ygUcTmVldENvZGUgRmluZCB0aGUgRGlmZmVyZW5jZQ%3D%3D", "method_name": "findTheDifference" @@ -1439,8 +1439,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=99RVfqklbCE&pp=ygUXTmVldENvZGUgSXMgU3Vic2VxdWVuY2U%3D", "method_name": "isSubsequence" @@ -1491,7 +1491,7 @@ }, "compare_func": { "python": "def sorted_list_strings(lst):\n return sorted([str(x) for x in eval(lst)])\n return sorted(result) == sorted_list_strings(expected)", - "java": "try {\n List evalResult = Arrays.asList(eval(expected).replace(\"[\", \"\").replace(\"]\", \"\").split(\",\"));\n List resultAsString = result.stream().map(Object::toString).collect(Collectors.toList());\n Collections.sort(resultAsString);\n Collections.sort(evalResult);\n return resultAsString.equals(evalResult);\n} catch (Exception e) {\n return false;\n}", + "java": "try {\n List evalResult = Arrays.asList(eval(expected).replace(\"[\", \"\").replace(\"]\", \"\").replace(\"'\", \"\").split(\",\"));\n List resultAsString = result.stream().map(Object::toString).collect(Collectors.toList());\n Collections.sort(resultAsString);\n Collections.sort(evalResult);\n return resultAsString.equals(evalResult);\n} catch (Exception e) {\n return false;\n}", "cpp": "std::multiset sorted_list_strings(const std::string& lst) {\n std::multiset sortedStrings;\n std::string cleaned = lst;\n // Remove leading/trailing whitespace\n cleaned.erase(0, cleaned.find_first_not_of(\" \\t\\n\\r\"));\n cleaned.erase(cleaned.find_last_not_of(\" \\t\\n\\r\") + 1);\n \n // Substitute all commas with spaces\n std::replace(cleaned.begin(), cleaned.end(), ',', ' ');\n std::stringstream ss(cleaned);\n std::string item;\n \n while(ss >> item) {\n sortedStrings.insert(item);\n }\n return sortedStrings;\n}\n\nreturn std::multiset(result.begin(), result.end()) == sorted_list_strings(expected);" }, "explanation": "https://www.youtube.com/watch?v=0BanwDe6cMY&pp=ygUVTmVldENvZGUgQmluYXJ5IFdhdGNo", @@ -1543,8 +1543,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "boolean resultAsExpected = false;\ntry {\n ScriptEngineManager mgr = new ScriptEngineManager();\n ScriptEngine engine = mgr.getEngineByName(\"JavaScript\");\n Object expectedVal = engine.eval(expected);\n if (expectedVal instanceof Boolean) {\n resultAsExpected = (boolean) expectedVal == result;\n } else if (expectedVal instanceof Number) {\n resultAsExpected = Double.compare(((Number) expectedVal).doubleValue(), ((Number) result).doubleValue()) == 0;\n } else {\n resultAsExpected = expectedVal.equals(result);\n }\n} catch (ScriptException e) {\n // Handle scripting evaluation errors if necessary\n}", - "cpp": "return result == std::stoi(expected);" + "java": "return result.equals(expected);", + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=I1HBykyZvbc&pp=ygUoTmVldENvZGUgQ29udmVydCBhIE51bWJlciB0byBIZXhhZGVjaW1hbA%3D%3D", "method_name": "toHex" @@ -1595,8 +1595,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" + "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=_g9jrLuAphs&pp=ygUbTmVldENvZGUgTG9uZ2VzdCBQYWxpbmRyb21l", "method_name": "longestPalindrome" @@ -1647,8 +1647,8 @@ }, "compare_func": { "python": "return str(result) == eval(expected)", - "java": "return result.toString().equals(String.valueOf(eval(expected)));", - "cpp": "bool compareFunction(const std::string &result, const std::string &expected) {\n return result == expected;\n}\n" + "java": "return result.toString().equals(expected.toString());", + "cpp": "return result == expected;" }, "explanation": "https://www.youtube.com/watch?v=jziDtPZJ4fw&pp=ygUUTmVldENvZGUgQWRkIFN0cmluZ3M%3D", "method_name": "addStrings" @@ -1699,8 +1699,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" + "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=5rHz_6s2Buw&pp=ygUYTmVldENvZGUgQXJyYW5naW5nIENvaW5z", "method_name": "arrangeCoins" @@ -1751,8 +1751,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" + "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=JW8fgvoxPTg&pp=ygUXTmVldENvZGUgQXNzaWduIENvb2tpZXM%3D", "method_name": "findContentChildren" @@ -1803,8 +1803,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=2qEmA76Unm4&pp=ygUjTmVldENvZGUgUmVwZWF0ZWQgU3Vic3RyaW5nIFBhdHRlcm4%3D", "method_name": "repeatedSubstringPattern" @@ -1854,7 +1854,7 @@ "compare_func": { "python": "return result == eval(expected)", "java": "return result.equals(expected);", - "cpp": "return result == std::stoi(expected);" + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=3KMlpe8eZ0E&pp=ygUfTmVldENvZGUgTGljZW5zZSBLZXkgRm9ybWF0dGluZw%3D%3D", "method_name": "licenseKeyFormatting" @@ -1955,8 +1955,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" + "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=NejSCTIdd5k&pp=ygUYTmVldENvZGUgVGVlbW8gQXR0YWNraW5n", "method_name": "findPoisonedDuration" @@ -2005,8 +2005,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "try {\n return result.equals(Class.forName(expected).getConstructor().newInstance());\n} catch (Exception e) {\n return false;\n}", - "cpp": "try {\n return result == std::stoi(expected);\n} catch(const std::invalid_argument &ia) {\n return false;\n}\nreturn false;" + "java": "return result.equals(expected);", + "cpp": "try {\n return result.asString() == expected.asString();\n} catch(const std::exception &e) {\n return false;\n}" }, "explanation": "https://www.youtube.com/watch?v=sbmq-efwOsA&pp=ygUPTmVldENvZGUgQmFzZSA3", "method_name": "convertToBase7" @@ -2055,8 +2055,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=HLZLwjzIVGo&pp=ygUXTmVldENvZGUgUGVyZmVjdCBOdW1iZXI%3D", "method_name": "checkPerfectNumber" @@ -2107,8 +2107,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "try {\n ScriptEngineManager manager = new ScriptEngineManager();\n ScriptEngine engine = manager.getEngineByName(\"JavaScript\");\n Object expectedValue = engine.eval(expected);\n return result.equals(expectedValue);\n} catch (ScriptException e) {\n e.printStackTrace();\n return false;\n}", - "cpp": "try {\n return result == std::stod(expected);\n} catch (const std::invalid_argument&) {\n // Handle the case where the expected string is not a valid double\n return false;\n} catch (const std::out_of_range&) {\n // Handle the case where the number is out of double's range\n return false;\n}" + "java": "return result.equals(expected);", + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=Q2Tw6gcVEwc&pp=ygUaTmVldENvZGUgWmlnemFnIENvbnZlcnNpb24%3D", "method_name": "convert" @@ -2157,8 +2157,8 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return Integer.parseInt(result) == expected;", - "cpp": "return result == static_cast(expected);" + "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=UuiTKBwPgAo&pp=ygUiTmVldENvZGUgQ29udGFpbmVyIFdpdGggTW9zdCBXYXRlcg%3D%3D", "method_name": "maxArea" @@ -2207,8 +2207,8 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return result == static_cast(expected);" + "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=PXWT4wzkA6M&pp=ygUVTmVldENvZGUgM1N1bSBDbG9zZXN0", "method_name": "threeSumClosest" @@ -2259,8 +2259,8 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return result == static_cast(expected);" + "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=U8XENwh8Oy8&pp=ygUnTmVldENvZGUgU2VhcmNoIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5", "method_name": "search" @@ -2311,8 +2311,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "try {\n return Objects.equals(result, eval(expected));\n} catch (Exception e) {\n return false;\n}", - "cpp": "return result == std::stoi(expected);" + "java": "if (result instanceof int[] && expected instanceof String) {\n int[] resultArray = (int[]) result;\n String expectedStr = (String) expected;\n // Parse the expected string to an int array\n String[] parts = expectedStr.replaceAll(\"[()\\s]\", \"\").split(\",\");\n int[] expectedArray = new int[parts.length];\n for (int i = 0; i < parts.length; i++) {\n expectedArray[i] = Integer.parseInt(parts[i]);\n }\n // Compare the arrays\n return Arrays.equals(resultArray, expectedArray);\n}\nreturn false;", + "cpp": "if (result.isArray() && expected.isString()) {\n // Convert expected string to a vector of integers\n std::string expectedStr = expected.asString();\n std::regex re(\"\\\\((-?\\\\d+),\\\\s*(-?\\\\d+)\\\\)\");\n std::smatch match;\n if (std::regex_search(expectedStr, match, re)) {\n std::vector expectedVec = {std::stoi(match[1]), std::stoi(match[2])};\n // Convert result JSON array to a vector of integers\n std::vector resultVec;\n for (const auto& elem : result) {\n resultVec.push_back(elem.asInt());\n }\n // Compare the vectors\n return resultVec == expectedVec;\n }\n}\nreturn false;" }, "explanation": "https://www.youtube.com/watch?v=4sQL7R5ySUU&pp=ygVATmVldENvZGUgRmluZCBGaXJzdCBhbmQgTGFzdCBQb3NpdGlvbiBvZiBFbGVtZW50IGluIFNvcnRlZCBBcnJheQ%3D%3D", "method_name": "searchRange" @@ -2364,7 +2364,7 @@ "compare_func": { "python": "return result == eval(expected)", "java": "return Objects.equals(result, expected);", - "cpp": "return result == std::stoi(expected);" + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=iP4RH2zespg&pp=ygUWTmVldENvZGUgQ291bnQgYW5kIFNheQ%3D%3D", "method_name": "countAndSay" @@ -2415,8 +2415,8 @@ }, "compare_func": { "python": "return sorted([sorted(x) for x in result]) == eval(expected)", - "java": "Arrays.deepEquals(\n result.stream().map(arr -> Arrays.stream(arr).sorted().toArray(Integer[]::new)).sorted((a1, a2) -> Arrays.compare(a1, a2)).toArray(Integer[][]::new), \n Arrays.stream(expected).map(arr -> Arrays.stream(arr).sorted().toArray(Integer[]::new)).sorted((a1, a2) -> Arrays.compare(a1, a2)).toArray(Integer[][]::new)\n)", - "cpp": "std::vector> sortedResult;\nfor (const auto& vec : result) {\n std::vector sortedVec = vec;\n std::sort(sortedVec.begin(), sortedVec.end());\n sortedResult.push_back(sortedVec);\n}\nstd::sort(sortedResult.begin(), sortedResult.end());\nreturn sortedResult == expected;" + "java": "Integer[][] resultArray = (Integer[][]) result;\nInteger[][] expectedArray = (Integer[][]) expected;\n\n// Sort each individual list in the result\nfor (Integer[] arr : resultArray) {\n Arrays.sort(arr);\n}\n// Sort the entire result array\nArrays.sort(resultArray, (a1, a2) -> Arrays.compare(a1, a2));\n\n// Sort each individual list in the expected\nfor (Integer[] arr : expectedArray) {\n Arrays.sort(arr);\n}\n// Sort the entire expected array\nArrays.sort(expectedArray, (a1, a2) -> Arrays.compare(a1, a2));\n\n// Compare the sorted arrays\nreturn Arrays.deepEquals(resultArray, expectedArray);", + "cpp": "std::vector> sortedResult;\nfor (const auto& vec : result) {\n std::vector sortedVec = vec;\n std::sort(sortedVec.begin(), sortedVec.end());\n sortedResult.push_back(sortedVec);\n}\nstd::sort(sortedResult.begin(), sortedResult.end());\n\nstd::vector> sortedExpected;\nfor (const auto& vec : expected) {\n std::vector sortedVec = vec;\n std::sort(sortedVec.begin(), sortedVec.end());\n sortedExpected.push_back(sortedVec);\n}\nstd::sort(sortedExpected.begin(), sortedExpected.end());\n\nreturn sortedResult == sortedExpected;" }, "explanation": "https://www.youtube.com/watch?v=FOyRpNUSFeA&pp=ygUbTmVldENvZGUgQ29tYmluYXRpb24gU3VtIElJ", "method_name": "combinationSum2" @@ -2467,8 +2467,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "{\n return result == std::stoi(expected);\n}" + "java": "return result.equals(expected);", + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=1vZswirL8Y8&pp=ygUZTmVldENvZGUgTXVsdGlwbHkgU3RyaW5ncw%3D%3D", "method_name": "multiply" @@ -2519,8 +2519,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "std::to_string(result) == expected;" + "java": "return Integer.parseInt((String) expected) == (int) result;", + "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=dJ7sWiOoK7g&pp=ygUVTmVldENvZGUgSnVtcCBHYW1lIElJ", "method_name": "jump" @@ -2571,8 +2571,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=5WZl3MMT0Eg&pp=ygUZTmVldENvZGUgTWF4aW11bSBTdWJhcnJheQ%3D%3D", "method_name": "maxSubArray" @@ -2621,8 +2621,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "List resultList = (List) result;\nList expectedList = new Gson().fromJson((String) expected, new TypeToken>() {}.getType());\nreturn resultList.equals(expectedList);", + "cpp": "std::vector resultVec = jsonToValue>(result);\nstd::vector expectedVec = jsonToValue>(expected);\nreturn resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=BJnMZNwUk1M&pp=ygUWTmVldENvZGUgU3BpcmFsIE1hdHJpeA%3D%3D", "method_name": "spiralOrder" @@ -2671,8 +2671,8 @@ }, "compare_func": { "python": "return str(sorted(result)) == str(eval(expected))", - "java": "return Arrays.toString(Arrays.stream(result).sorted().toArray()).equals(Arrays.toString(eval(expected)))", - "cpp": "std::string resultStr = std::accumulate(result.begin(), result.end(), std::string(), [](std::string a, int b) { return a + std::to_string(b) + \", \"; });\nresultStr.pop_back(); // Remove last comma\nresultStr.pop_back(); // Remove last space\nstd::string expectedStr = std::accumulate(expected.begin(), expected.end(), std::string(), [](std::string a, int b) { return a + std::to_string(b) + \", \"; });\nexpectedStr.pop_back(); // Remove last comma\nexpectedStr.pop_back(); // Remove last space\n\nstd::sort(result.begin(), result.end());\n\nreturn resultStr == expectedStr;" + "java": "int[][] resultArray = (int[][]) result;\nint[][] expectedArray = (int[][]) expected;\n\n// Sort both arrays of intervals\nArrays.sort(resultArray, (a, b) -> Integer.compare(a[0], b[0]));\nArrays.sort(expectedArray, (a, b) -> Integer.compare(a[0], b[0]));\n\n// Compare the sorted arrays\nreturn Arrays.deepEquals(resultArray, expectedArray);", + "cpp": "// Convert expected to a vector of vectors of ints\nstd::vector> expectedVec;\nfor (const auto& interval : expected) {\n std::vector temp;\n for (const auto& num : interval) {\n temp.push_back(num.asInt());\n }\n expectedVec.push_back(temp);\n}\n\n// Sort both result and expected vectors\nstd::sort(result.begin(), result.end());\nstd::sort(expectedVec.begin(), expectedVec.end());\n\n// Compare the sorted vectors\nreturn result == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=44H3cEC2fFM&pp=ygUYTmVldENvZGUgTWVyZ2UgSW50ZXJ2YWxz", "method_name": "merge" @@ -2721,8 +2721,8 @@ }, "compare_func": { "python": "return str(sorted(result)) == str(eval(expected))", - "java": "return result.stream().sorted().toString().equals(String.valueOf(new ScriptEngineManager().getEngineByName(\"JavaScript\").eval(expected)))", - "cpp": "std::string sortedResult = result;\nstd::sort(sortedResult.begin(), sortedResult.end());\nstd::string evaluatedExpected = std::to_string(eval(expected));\nreturn sortedResult == evaluatedExpected;" + "java": "int[][] resultArray = (int[][]) result;\nint[][] expectedArray = new Gson().fromJson(expected.toString(), int[][].class);\n\n// Sort both arrays by the first element of each interval\nArrays.sort(resultArray, (a, b) -> Integer.compare(a[0], b[0]));\nArrays.sort(expectedArray, (a, b) -> Integer.compare(a[0], b[0]));\n\n// Compare the sorted arrays\nreturn Arrays.deepEquals(resultArray, expectedArray);", + "cpp": "// Convert result and expected to vectors of vectors of integers\nstd::vector> resultVec = jsonToValue>>(result);\nstd::vector> expectedVec = jsonToValue>>(expected);\n\n// Sort both vectors by the first element of each interval\nstd::sort(resultVec.begin(), resultVec.end(), [](const std::vector& a, const std::vector& b) {\n return a[0] < b[0];\n});\nstd::sort(expectedVec.begin(), expectedVec.end(), [](const std::vector& a, const std::vector& b) {\n return a[0] < b[0];\n});\n\n// Compare the sorted vectors\nreturn resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=A8NUOmlwOlM&pp=ygUYTmVldENvZGUgSW5zZXJ0IEludGVydmFs", "method_name": "insert" @@ -2771,8 +2771,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=d3UOz7zdE4I&pp=ygUYTmVldENvZGUgVW5pcXVlIFBhdGhzIElJ", "method_name": "uniquePathsWithObstacles" @@ -2827,8 +2827,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "try {\n return result == Integer.parseInt(expected);\n} catch (NumberFormatException e) {\n return false;\n}", - "cpp": "return result == std::stoi(expected);" + "java": "return result.equals(expected);", + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=qYlHrAKJfyA&pp=ygUWTmVldENvZGUgU2ltcGxpZnkgUGF0aA%3D%3D", "method_name": "simplifyPath" @@ -2879,8 +2879,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=XYi2-LPrwm4&pp=ygUWTmVldENvZGUgRWRpdCBEaXN0YW5jZQ%3D%3D", "method_name": "minDistance" @@ -2931,8 +2931,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().equalsIgnoreCase(expected);", - "cpp": "return toLowerCase(result) == toLowerCase(expected); \n\nstd::string toLowerCase(const std::string &input) {\n std::string lowercaseString;\n for (char c : input) {\n lowercaseString += std::tolower(c);\n }\n return lowercaseString;\n}" + "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=Ber2pi2C0j0&pp=ygUbTmVldENvZGUgU2VhcmNoIGEgMkQgTWF0cml4", "method_name": "searchMatrix" @@ -2983,8 +2983,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=pfiQ_PS1g8E&pp=ygUUTmVldENvZGUgV29yZCBTZWFyY2g%3D", "method_name": "exist" @@ -3035,8 +3035,8 @@ }, "compare_func": { "python": "return sorted([sorted(x) for x in result]) == sorted(eval(expected))", - "java": "return Arrays.equals(\n Arrays.stream(result)\n .map(subArray -> Arrays.stream(subArray).sorted().toArray(String[]::new))\n .sorted(new Comparator<>() {\n public int compare(String[] a, String[] b) {\n for (int i = 0; i < Math.min(a.length, b.length); i++) {\n int cmp = a[i].compareTo(b[i]);\n if (cmp != 0) {\n return cmp;\n }\n }\n return Integer.compare(a.length, b.length);\n }\n }).toArray(String[][]::new), \n Arrays.stream(expected)\n .sorted(new Comparator<>() {\n public int compare(String[] a, String[] b) {\n for (int i = 0; i < Math.min(a.length, b.length); i++) {\n int cmp = a[i].compareTo(b[i]);\n if (cmp != 0) {\n return cmp;\n }\n }\n return Integer.compare(a.length, b.length);\n }\n }).toArray(String[][]::new)\n);", - "cpp": "#include \n#include \n\nbool compareFunction(const std::vector>& result, const std::vector>& expected) {\n auto sort_inner_vectors = [](std::vector& vec) {\n std::sort(vec.begin(), vec.end());\n };\n\n // Sort inner vectors of result\n std::vector> sorted_result = result;\n std::for_each(sorted_result.begin(), sorted_result.end(), sort_inner_vectors);\n std::sort(sorted_result.begin(), sorted_result.end());\n\n // Sort inner vectors of expected\n std::vector> sorted_expected = expected;\n std::for_each(sorted_expected.begin(), sorted_expected.end(), sort_inner_vectors);\n std::sort(sorted_expected.begin(), sorted_expected.end());\n\n return sorted_result == sorted_expected;\n}" + "java": "List> resultList = (List>) result;\nList> expectedList = (List>) expected;\n\nComparator> listComparator = (a, b) -> {\n int minLength = Math.min(a.size(), b.size());\n for (int i = 0; i < minLength; i++) {\n int cmp = Integer.compare(a.get(i), b.get(i));\n if (cmp != 0) {\n return cmp;\n }\n }\n return Integer.compare(a.size(), b.size());\n};\n\nresultList.forEach(Collections::sort);\nexpectedList.forEach(Collections::sort);\n\nCollections.sort(resultList, listComparator);\nCollections.sort(expectedList, listComparator);\n\nreturn resultList.equals(expectedList);", + "cpp": "bool compareFunction(const std::vector>& result, const std::vector>& expected) {\n auto sort_inner_vectors = [](std::vector& vec) {\n std::sort(vec.begin(), vec.end());\n };\n\n // Sort inner vectors of result\n std::vector> sorted_result = result;\n std::for_each(sorted_result.begin(), sorted_result.end(), sort_inner_vectors);\n std::sort(sorted_result.begin(), sorted_result.end());\n\n // Sort inner vectors of expected\n std::vector> sorted_expected = expected;\n std::for_each(sorted_expected.begin(), sorted_expected.end(), sort_inner_vectors);\n std::sort(sorted_expected.begin(), sorted_expected.end());\n\n return sorted_result == sorted_expected;\n}" }, "explanation": "https://www.youtube.com/watch?v=Vn2v6ajA7U0&pp=ygUTTmVldENvZGUgU3Vic2V0cyBJSQ%3D%3D", "method_name": "subsetsWithDup" @@ -3087,8 +3087,8 @@ }, "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", - "java": "return Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray());", - "cpp": "std::sort(result.begin(), result.end());\nstd::sort(expected.begin(), expected.end());\nreturn result == expected;" + "java": "List resultList = (List) result;\nList expectedList = (List) expected;\nCollections.sort(resultList);\nCollections.sort(expectedList);\nreturn resultList.equals(expectedList);", + "cpp": "std::vector expectedVec = jsonToValue>(expected);\nstd::sort(result.begin(), result.end());\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn result == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=61tN4YEdiTM&pp=ygUdTmVldENvZGUgUmVzdG9yZSBJUCBBZGRyZXNzZXM%3D", "method_name": "restoreIpAddresses" @@ -3139,8 +3139,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "std::transform(result.begin(), result.end(), result.begin(), ::tolower);\nstd::transform(expected.begin(), expected.end(), expected.begin(), ::tolower);\nreturn result == expected;" + "java": "return ((Boolean) result).toString().toLowerCase().equals(expected.toString().toLowerCase());", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=3Rw3p9LrgvE&pp=ygUcTmVldENvZGUgSW50ZXJsZWF2aW5nIFN0cmluZw%3D%3D", "method_name": "isInterleave" @@ -3189,8 +3189,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=OM1MTokvxs4&pp=ygURTmVldENvZGUgVHJpYW5nbGU%3D", "method_name": "minimumTotal" @@ -3239,8 +3239,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=P6RZZMu_maU&pp=ygUlTmVldENvZGUgTG9uZ2VzdCBDb25zZWN1dGl2ZSBTZXF1ZW5jZQ%3D%3D", "method_name": "longestConsecutive" @@ -3289,8 +3289,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return Integer.toString((Integer) result).equals(expected);", + "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=lJwbPZGo05A&pp=ygUUTmVldENvZGUgR2FzIFN0YXRpb24%3D", "method_name": "canCompleteCircuit" @@ -3341,8 +3341,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toLowerCase().equals(expected.toLowerCase());", - "cpp": "return std::tolower(result) == std::tolower(expected);" + "java": "return ((Boolean) result).equals(Boolean.parseBoolean(expected.toString()));", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=Sx9NNgInc3A&pp=ygUTTmVldENvZGUgV29yZCBCcmVhaw%3D%3D", "method_name": "wordBreak" @@ -3393,8 +3393,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" + "java": "return Integer.parseInt((String) result) == Integer.parseInt((String) expected);", + "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=iu0082c4HDE&pp=ygUpTmVldENvZGUgRXZhbHVhdGUgUmV2ZXJzZSBQb2xpc2ggTm90YXRpb24%3D", "method_name": "evalRPN" @@ -3445,8 +3445,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" + "java": "return result.equals(expected);", + "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=7kUEwiwwnlA&pp=ygUiTmVldENvZGUgUmV2ZXJzZSBXb3JkcyBpbiBhIFN0cmluZw%3D%3D", "method_name": "reverseWords" @@ -3497,8 +3497,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return static_cast(result) == static_cast(expected);" + "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "cpp": "return static_cast(result) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=nIVW4P8b1VA&pp=ygUtTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5", "method_name": "findMin" @@ -3547,8 +3547,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "return result == std::stoi(expected);" + "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=kMzJy9es7Hc&pp=ygUaTmVldENvZGUgRmluZCBQZWFrIEVsZW1lbnQ%3D", "method_name": "findPeakElement" @@ -3597,8 +3597,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" + "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=imCKT3T2Oao&pp=ygUUTmVldENvZGUgTWF4aW11bSBHYXA%3D", "method_name": "maximumGap" @@ -3649,8 +3649,8 @@ }, "compare_func": { "python": "return abs(float(result) - float(expected)) < 0.00001", - "java": "return Math.abs(Double.parseDouble(result) - Double.parseDouble(expected)) < 0.00001;", - "cpp": "return std::abs(std::stof(result) - std::stof(expected)) < 0.00001;" + "java": "return Math.abs((double) result - (double) expected) < 0.00001;", + "cpp": "return std::abs(result.asDouble() - expected.asDouble()) < 0.00001;" }, "explanation": "https://www.youtube.com/watch?v=q6IEA26hvXc&pp=ygUkTmVldENvZGUgTWVkaWFuIG9mIFR3byBTb3J0ZWQgQXJyYXlz", "method_name": "findMedianSortedArrays" @@ -3701,8 +3701,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return Integer.toString((Integer) result).equals(expected);", + "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=8g78yfzMlao&pp=ygUfTmVldENvZGUgRmlyc3QgTWlzc2luZyBQb3NpdGl2ZQ%3D%3D", "method_name": "firstMissingPositive" @@ -3753,8 +3753,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "try {\n Object expectedValue = engine.eval(expected);\n return result.equals(expectedValue);\n} catch (ScriptException e) {\n // Handle exception, maybe log it or return false\n return false;\n}", - "cpp": "#include \n#include \n#include \n\nbool compareFunction(const std::string& result, const std::string& expected) {\n std::istringstream iss(expected);\n int n;\n iss >> n; // Assuming the expected value is an integer for direct evaluation after comparison\n \n return std::to_string(n) == result; // Assuming result should also be a string representation of an integer\n}" + "java": "return result.equals(expected);", + "cpp": "return result == expected;" }, "explanation": "https://www.youtube.com/watch?v=W9SIlE2jhBQ&pp=ygUdTmVldENvZGUgUGVybXV0YXRpb24gU2VxdWVuY2U%3D", "method_name": "getPermutation" @@ -3805,8 +3805,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return result.equals(eval(expected));", - "cpp": "#include \n#include \n\nbool compareFunction(const std::string& result, const std::string& expected) {\n std::stringstream ss;\n ss << expected; \n\n // Ensure that the expected string represents a valid number\n double evalExpected;\n if(!(ss >> evalExpected)) {\n return false; // Invalid expected string\n }\n\n double evalResult;\n std::stringstream resultStream(result);\n if(!(resultStream >> evalResult)) {\n return false; // Invalid result string\n }\n\n return evalResult == evalExpected;\n}" + "java": "List resultList = (List) result;\nList expectedList = (List) expected;\nreturn resultList.equals(expectedList);", + "cpp": "std::vector resultList = jsonToValue>(result);\nstd::vector expectedList = jsonToValue>(expected);\nreturn resultList == expectedList;" }, "explanation": "https://www.youtube.com/watch?v=TzMl4Z7pVh8&pp=ygUbTmVldENvZGUgVGV4dCBKdXN0aWZpY2F0aW9u", "method_name": "fullJustify" @@ -3857,8 +3857,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "try {\n Object evaluatedExpected = evaluate(expected);\n return result.equals(evaluatedExpected);\n} catch (ScriptException e) {\n e.printStackTrace();\n return false;\n}", - "cpp": "#include \n#include \n#include \n\nbool compareFunction(const std::string& result, const std::string& expected) {\n std::istringstream expectedStream(expected);\n double expectedValue;\n if (!(expectedStream >> expectedValue)) {\n // Handling the case if expected cannot be evaluated as a double\n return false;\n }\n\n std::istringstream resultStream(result);\n double resultValue;\n if (!(resultStream >> resultValue)) {\n // Handling the case if result cannot be evaluated as a double\n return false;\n }\n\n // Checking if the result and evaluated expected value are approximately equal for floating point comparisons\n return std::fabs(resultValue - expectedValue) < 1e-9; // Adjust the tolerance as needed\n}" + "java": "return result.equals(expected);", + "cpp": "return result == expected;" }, "explanation": "https://www.youtube.com/watch?v=jSto0O4AJbM&pp=ygUhTmVldENvZGUgTWluaW11bSBXaW5kb3cgU3Vic3RyaW5n", "method_name": "minWindow" @@ -3907,8 +3907,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" + "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=zx5Sw9130L0&pp=ygUnTmVldENvZGUgTGFyZ2VzdCBSZWN0YW5nbGUgaW4gSGlzdG9ncmFt", "method_name": "largestRectangleArea" @@ -3959,8 +3959,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" + "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=tOylVCugy9k&pp=ygUaTmVldENvZGUgTWF4aW1hbCBSZWN0YW5nbGU%3D", "method_name": "maximalRectangle" @@ -4011,8 +4011,8 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return result.toString().toLowerCase().equals(expected.toLowerCase());", - "cpp": "return tolower(result) == tolower(expected);" + "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=MDmZm_aVDF8&pp=ygUYTmVldENvZGUgU2NyYW1ibGUgU3RyaW5n", "method_name": "isScramble" @@ -4061,8 +4061,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" + "java": "return Integer.parseInt((String) result) == Integer.parseInt((String) expected);", + "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=-RDzMJ33nx8&pp=ygUeTmVldENvZGUgRGlzdGluY3QgU3Vic2VxdWVuY2Vz", "method_name": "numDistinct" @@ -4113,8 +4113,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" + "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=37s1_xBiqH0&pp=ygUsTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJSUk%3D", "method_name": "maxProfit" @@ -4165,8 +4165,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=h9iTnkgv05E&pp=ygUUTmVldENvZGUgV29yZCBMYWRkZXI%3D", "method_name": "ladderLength" @@ -4217,8 +4217,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=1IzCRCcK17A&pp=ygUOTmVldENvZGUgQ2FuZHk%3D", "method_name": "candy" @@ -4270,7 +4270,7 @@ "compare_func": { "python": "def normalize(s): return sorted([x.strip() for x in eval(s)])\n return normalize(str(result)) == normalize(expected)", "java": "String normalize(String s) {\n return Arrays.stream(s.trim().substring(1, s.length() - 1).split(\",\"))\n .map(String::trim)\n .sorted()\n .collect(Collectors.joining(\",\"));\n}\n\nString resultNormalized = normalize(result.toString());\nString expectedNormalized = normalize(expected);\nreturn resultNormalized.equals(expectedNormalized);", - "cpp": "#include \n#include \n#include \n#include // for isspace\n\nstd::string trim(const std::string& str) {\n size_t first = str.find_first_not_of(\" \");\n if (first == std::string::npos) return \"\";\n size_t last = str.find_last_not_of(\" \");\n return str.substr(first, (last-first+1));\n}\n\nstd::vector normalize(const std::string& s) {\n std::vector elements;\n // Assuming the input format can be parsed as a comma-separated string\n size_t pos = 0;\n size_t comma_pos;\n while ((comma_pos = s.find(\",\", pos)) != std::string::npos) {\n elements.push_back(trim(s.substr(pos, comma_pos - pos)));\n pos = comma_pos + 1;\n }\n elements.push_back(trim(s.substr(pos)));\n std::sort(elements.begin(), elements.end());\n return elements;\n}\n\n// Comparison\nnormalize(std::to_string(result)) == normalize(expected)" + "cpp": "std::vector resultVec = jsonToValue>(result);\nstd::vector expectedVec = jsonToValue>(expected);\nstd::sort(resultVec.begin(), resultVec.end());\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=QgLKdluDo08&pp=ygUWTmVldENvZGUgV29yZCBCcmVhayBJSQ%3D%3D", "method_name": "wordBreak" @@ -4321,8 +4321,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return String.valueOf(result).equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=oUnF7o88_Xc&pp=ygUwTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5IElJ", "method_name": "findMin" @@ -4373,8 +4373,8 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return result.toString().equals(expected);", - "cpp": "return std::to_string(result) == expected;" + "java": "return ((Integer) result).toString().equals(expected);", + "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=NshLjAWa03c&pp=ygUrTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJVg%3D%3D", "method_name": "maxProfit" @@ -4423,8 +4423,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "try {\n return Double.compare(result, Double.parseDouble(expected)) == 0;\n} catch (NumberFormatException e) {\n return result.equals(expected);\n}", - "cpp": "# include \n#include \n\nreturn std::system((\"echo \" + result + \" | \").c_str()) == std::system((\"echo \" + expected + \" | python\").c_str());" + "java": "if (result instanceof List && expected instanceof String) {\n // Parse the expected string as a list of lists of integers\n Gson gson = new Gson();\n List> expectedList = gson.fromJson((String) expected, new TypeToken>>() {}.getType());\n // Cast the result to a list of lists of integers\n List> resultList = (List>) result;\n // Compare the two lists\n return resultList.equals(expectedList);\n} else {\n return result.equals(expected);\n}", + "cpp": "if (result.isArray() && expected.isString()) {\n // Parse the expected string as a JSON array\n Json::Value expectedJson;\n Json::CharReaderBuilder builder;\n std::string errors;\n std::unique_ptr reader(builder.newCharReader());\n if (!reader->parse(expected.asCString(), expected.asCString() + expected.asString().length(), &expectedJson, &errors)) {\n throw std::runtime_error(\"Failed to parse expected JSON: \" + errors);\n }\n \n // Sort both result and expectedJson\n auto sortJsonArray = [](Json::Value& array) {\n std::sort(array.begin(), array.end(), [](const Json::Value& a, const Json::Value& b) {\n if (a[0] != b[0]) return a[0].asInt() < b[0].asInt();\n return a[1].asInt() < b[1].asInt();\n });\n };\n \n sortJsonArray(result);\n sortJsonArray(expectedJson);\n \n // Compare the sorted arrays\n return result == expectedJson;\n} else {\n return result == expected;\n}" }, "explanation": "https://www.youtube.com/watch?v=XhzHXj7wrwo&pp=ygUcTmVldENvZGUgVGhlIFNreWxpbmUgUHJvYmxlbQ%3D%3D", "method_name": "getSkyline" @@ -4475,8 +4475,8 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result) == Integer.parseInt(expected);", - "cpp": "return std::stoi(result) == std::stoi(expected);" + "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=zsJ-J08Qgdk&pp=ygUZTmVldENvZGUgQmFzaWMgQ2FsY3VsYXRvcg%3D%3D", "method_name": "calculate" @@ -4525,8 +4525,8 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "try {\n /* If the expected string is a valid expression, evaluate it */\n Object evaluatedExpected = javax.script.ScriptEngineManager()\n .getEngineByName(\"nashorn\")\n .eval(expected);\n return result.equals(evaluatedExpected);\n} catch (Exception e) {\n // In case of any exception during evaluation, return false;\n return false;\n}", - "cpp": "return result == std::atoi(expected.c_str());" + "java": "if (result instanceof int[] && expected instanceof String) {\n // Parse the expected string as a JSON array\n Gson gson = new Gson();\n int[] expectedArray = gson.fromJson((String) expected, int[].class);\n // Compare the arrays\n return Arrays.equals((int[]) result, expectedArray);\n}\nreturn false;", + "cpp": "if (result.isArray() && expected.isArray()) {\n std::vector resultVec;\n std::vector expectedVec;\n for (const auto& val : result) {\n resultVec.push_back(val.asInt());\n }\n for (const auto& val : expected) {\n expectedVec.push_back(val.asInt());\n }\n return resultVec == expectedVec;\n}\nreturn false;" }, "explanation": "https://www.youtube.com/watch?v=DfljaUwZsOk&pp=ygUfTmVldENvZGUgU2xpZGluZyBXaW5kb3cgTWF4aW11bQ%3D%3D", "method_name": "maxSlidingWindow" @@ -4577,8 +4577,8 @@ }, "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", - "java": "return Arrays.equals(\n Arrays.stream(result.split(\",\")).sorted().toArray(),\n Arrays.stream(eval(expected).split(\",\")).sorted().toArray()\n);", - "cpp": "std::vector sorted_result = result;\nstd::vector sorted_expected = expected;\n\nstd::sort(sorted_result.begin(), sorted_result.end());\nstd::sort(sorted_expected.begin(), sorted_expected.end());\n\nreturn sorted_result == sorted_expected;" + "java": "List resultList = (List) result;\nList expectedList = (List) expected;\nCollections.sort(resultList);\nCollections.sort(expectedList);\nreturn resultList.equals(expectedList);", + "cpp": "std::vector sorted_result = result.as>();\nstd::vector sorted_expected = expected.as>();\n\nstd::sort(sorted_result.begin(), sorted_result.end());\nstd::sort(sorted_expected.begin(), sorted_expected.end());\n\nreturn sorted_result == sorted_expected;" }, "explanation": "https://www.youtube.com/watch?v=tunRDBsP7OQ&pp=ygUhTmVldENvZGUgRXhwcmVzc2lvbiBBZGQgT3BlcmF0b3Jz", "method_name": "addOperators" @@ -4629,8 +4629,8 @@ }, "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", - "java": "return Arrays.equals(Arrays.stream(result).sorted().toArray(), Arrays.stream(eval(expected)).sorted().toArray());", - "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedVec;\nstd::istringstream iss(expected);\nstd::string token;\nwhile (std::getline(iss, token, ',')) {\n expectedVec.push_back(token);\n}\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn result == expectedVec;" + "java": "List resultList = (List) result;\nList expectedList = (List) expected;\nCollections.sort(resultList);\nCollections.sort(expectedList);\nreturn resultList.equals(expectedList);", + "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedVec;\nstd::istringstream iss(expected.asString().substr(1, expected.asString().size() - 2));\nstd::string token;\nwhile (std::getline(iss, token, ',')) {\n token.erase(remove(token.begin(), token.end(), '\\''), token.end());\n expectedVec.push_back(token);\n}\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn result == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=mgQ4O9iUEbg&pp=ygUjTmVldENvZGUgUmVtb3ZlIEludmFsaWQgUGFyZW50aGVzZXM%3D", "method_name": "removeInvalidParentheses" diff --git a/app/services/execution/docker.py b/app/services/execution/docker.py index 365f63d..b2df6be 100644 --- a/app/services/execution/docker.py +++ b/app/services/execution/docker.py @@ -56,7 +56,7 @@ def get_run_commands(self, lang: str, file_path: str) -> list: elif lang == "cpp": return [ "sh", "-c", - f"g++ -std=c++17 -o {base_name} {file_name} && ./{base_name}" + f"g++ -std=c++17 -o {base_name} {file_name} -ljsoncpp && ./{base_name}" ] raise ValueError(f"Unsupported language: {lang}") diff --git a/app/services/execution/templates.py b/app/services/execution/templates.py index 1c8c3ee..1d2250c 100644 --- a/app/services/execution/templates.py +++ b/app/services/execution/templates.py @@ -1,12 +1,9 @@ -PYTHON_TEMPLATE = r"""{code} - -import json +PYTHON_TEMPLATE = r"""import json import traceback from typing import * -def compare_results(result: Any, expected: str) -> bool: - {compare_func} - +{code} + class TestResult: def __init__( self, @@ -32,13 +29,26 @@ def to_dict(self, include_input: bool = True): if include_input: result["input_data"] = self.input_data return result + +def compare_results(result: Any, expected: str) -> bool: + {compare_func} -def run_tests(solution, test_data, is_sample: bool = False): +def format_test_data(method_name: str, args: str) -> str: + arg_list = args.split("--arg") + arg_list = [a.strip() for a in arg_list if a.strip()] + params = [] + for arg in arg_list: + if "=" in arg: + _, val = arg.split("=", 1) + params.append(val.strip()) + return f"{{method_name}}({{', '.join(params)}})" + +def run_tests(solution, method_name, test_data, is_sample: bool = False): results = [] for test in test_data: try: - result = eval(f"solution.{{test['input']}}") + result = eval(f"solution.{{format_test_data(method_name, test['input'])}}") passed = compare_results(result, test['expected']) results.append(TestResult( expected=test['expected'], @@ -64,11 +74,13 @@ def run_tests(solution, test_data, is_sample: bool = False): if __name__ == "__main__": test_data = {test_data} + method_name = {method_name!r} sample_data = {sample_data} + try: solution = Solution() - hidden_results = run_tests(solution, test_data, is_sample=False) - sample_results = run_tests(solution, sample_data, is_sample=True) + hidden_results = run_tests(solution, method_name, test_data, is_sample=False) + sample_results = run_tests(solution, method_name, sample_data, is_sample=True) results = {{ "hidden_results": hidden_results, "sample_results": sample_results @@ -351,51 +363,202 @@ def run_tests(solution, test_data, is_sample: bool = False): """ -CPP_TEMPLATE = r"""{code} +CPP_TEMPLATE = r"""#include +#include +#include +#include +#include +#include +#include +#include + +template struct function_traits; +template struct always_false : std::false_type {{}}; +template struct is_vector : std::false_type {{}}; +template struct is_vector> : std::true_type {{}}; + +template +struct function_traits {{ + using return_type = R; + using args_tuple = std::tuple< + typename std::remove_reference::type... + >; + static constexpr size_t arg_count = sizeof...(Args); +}}; + +template +using tuple_element_t = typename std::tuple_element::type; +template struct arg_type {{ + using type = tuple_element_t::args_tuple>; +}}; + +using namespace std; + +{code} + +template T jsonToValue(const Json::Value &val) {{ + // Handle nested vectors recursively + if constexpr (is_vector::value) {{ + using ElementType = typename T::value_type; + T result; + for (const auto &elem : val) {{ + result.push_back(jsonToValue(elem)); + }} + return result; + }} + // Handle arithmetic types (int, float, double) + else if constexpr (std::is_arithmetic_v) {{ + if (val.isNumeric()) {{ + return static_cast(val.isDouble() ? val.asDouble() : val.asInt()); + }} + throw std::runtime_error("JSON value is not numeric"); + }} + // Handle strings + else if constexpr (std::is_same_v) {{ + return val.asString(); + }} + else {{ + static_assert(always_false::value, "Unsupported type for JSON parsing"); + }} +}} + +template Json::Value valueToJson(const T &value) {{ + // Handle vectors recursively + if constexpr (is_vector::value) {{ + Json::Value json_array(Json::arrayValue); + for (const auto &elem : value) {{ + json_array.append(valueToJson(elem)); + }} + return json_array; + }} + // Handle arithmetic types + else if constexpr (std::is_arithmetic_v) {{ + return Json::Value(value); + }} + // Handle strings + else if constexpr (std::is_same_v) {{ + return Json::Value(value); + }} else {{ + static_assert(always_false::value, "Unsupported type for JSON serialization"); + }} +}} -\#include -\#include -\#include -\#include +struct ArgType {{ + Json::Value data; + std::function converter; + + template T get() const {{ return jsonToValue(data); }} +}}; + +vector parseArguments(const string& input) {{ + vector args; + istringstream iss(input); + string token; + Json::CharReaderBuilder builder; + Json::CharReader* reader = builder.newCharReader(); + string errors; + + while (iss >> token) {{ + size_t eq_pos = token.find('='); + if (eq_pos == std::string::npos || token.find("--arg") != 0) + continue; + + std::string value_str = token.substr(eq_pos + 1); + Json::Value json_val; + + // Attempt to parse as JSON + if (reader->parse(value_str.c_str(), value_str.c_str() + value_str.length(), &json_val, &errors)) {{ + args.push_back({{json_val}}); + }} else {{ + // If not valid JSON, treat as string + args.push_back({{Json::Value(value_str)}}); + }} + }} + delete reader; + return args; +}} -Json::Value compareResults(auto result, const std::string& expected) {{ +bool compare(const Json::Value &result, const Json::Value &expected) {{ {compare_func} }} Json::Value runTests(Solution& solution, const Json::Value& testData) {{ Json::Value results(Json::arrayValue); - - for (const auto& test : testData) {{ - Json::Value result; + Json::CharReaderBuilder builder; + Json::CharReader* reader = builder.newCharReader(); + string errors; + + for (const auto &test : testData) {{ + Json::Value testResult; try {{ - std::istringstream iss(test["input"].asString()); - // Parameter parsing logic - auto output = solution.{method_name}(/* parsed args */); - Json::Value comparison = compareResults(output, test["expected"].asString()); - result["passed"] = comparison["passed"]; - result["output"] = Json::Value(output); - }} catch (const std::exception& e) {{ - result["error"] = e.what(); - result["passed"] = false; + auto args = parseArguments(test["input"].asString()); + + using Solution_t = decltype(Solution()); + using Method_t = decltype(&Solution_t::{method_name}); + + {args_init} + auto output = solution.{method_name}({args_param}); + + Json::Value expected; + reader->parse(test["expected"].asString().c_str(), + test["expected"].asString().c_str() + + test["expected"].asString().length(), + &expected, &errors); + + Json::Value output_json= valueToJson(output); + + testResult["passed"] = compare(output_json, expected); + Json::StreamWriterBuilder writer; + writer["indentation"] = ""; + testResult["output"] = Json::writeString(writer, output_json); + testResult["expected"] = Json::writeString(writer, expected); + + }} catch (const exception &e) {{ + testResult["error"] = e.what(); + testResult["passed"] = false; }} - results.append(result); + results.append(testResult); }} + delete reader; return results; }} +Json::Value formatResults(const Json::Value& results) {{ + Json::Value formatted; + int total_tests = results.size(); + int passed_tests = 0; + + for (const auto& test : results) {{ + if (test["passed"].asBool()) {{ + passed_tests++; + }} + }} + + formatted["test_results"] = results; + formatted["summary"]["total_tests"] = total_tests; + formatted["summary"]["passed_tests"] = passed_tests; + + return formatted; +}} + int main() {{ Solution solution; - Json::Reader reader; - Json::Value testData, sampleData; + Json::CharReaderBuilder builder; + Json::CharReader* reader = builder.newCharReader(); + Json::Value test_data, sample_data; + string errors; - reader.parse("{test_data}", testData); - reader.parse("{sample_data}", sampleData); + const string test_str = "{test_data}"; + reader->parse(test_str.c_str(), test_str.c_str() + test_str.length(), &test_data, &errors); + const string sample_str = "{sample_data}"; + reader->parse(sample_str.c_str(), sample_str.c_str() + sample_str.length(), &sample_data, &errors); + delete reader; Json::Value results; - results["hidden_results"] = runTests(solution, testData); - results["sample_results"] = runTests(solution, sampleData); + results["hidden_results"] = formatResults(runTests(solution, test_data)); + results["sample_results"] = formatResults(runTests(solution, sample_data)); - std::cout << "EXECUTION_RESULTS:" << results.toStyledString(); + cout << "EXECUTION_RESULTS:" << results.toStyledString(); return 0; }} """ diff --git a/app/services/execution/test_generator.py b/app/services/execution/test_generator.py index 1233668..b22f63c 100644 --- a/app/services/execution/test_generator.py +++ b/app/services/execution/test_generator.py @@ -23,33 +23,19 @@ def generate_test_file(self, code: str, file_name: str, method_name: str, test_d def get_file_extension(self, lang: str) -> str: """ Get the file extension for the given language. - """ - - def format_test_data(self, method_name: str, test_data: List[Dict]) -> List[Dict]: """ - Format the test data to be used in the test runner code. + + def process_quotes(self, json_str: str) -> str: + """ + Process quotes in a JSON string. """ - formatted = [] - for test in test_data: - segments = test["input"].split("--arg") - segments = [s.strip() for s in segments if s.strip()] - params = [] - for s in segments: - if "=" in s: - _, val = s.split("=", 1) - params.append(val.strip()) - formatted.append({ - "input": f"{method_name}({', '.join(params)})", - "expected": test["expected"] - }) - return formatted + return json_str.replace('"', '\\"').replace('\\\\"', '\\\\\\"') # cursed code alert class PythonTestGenerator(TestGenerator): def generate_test_file(self, code: str, file_name: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: - test_data = self.format_test_data(method_name, test_data) - sample_data = self.format_test_data(method_name, sample_data) return PYTHON_TEMPLATE.format( code=code, + method_name=method_name, compare_func=compare_func, test_data=json.dumps(test_data), sample_data=json.dumps(sample_data), @@ -60,8 +46,6 @@ def get_file_extension(self, lang: str) -> str: class JavaTestGenerator(TestGenerator): def generate_test_file(self, code: str, file_name: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: - test_data = self.format_test_data(method_name, test_data) - sample_data = self.format_test_data(method_name, sample_data) return JAVA_TEMPLATE.format( code=code, file_name=file_name, @@ -74,23 +58,33 @@ def generate_test_file(self, code: str, file_name: str, method_name: str, test_d def get_file_extension(self, lang: str) -> str: return ".java" - def format_test_data(self, method_name: str, test_data: List[Dict]) -> List[Dict]: - return test_data - - def process_quotes(self, json_str: str) -> str: - return json_str.replace('"', '\\"').replace('\\\\"', '\\\\\\"') # cursed code alert - class CppTestGenerator(TestGenerator): def generate_test_file(self, code: str, file_name: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: - test_data = self.format_test_data(method_name, test_data) - sample_data = self.format_test_data(method_name, sample_data) + args_init, args_param = self.process_args(test_data[0]["input"]) return CPP_TEMPLATE.format( code=code, + file_name=file_name, method_name=method_name, compare_func=compare_func, - test_data=json.dumps(test_data), - sample_data=json.dumps(sample_data), + test_data=self.process_quotes(json.dumps(test_data)), + sample_data=self.process_quotes(json.dumps(sample_data)), + args_init=args_init, + args_param=args_param ) + def process_args(self, args: str) -> (str, str): + args_list = args.split() + init_lines = [] + params = [] + for i in range(len(args_list)): + var_name = f"arg{i+1}" + line = f"auto {var_name} = args[{i}].get::type>();" + init_lines.append(line) + params.append(var_name) + # initializing and inserting these auto arguments + args_init = "\n".join(init_lines) + args_param = ", ".join(params) + return args_init, args_param + def get_file_extension(self, lang: str) -> str: return ".cpp" diff --git a/app/tests/unit/code_execution_test.py b/app/tests/unit/code_execution_test.py index a53befe..9ce9be5 100644 --- a/app/tests/unit/code_execution_test.py +++ b/app/tests/unit/code_execution_test.py @@ -266,8 +266,7 @@ class Solution { @pytest.fixture def undefined_variable_solution(self): - return """ -class Solution { + return """class Solution { public int add(int a, int b) { return n; } @@ -276,8 +275,7 @@ class Solution { @pytest.fixture def infinite_loop_solution(self): - return """ -class Solution { + return """class Solution { public int add(int a, int b) { while(true) {} return a + b; @@ -464,6 +462,257 @@ def test_different_difficulty_semaphores(self, executor): executor._execution_semaphores["medium"]._value > \ executor._execution_semaphores["hard"]._value +class TestCpp: + @pytest.fixture + def executor(self): + return CodeExecutionService() + + @pytest.fixture + def valid_solution(self): + # A valid C++ solution with two methods: add and twoSum. + return r""" +class Solution { +public: + int add(int a, int b) { + return a + b; + } + + vector twoSum(vector& nums, int target) { + unordered_map seen; + for (int i = 0; i < nums.size(); i++) { + int complement = target - nums[i]; + if (seen.find(complement) != seen.end()) { + return vector{seen[complement], i}; + } + seen[nums[i]] = i; + } + return vector(); + } +}; +""" + + @pytest.fixture + def invalid_syntax_solution(self): + # Missing a semicolon after the return statement. + return r""" +class Solution { +public: + int add(int a, int b) { + return a + b // Missing semicolon here + } +}; +""" + + @pytest.fixture + def undefined_variable_solution(self): + # Uses an undefined variable 'n' + return r""" +class Solution { +public: + int add(int a, int b) { + return n; // 'n' is not defined + } +}; +""" + + @pytest.fixture + def infinite_loop_solution(self): + # Contains an infinite loop in add + return r""" +class Solution { +public: + int add(int a, int b) { + while(true) {} + return a + b; + } +}; +""" + + @pytest.fixture + def memory_heavy_solution(self): + # Allocates a huge vector to trigger a memory limit error. + return r""" +class Solution { +public: + int add(int a, int b) { + // Allocate 100 million integers initialized to 0. + vector x(100000000, 0); + return a + b; + } +}; +""" + + @pytest.mark.asyncio + async def test_successful_execution(self, executor, valid_solution): + result = await executor.execute_code( + code=valid_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + expected_results=["3", "0", "0"], + sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_expected_results=["3", "0", "0"], + difficulty="easy", + compare_func="return result == expected;", + lang="cpp" + ) + assert result.success + assert len(result.test_results) == 3 + assert all(test["passed"] for test in result.test_results) + + @pytest.mark.asyncio + async def test_failed_test_cases(self, executor, valid_solution): + result = await executor.execute_code( + code=valid_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0"], + expected_results=["4", "1"], + sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0"], + sample_expected_results=["3", "0"], + difficulty="easy", + compare_func="return result == expected;", + lang="cpp" + ) + assert result.success + assert len(result.test_results) == 2 + assert not any(test["passed"] for test in result.test_results) + + + @pytest.mark.asyncio + async def test_syntax_error(self, executor, invalid_syntax_solution): + result = await executor.execute_code( + code=invalid_syntax_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2"], + sample_expected_results=["3"], + difficulty="easy", + compare_func="return result == expected;", + lang="cpp" + ) + assert not result.success + + @pytest.mark.asyncio + async def test_undefined_error(self, executor, undefined_variable_solution): + result = await executor.execute_code( + code=undefined_variable_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2", "--arg1=2 --arg2=2"], + expected_results=["3", "4"], + sample_test_cases=["--arg1=1 --arg2=2"], + sample_expected_results=["3"], + difficulty="easy", + compare_func="return result == expected;", + lang="cpp" + ) + assert not result.success + + @pytest.mark.asyncio + async def test_type_error(self, executor, valid_solution): + result = await executor.execute_code( + code=valid_solution, + method_name="add", + test_cases=["--arg1=1 --arg2='2'", "--arg1=2 --arg2='2'"], + expected_results=["3", "4"], + sample_test_cases=["--arg1=1 --arg2='2'"], + sample_expected_results=["3"], + difficulty="easy", + compare_func="return result == expected;", + lang="cpp" + ) + assert result.success + assert not all(test["passed"] for test in result.test_results) + + @pytest.mark.asyncio + async def test_timeout(self, executor, infinite_loop_solution): + result = await executor.execute_code( + code=infinite_loop_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2"], + sample_expected_results=["3"], + difficulty="easy", + compare_func="return result == expected;", + lang="cpp" + ) + assert not result.success + assert "Time Limit Exceeded" in result.message + + @pytest.mark.asyncio + async def test_memory_limit(self, executor, memory_heavy_solution): + result = await executor.execute_code( + code=memory_heavy_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2"], + sample_expected_results=["3"], + difficulty="easy", + compare_func="return result == expected;", + lang="cpp" + ) + assert not result.success + assert "Memory Limit Exceeded" in result.message + + @pytest.mark.asyncio + async def test_complex_problem(self, executor, valid_solution): + result = await executor.execute_code( + code=valid_solution, + method_name="twoSum", + test_cases=[ + "--arg1=[2,7,11,15] --arg2=9", + "--arg1=[3,2,4] --arg2=6", + "--arg1=[3,3] --arg2=6" + ], + expected_results=[ + "[0,1]", + "[1,2]", + "[0,1]" + ], + sample_test_cases=[ + "--arg1=[2,7,11,15] --arg2=9", + "--arg1=[3,2,4] --arg2=6", + "--arg1=[3,3] --arg2=6" + ], + sample_expected_results=[ + "[0,1]", + "[1,2]", + "[0,1]" + ], + difficulty="easy", + compare_func="return result == expected;", + lang="cpp" + ) + assert result.success + assert len(result.test_results) == 3 + assert all(test["passed"] for test in result.test_results) + + @pytest.mark.asyncio + async def test_concurrent_executions(self, executor, valid_solution): + tasks = [] + for _ in range(20): + tasks.append( + executor.execute_code( + code=valid_solution, + method_name="add", + test_cases=["--arg1=1 --arg2=2"], + expected_results=["3"], + sample_test_cases=["--arg1=1 --arg2=2"], + sample_expected_results=["3"], + difficulty="hard", + compare_func="return result == expected;", + lang="cpp" + ) + ) + results = await asyncio.gather(*tasks) + assert all(r.success for r in results) + assert len(results) == 20 + + def test_different_difficulty_semaphores(self, executor): + assert executor._execution_semaphores["easy"]._value > \ + executor._execution_semaphores["medium"]._value > \ + executor._execution_semaphores["hard"]._value if __name__ == "__main__": pytest.main([__file__, "-v"]) diff --git a/docker/cpp/Dockerfile b/docker/cpp/Dockerfile index 8064c23..d729f0e 100644 --- a/docker/cpp/Dockerfile +++ b/docker/cpp/Dockerfile @@ -2,14 +2,16 @@ FROM gcc:11.2.0 WORKDIR /code -# Install Google Test +# Install Google Test and JsonCpp with proper include paths RUN apt-get update && apt-get install -y \ cmake \ libgtest-dev \ + libjsoncpp-dev \ && cd /usr/src/gtest \ && cmake CMakeLists.txt \ && make \ - && cp lib/*.a /usr/lib + && cp lib/*.a /usr/lib \ + && ln -s /usr/include/jsoncpp/json /usr/include/json # Set security limits RUN mkdir /sandbox && chmod 777 /sandbox From 3cbb37241601880dae3aa4fbfa4d25801c497cdf Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Mon, 10 Feb 2025 21:50:00 -0500 Subject: [PATCH 14/24] Updated problems tests + Added tests for validating problem tests --- app/db/combined.json | 6 +- app/db/init.py | 22 +++- app/services/execution/runtime_analysis.py | 4 +- app/services/execution/templates.py | 128 +++++++++++---------- app/tests/unit/code_validation_test.py | 98 ++++++++++++++++ app/tests/unit/problem_test.py | 4 +- 6 files changed, 192 insertions(+), 70 deletions(-) create mode 100644 app/tests/unit/code_validation_test.py diff --git a/app/db/combined.json b/app/db/combined.json index bd20d90..fd2e766 100644 --- a/app/db/combined.json +++ b/app/db/combined.json @@ -45,7 +45,7 @@ }, "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", - "java": "int[] expectedArray = gson.fromJson((String) expected, int[].class);\nArrays.sort((int[]) result);\nArrays.sort(expectedArray);\nreturn Arrays.equals((int[]) result, expectedArray);", + "java": "return Arrays.equals((int[]) result, (int []) expected);", "cpp": "std::sort(result.begin(), result.end());\nstd::vector expected_vector;\nstd::stringstream ss(expected.asString());\nint number;\nwhile (ss >> number) {\n expected_vector.push_back(number);\n if (ss.peek() == ',') {\n ss.ignore();\n }\n}\nstd::sort(expected_vector.begin(), expected_vector.end());\nreturn result == expected_vector;" }, "explanation": "https://www.youtube.com/watch?v=KLlXCFG5TnA&pp=ygUQTmVldENvZGUgVHdvIFN1bQ%3D%3D", @@ -201,7 +201,7 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return result.equals(Boolean.parseBoolean((String) expected));", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=WTzjTskDFMg&pp=ygUaTmVldENvZGUgVmFsaWQgUGFyZW50aGVzZXM%3D", @@ -408,7 +408,7 @@ "compare_func": { "python": "return str(result) == expected", "java": "return Arrays.equals((int[]) result, gson.fromJson((String) expected, int[].class));", - "cpp": "std::vector expectedVec = jsonToValue>(expected);\nreturn result == expectedVec;" + "cpp": "return result == expected;" }, "explanation": "https://www.youtube.com/watch?v=jIaA8boiG1s&pp=ygURTmVldENvZGUgUGx1cyBPbmU%3D", "method_name": "plusOne" diff --git a/app/db/init.py b/app/db/init.py index 30250e3..026a1ea 100644 --- a/app/db/init.py +++ b/app/db/init.py @@ -69,24 +69,36 @@ def init_db(test=False): return engine -def drop_db(test=False): +def drop_all_db(test=False): engine = create_engine(settings.DATABASE_URL if not test else settings.TEST_DATABASE_URL) if database_exists(engine.url): Base.metadata.drop_all(bind=engine) print("Dropped all tables") +def drop_db(table_names, test=False): + engine = create_engine(settings.DATABASE_URL if not test else settings.TEST_DATABASE_URL) + if database_exists(engine.url): + table_list = [Base.metadata.tables[name] for name in table_names.split(',')] + Base.metadata.drop_all(bind=engine, tables=table_list) + print(f"Dropped tables: {table_names}") if __name__ == "__main__": import argparse parser = argparse.ArgumentParser() parser.add_argument( - "--drop", + "--dropall", action="store_true", help="Drop existing tables before creation" ) + parser.add_argument( + "--drop", + type=str, + help="Drop specific tables (comma-separated, ex: --drop=table1,table2)" + ) + parser.add_argument( "--droptest", action="store_true", @@ -95,10 +107,12 @@ def drop_db(test=False): args = parser.parse_args() + if args.dropall: + drop_all_db() if args.drop: - drop_db() + drop_db(args.drop) if args.droptest: - drop_db(test=True) + drop_all_db(test=True) init_db() init_db(test=True) diff --git a/app/services/execution/runtime_analysis.py b/app/services/execution/runtime_analysis.py index e07b1a3..a9409a8 100644 --- a/app/services/execution/runtime_analysis.py +++ b/app/services/execution/runtime_analysis.py @@ -31,10 +31,10 @@ async def analyze_code(self, code: str) -> Optional[str]: try: completion = await self.client.beta.chat.completions.parse( - model="gpt-4o", + model="gpt-4o-mini", messages=[ {"role": "system", "content": "You are a code analysis assistant. Analyze the code and provide ONLY the time complexity in Big O notation (e.g. O(n), O(n^2)). No other text or explanations."}, - {"role": "user", "content": f"Analyze this code:\n\n```python\n{code}\n```"} + {"role": "user", "content": f"Analyze this code:\n\n```\n{code}\n```"} ], response_format=RuntimeAnalysis, temperature=0 diff --git a/app/services/execution/templates.py b/app/services/execution/templates.py index 1d2250c..f553f10 100644 --- a/app/services/execution/templates.py +++ b/app/services/execution/templates.py @@ -114,14 +114,15 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): try {{ String inputStr = test.get("input").getAsString(); - Class[] paramTypes = getParameterTypes(inputStr); Object[] args = parseArguments(inputStr); + Class[] paramTypes = getParameterTypes(args); Method method = Solution.class.getMethod("{method_name}", paramTypes); Object output = method.invoke(solution, args); boolean passed = compare(output, parseValue(test.get("expected").getAsString())); result.addProperty("passed", passed); result.addProperty("output", gson.toJson(output)); + result.addProperty("expected", test.get("expected").getAsString()); }} catch (Exception e) {{ result.addProperty("error", e.toString()); result.addProperty("passed", false); @@ -135,61 +136,78 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): if (!arr.getClass().isArray()) {{ return arr.getClass(); }} - - Class componentType = arr.getClass().getComponentType(); - if (componentType.isPrimitive()) {{ - return arr.getClass(); - }} + + Class arrClass = arr.getClass(); + if (arrClass == int[].class) return int[].class; + if (arrClass == double[].class) return double[].class; + if (arrClass == boolean[].class) return boolean[].class; + if (arrClass == char[].class) return char[].class; + if (arrClass == long[].class) return long[].class; + if (arrClass == float[].class) return float[].class; + if (arrClass == byte[].class) return byte[].class; + if (arrClass == short[].class) return short[].class; Object[] array = (Object[]) arr; if (array.length == 0) {{ return Object[].class; }} - - boolean allIntegers = true; - boolean allArrays = true; - + + // Find the most specific common type among non-null elements + Class commonType = null; for (Object element : array) {{ - if (element == null) continue; - if (!(element instanceof Integer)) allIntegers = false; - if (!element.getClass().isArray()) allArrays = false; - }} - - if (allIntegers) return int[].class; - if (allArrays) {{ - Object firstNonNull = null; - for (Object element : array) {{ - if (element != null) {{ - firstNonNull = element; - break; + if (element != null) {{ + Class currentType = element.getClass(); + if (commonType == null) {{ + commonType = currentType; + }} else {{ + // Find the most specific common superclass + while (!commonType.isAssignableFrom(currentType)) {{ + commonType = commonType.getSuperclass(); + if (commonType == null) {{ + return Object[].class; + }} + }} }} }} - if (firstNonNull != null) {{ - Class deeperType = getArrayType(firstNonNull); - return Array.newInstance(deeperType.getComponentType(), 0).getClass(); - }} }} - return Object[].class; + + // If all elements are null or no common type found + if (commonType == null) {{ + return Object[].class; + }} + + // Handle primitive wrapper types + if (commonType == Integer.class) return int[].class; + if (commonType == Double.class) return double[].class; + if (commonType == Boolean.class) return boolean[].class; + if (commonType == Character.class) return char[].class; + if (commonType == Long.class) return long[].class; + if (commonType == Float.class) return float[].class; + if (commonType == Byte.class) return byte[].class; + if (commonType == Short.class) return short[].class; + + // For other types, return appropriate array type + return Array.newInstance(commonType, 0).getClass(); }} - private static Class[] getParameterTypes(String input) {{ - Object[] args = parseArguments(input); + private static Class[] getParameterTypes(Object[] args) {{ Class[] types = new Class[args.length]; for (int i = 0; i < args.length; i++) {{ if (args[i] == null) {{ types[i] = Object.class; }} else if (args[i].getClass().isArray()) {{ types[i] = getArrayType(args[i]); - }} else if (args[i] instanceof Integer || args[i] instanceof Long) {{ - types[i] = int.class; - }} else if (args[i] instanceof Double || args[i] instanceof Float) {{ - types[i] = double.class; - }} else if (args[i] instanceof Boolean) {{ - types[i] = boolean.class; - }} else if (args[i] instanceof Character) {{ - types[i] = char.class; }} else {{ - types[i] = args[i].getClass(); + Class type = args[i].getClass(); + if (type == Integer.class) type = int.class; + if (type == Double.class) type = double.class; + if (type == Boolean.class) type = boolean.class; + if (type == Character.class) type = char.class; + if (type == Long.class) type = long.class; + if (type == Float.class) type = float.class; + if (type == Byte.class) type = byte.class; + if (type == Short.class) type = short.class; + types[i] = type; }} }} return types; @@ -251,7 +269,7 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): elements.add(parseValue(current.toString().trim())); }} - return elements.toArray(new Object[0]); + return elements.toArray(); }} private static Object parseValue(String value) {{ @@ -275,28 +293,20 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): // Handle arrays if (value.startsWith("[") && value.endsWith("]")) {{ - Object[] elements = parseArray(value.substring(1, value.length() - 1)); - if (elements.length == 0) return elements; - - // Check if all elements are arrays - boolean allArrays = Arrays.stream(elements) - .allMatch(e -> e != null && e.getClass().isArray()); - if (allArrays) {{ - return elements; - }} - - // Check if all elements are integers - boolean allIntegers = Arrays.stream(elements) - .allMatch(e -> e instanceof Integer); - if (allIntegers) {{ - int[] result = new int[elements.length]; - for (int i = 0; i < elements.length; i++) {{ - result[i] = (Integer)elements[i]; + Object[] parsed = parseArray(value.substring(1, value.length() - 1)); + Class arrayType = getArrayType(parsed); + + // Convert to the appropriate array type + int length = parsed.length; + Object typedArray = Array.newInstance(arrayType.getComponentType(), length); + + for (int i = 0; i < length; i++) {{ + if (parsed[i] != null) {{ + Array.set(typedArray, i, parsed[i]); }} - return result; }} - - return elements; + + return typedArray; }} // Handle objects/maps diff --git a/app/tests/unit/code_validation_test.py b/app/tests/unit/code_validation_test.py new file mode 100644 index 0000000..2f87989 --- /dev/null +++ b/app/tests/unit/code_validation_test.py @@ -0,0 +1,98 @@ +import os +import sys +import pytest +from sqlalchemy import create_engine +from sqlalchemy.orm import sessionmaker, Session +from openai import AsyncOpenAI +from pydantic import BaseModel, Field + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) +from core.config import settings +from db.models.problem import Problem +from services.execution.service import CodeExecutionService +import re + +sync_db_url = settings.DATABASE_URL +engine = create_engine(sync_db_url) +SessionLocal = sessionmaker(bind=engine) + +class CodeGenerationResponse(BaseModel): + python: str = Field(..., description="Solution in Python") + java: str = Field(..., description="Solution in Java") + cpp: str = Field(..., description="Solution in C++") + +class CodeGenerationService: + def __init__(self, api_key: str): + self.client = AsyncOpenAI(api_key=api_key) if api_key != 'your_api_key_here' else None + + async def generate_code(self, title: str, description: str, boilerplate: str) -> CodeGenerationResponse: + if not self.client: + return CodeGenerationResponse() + try: + completion = await self.client.beta.chat.completions.parse( + model="gpt-4o", + messages=[ + {"role": "system", "content": "You are a code generation assistant. Generate correct solutions in python, java, and c++."}, + {"role": "user", "content": f"Title: {title}\nProblem description:\n{description}\nBoilerplates:\n{boilerplate.python}\n{boilerplate.java}\n{boilerplate.cpp}\nReturn only JSON with python, java, and cpp fields."} + ], + response_format=CodeGenerationResponse, + temperature=0 + ) + return completion.choices[0].message.parsed + except: + return CodeGenerationResponse() + +def get_compare_func(problem: Problem, lang: str) -> str: + if lang == "python": + return problem.compare_func.python + elif lang == "java": + return problem.compare_func.java + elif lang == "cpp": + return problem.compare_func.cpp + +@pytest.fixture +def db(): + session = SessionLocal() + try: + yield session + finally: + session.close() + +@pytest.mark.asyncio +async def test_code_validation_all_problems(db: Session): + print("Setting up...") + code_generator = CodeGenerationService(settings.OPENAI_API_KEY) + executor = CodeExecutionService() + problems = db.query(Problem).all() + print(f"Validating {len(problems)} problems") + # import pdb; pdb.set_trace() + for problem in problems: + print(f"Validating problem: {problem.title}") + code_res = await code_generator.generate_code(problem.title, problem.description, problem.boilerplate) + for lang, snippet in [ + ("python", code_res.python), + ("java", code_res.java), + ("cpp", code_res.cpp) + ]: + print(f"Validating {lang} code") + if snippet.strip(): + result = await executor.execute_code( + code=snippet, + lang=lang, + method_name=problem.method_name, + test_cases=problem.hidden_test_cases, + expected_results=problem.hidden_test_results, + sample_test_cases=problem.sample_test_cases, + sample_expected_results=problem.sample_test_results, + difficulty=problem.difficulty, + compare_func=get_compare_func(problem, lang) + ) + if not result.success: + print(snippet) + print(result.message) + assert result.success + for tr in result.test_results: + if "error" in tr: + print(tr) + assert "error" not in tr + print(f"{lang} code validation successful") \ No newline at end of file diff --git a/app/tests/unit/problem_test.py b/app/tests/unit/problem_test.py index 890f223..5ea73f2 100644 --- a/app/tests/unit/problem_test.py +++ b/app/tests/unit/problem_test.py @@ -64,14 +64,14 @@ async def test_get_problem_by_id(db: Session): @pytest.mark.asyncio async def test_get_problems_by_distribution(db: Session): - distribution = {"easy": 1, "medium": 1} + distribution = {"medium": 1, "hard": 1} result = await ProblemManager.get_problems_by_distribution(db, distribution) assert isinstance(result, list) assert len(result) > 0 difficulties = [prob.difficulty for prob in result] - assert all(diff in ["easy", "medium"] for diff in difficulties) + assert all(diff in ["medium", "hard"] for diff in difficulties) assert len(result) <= sum(distribution.values()) From 00650d88bccacfc939a0cabafaf79f868c941a4b Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Wed, 12 Feb 2025 18:49:14 -0500 Subject: [PATCH 15/24] Tests 100 problems for java --- app/db/combined.json | 192 ++++++------- app/services/execution/templates.py | 351 ++++++++++++++--------- app/services/execution/test_generator.py | 87 +++++- 3 files changed, 382 insertions(+), 248 deletions(-) diff --git a/app/db/combined.json b/app/db/combined.json index fd2e766..52e9f27 100644 --- a/app/db/combined.json +++ b/app/db/combined.json @@ -97,7 +97,7 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return result.equals(Boolean.valueOf(expected.toString()));", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=yubRKwixN-U&pp=ygUaTmVldENvZGUgUGFsaW5kcm9tZSBOdW1iZXI%3D", @@ -251,7 +251,7 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return Integer.parseInt(expected.toString()) == (int) result;", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=Gjkhm1gYIMw&pp=ygU7TmVldENvZGUgRmluZCB0aGUgSW5kZXggb2YgdGhlIEZpcnN0IE9jY3VycmVuY2UgaW4gYSBTdHJpbmc%3D", @@ -303,7 +303,7 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return Integer.valueOf(result).equals(Integer.valueOf(expected));", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=K-RYzDZkzCI&pp=ygUfTmVldENvZGUgU2VhcmNoIEluc2VydCBQb3NpdGlvbg%3D%3D", @@ -355,7 +355,7 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=KT9rltZTybQ&pp=ygUcTmVldENvZGUgTGVuZ3RoIG9mIExhc3QgV29yZA%3D%3D", @@ -407,7 +407,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return Arrays.equals((int[]) result, gson.fromJson((String) expected, int[].class));", + "java": "return Arrays.equals((int[]) result, (int []) expected);", "cpp": "return result == expected;" }, "explanation": "https://www.youtube.com/watch?v=jIaA8boiG1s&pp=ygURTmVldENvZGUgUGx1cyBPbmU%3D", @@ -457,7 +457,7 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return Objects.equals((String) result, (String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=keuWJ47xG8g&pp=ygUTTmVldENvZGUgQWRkIEJpbmFyeQ%3D%3D", @@ -507,7 +507,7 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return result == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=Y0lT9Fck7qI&pp=ygUYTmVldENvZGUgQ2xpbWJpbmcgU3RhaXJz", @@ -559,7 +559,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "java": "return result.equals(expected);", "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=1pkOgXD63yU&pp=ygUoTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jaw%3D%3D", @@ -582,7 +582,7 @@ ], "hidden_test_cases": [ "--arg1=\"\"", - "--arg1=\". --arg2=\"", + "--arg1=\".,\"", "--arg1=\"0P\"", "--arg1=\"abc123cba\"", "--arg1=\"Race a Car\"", @@ -590,7 +590,7 @@ "--arg1=\"12321\"", "--arg1=\"Never odd or even\"", "--arg1=\"a\"", - "--arg1=\". --arg2=a --arg3=.\"" + "--arg1=\".,a,.\"" ], "hidden_test_results": [ "true", @@ -611,7 +611,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=jJXJ16kPFWg&pp=ygUZTmVldENvZGUgVmFsaWQgUGFsaW5kcm9tZQ%3D%3D", @@ -715,7 +715,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=ljz85bxOYJ0&pp=ygUVTmVldENvZGUgSGFwcHkgTnVtYmVy", @@ -767,7 +767,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return Boolean.parseBoolean(result.toString()) == Boolean.parseBoolean(expected.toString());", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=7yF-U1hLEqQ&pp=ygUbTmVldENvZGUgSXNvbW9ycGhpYyBTdHJpbmdz", @@ -819,7 +819,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=ypn0aZ0nrL4&pp=ygUeTmVldENvZGUgQ29udGFpbnMgRHVwbGljYXRlIElJ", @@ -836,8 +836,8 @@ "--arg1=[]" ], "sample_test_results": [ - "['0->2','4->5','7']", - "['0','2->4','6','8->9']", + "[\"0->2\",\"4->5\",\"7\"]", + "[\"0\",\"2->4\",\"6\",\"8->9\"]", "[]" ], "hidden_test_cases": [ @@ -853,16 +853,16 @@ "--arg1=[-2147483648,2147483647]" ], "hidden_test_results": [ - "['1']", - "['1->2']", - "['1','3','5','7']", - "['1->5']", - "['-1->2']", - "['-5->-3','-1->0','2']", - "['1','3']", - "['1->2','4','6->8']", - "['0->1','3','5->7','9']", - "['-2147483648','2147483647']" + "[\"1\"]", + "[\"1->2\"]", + "[\"1\",\"3\",\"5\",\"7\"]", + "[\"1->5\"]", + "[\"-1->2\"]", + "[\"-5->-3\",\"-1->0\",\"2\"]", + "[\"1\",\"3\"]", + "[\"1->2\",\"4\",\"6->8\"]", + "[\"0->1\",\"3\",\"5->7\",\"9\"]", + "[\"-2147483648\",\"2147483647\"]" ], "boilerplate": { "python": "class Solution:\n def summaryRanges(self, nums: List[int]) -> List[str]:\n ", @@ -871,7 +871,7 @@ }, "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", - "java": "List resultList = (List) result;\nList expectedList = new Gson().fromJson((String) expected, List.class);\nCollections.sort(resultList);\nCollections.sort(expectedList);\nreturn resultList.equals(expectedList);", + "java": "return result.equals(expected);", "cpp": "std::vector expected_result;\neval(expected, expected_result); // Assume eval is a function that populates expected_result\nstd::sort(result.begin(), result.end());\nstd::sort(expected_result.begin(), expected_result.end());\nreturn result == expected_result;" }, "explanation": "https://www.youtube.com/watch?v=ZHJDwbfqoa8&pp=ygUXTmVldENvZGUgU3VtbWFyeSBSYW5nZXM%3D", @@ -923,7 +923,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return ((Boolean) result).toString().equalsIgnoreCase(expected.toString());", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == (expected.asString() == \"true\");" }, "explanation": "https://www.youtube.com/watch?v=H2bjttEV4Vc&pp=ygUVTmVldENvZGUgUG93ZXIgb2YgVHdv", @@ -975,7 +975,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=M0Zay1Qr9ws&pp=ygUUTmVldENvZGUgVWdseSBOdW1iZXI%3D", @@ -1027,7 +1027,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return ((Boolean) result).equals(Boolean.parseBoolean((String) expected));", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=W_akoecmCbM&pp=ygUVTmVldENvZGUgV29yZCBQYXR0ZXJu", @@ -1079,7 +1079,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == (expected.asString() == \"true\");" }, "explanation": "https://www.youtube.com/watch?v=ndR2buBWVc8&pp=ygURTmVldENvZGUgTmltIEdhbWU%3D", @@ -1131,7 +1131,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=M2P2BAFmLlo&pp=ygUXTmVldENvZGUgUG93ZXIgb2YgVGhyZWU%3D", @@ -1183,7 +1183,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return String.valueOf(result).equalsIgnoreCase(expected);", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=qEYZPwnlM0U&pp=ygUWTmVldENvZGUgUG93ZXIgb2YgRm91cg%3D%3D", @@ -1210,7 +1210,7 @@ "--arg1='xyz'", "--arg1='AEIOU'", "--arg1='aeiou'", - "--arg1='. --arg2=!'", + "--arg1='.,!'", "--arg1='Aa'", "--arg1='LEetcOde'" ], @@ -1283,7 +1283,7 @@ }, "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", - "java": "int[] resultArray = (int[]) result;\nint[] expectedArray = gson.fromJson(expected, int[].class);\nArrays.sort(resultArray);\nArrays.sort(expectedArray);\nreturn Arrays.equals(resultArray, expectedArray);", + "java": "if (result instanceof Unknown || expected instanceof Unknown) {\n return true;\n }\n\n if (result == null || expected == null) {\n return result == expected;\n }\n\n if (result.getClass().isArray()) {\n if (!expected.getClass().isArray()) {\n return false;\n }\n int length = Array.getLength(result);\n if (length != Array.getLength(expected)) {\n return false;\n }\n // Convert arrays to lists for sorting\n List resultList = new ArrayList<>();\n List expectedList = new ArrayList<>();\n for (int i = 0; i < length; i++) {\n resultList.add(Array.get(result, i));\n expectedList.add(Array.get(expected, i));\n }\n Collections.sort(resultList, Comparator.comparing(Object::toString));\n Collections.sort(expectedList, Comparator.comparing(Object::toString));\n for (int i = 0; i < length; i++) {\n if (!compare(resultList.get(i), expectedList.get(i))) {\n return false;\n }\n }\n return true;\n }\n\n if (result instanceof List && expected instanceof List) {\n if (!(expected instanceof List)) {\n return false;\n }\n List resultList = new ArrayList<>((List) result);\n List expectedList = new ArrayList<>((List) expected);\n if (resultList.size() != expectedList.size()) {\n return false;\n }\n // Sort both lists\n Collections.sort((List)resultList, Comparator.comparing(Object::toString));\n Collections.sort((List)expectedList, Comparator.comparing(Object::toString));\n for (int i = 0; i < resultList.size(); i++) {\n if (!compare(resultList.get(i), expectedList.get(i))) {\n return false;\n }\n }\n return true;\n }\n\n return result.equals(expected);", "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedVec;\nistringstream iss(expected.substr(1, expected.size() - 2));\nint number;\nwhile (iss >> number) {\n expectedVec.push_back(number);\n if (iss.peek() == ',')\n iss.ignore();\n}\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn result == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=fwUTXaMom6U&pp=ygUmTmVldENvZGUgSW50ZXJzZWN0aW9uIG9mIFR3byBBcnJheXMgSUk%3D", @@ -1335,7 +1335,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=Cg_wWPHJ2Sk&pp=ygUdTmVldENvZGUgVmFsaWQgUGVyZmVjdCBTcXVhcmU%3D", @@ -1439,7 +1439,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=99RVfqklbCE&pp=ygUXTmVldENvZGUgSXMgU3Vic2VxdWVuY2U%3D", @@ -1491,7 +1491,7 @@ }, "compare_func": { "python": "def sorted_list_strings(lst):\n return sorted([str(x) for x in eval(lst)])\n return sorted(result) == sorted_list_strings(expected)", - "java": "try {\n List evalResult = Arrays.asList(eval(expected).replace(\"[\", \"\").replace(\"]\", \"\").replace(\"'\", \"\").split(\",\"));\n List resultAsString = result.stream().map(Object::toString).collect(Collectors.toList());\n Collections.sort(resultAsString);\n Collections.sort(evalResult);\n return resultAsString.equals(evalResult);\n} catch (Exception e) {\n return false;\n}", + "java": "if (result == null && expected == null) {\n return true;\n }\n if (result == null || expected == null) {\n return false;\n }\n\n List resultList;\n List expectedList;\n\n if (result instanceof List) {\n resultList = (List) result;\n } else if (result instanceof String[]) {\n resultList = Arrays.asList((String[]) result);\n } else {\n return false;\n }\n\n if (expected instanceof List) {\n expectedList = (List) expected;\n } else if (expected instanceof String[]) {\n expectedList = Arrays.asList((String[]) expected);\n } else {\n return false;\n }\n\n if (resultList.size() != expectedList.size()) {\n return false;\n }\n List sortedResult = new ArrayList<>(resultList);\n List sortedExpected = new ArrayList<>(expectedList);\n Collections.sort(sortedResult);\n Collections.sort(sortedExpected);\n return sortedResult.equals(sortedExpected);\n", "cpp": "std::multiset sorted_list_strings(const std::string& lst) {\n std::multiset sortedStrings;\n std::string cleaned = lst;\n // Remove leading/trailing whitespace\n cleaned.erase(0, cleaned.find_first_not_of(\" \\t\\n\\r\"));\n cleaned.erase(cleaned.find_last_not_of(\" \\t\\n\\r\") + 1);\n \n // Substitute all commas with spaces\n std::replace(cleaned.begin(), cleaned.end(), ',', ' ');\n std::stringstream ss(cleaned);\n std::string item;\n \n while(ss >> item) {\n sortedStrings.insert(item);\n }\n return sortedStrings;\n}\n\nreturn std::multiset(result.begin(), result.end()) == sorted_list_strings(expected);" }, "explanation": "https://www.youtube.com/watch?v=0BanwDe6cMY&pp=ygUVTmVldENvZGUgQmluYXJ5IFdhdGNo", @@ -1595,7 +1595,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "java": "return result.equals(expected);", "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=_g9jrLuAphs&pp=ygUbTmVldENvZGUgTG9uZ2VzdCBQYWxpbmRyb21l", @@ -1699,7 +1699,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=5rHz_6s2Buw&pp=ygUYTmVldENvZGUgQXJyYW5naW5nIENvaW5z", @@ -1751,7 +1751,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "java": "return result.equals(expected);", "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=JW8fgvoxPTg&pp=ygUXTmVldENvZGUgQXNzaWduIENvb2tpZXM%3D", @@ -1803,7 +1803,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=2qEmA76Unm4&pp=ygUjTmVldENvZGUgUmVwZWF0ZWQgU3Vic3RyaW5nIFBhdHRlcm4%3D", @@ -1905,7 +1905,7 @@ }, "compare_func": { "python": "expected = eval(expected); return result[0]*result[1] == expected[0]*expected[1] and result[0] >= result[1] and abs(result[0]-result[1]) <= abs(expected[0]-expected[1])", - "java": "String[] expectedComponents = expected.split(\",\");\nint[] expectedArray = {Integer.parseInt(expectedComponents[0].trim()), Integer.parseInt(expectedComponents[1].trim())};\n\nboolean conditionsMet = (result[0] * result[1] == expectedArray[0] * expectedArray[1]) &&\n (result[0] >= result[1]) &&\n (Math.abs(result[0] - result[1]) <= Math.abs(expectedArray[0] - expectedArray[1]));\n\nreturn conditionsMet;", + "java": "if (result == null && expected == null) return true;\n if (result == null || expected == null) return false;\n try {\n int[] r = (int[])result;\n int[] e = (int[])expected;\n return r.length == e.length && Arrays.equals(r, e);\n } catch (ClassCastException ex) {\n return false;\n }", "cpp": "// Assuming `result` and `expected` are both arrays of integers with size 2\nauto resultProduct = result[0] * result[1];\nauto expectedProduct = expected[0] * expected[1];\nauto resultDiff = std::abs(result[0] - result[1]);\nauto expectedDiff = std::abs(expected[0] - expected[1]);\n\nreturn resultProduct == expectedProduct && result[0] >= result[1] && resultDiff <= expectedDiff;" }, "explanation": "https://www.youtube.com/watch?v=-Lb4SvVyPCM&pp=ygUgTmVldENvZGUgQ29uc3RydWN0IHRoZSBSZWN0YW5nbGU%3D", @@ -1955,7 +1955,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "java": "return result.equals(expected);", "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=NejSCTIdd5k&pp=ygUYTmVldENvZGUgVGVlbW8gQXR0YWNraW5n", @@ -2055,7 +2055,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return Boolean.valueOf(result.toString()).equals(Boolean.valueOf(expected.toString()));", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=HLZLwjzIVGo&pp=ygUXTmVldENvZGUgUGVyZmVjdCBOdW1iZXI%3D", @@ -2081,7 +2081,7 @@ "--arg1='HELLO' --arg2=1", "--arg1='WORLD' --arg2=5", "--arg1='TEST.TEST' --arg2=3", - "--arg1='A --arg2=B --arg3=C' --arg4=2", + "--arg1='A,B,C' --arg2=2", "--arg1='abcdefghijklmnop' --arg2=4", "--arg1='ANTHROPIC' --arg2=3", "--arg1='Testing123' --arg2=2", @@ -2157,7 +2157,7 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=UuiTKBwPgAo&pp=ygUiTmVldENvZGUgQ29udGFpbmVyIFdpdGggTW9zdCBXYXRlcg%3D%3D", @@ -2207,7 +2207,7 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=PXWT4wzkA6M&pp=ygUVTmVldENvZGUgM1N1bSBDbG9zZXN0", @@ -2259,7 +2259,7 @@ }, "compare_func": { "python": "return result == int(expected)", - "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=U8XENwh8Oy8&pp=ygUnTmVldENvZGUgU2VhcmNoIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5", @@ -2276,9 +2276,9 @@ "--arg1=[] --arg2=0" ], "sample_test_results": [ - "(3, 4)", - "(-1, -1)", - "(-1, -1)" + "[3,4]", + "[-1,-1]", + "[-1,-1]" ], "hidden_test_cases": [ "--arg1=[1] --arg2=1", @@ -2293,16 +2293,16 @@ "--arg1=[1,2,3,4,5,5,5,5,6] --arg2=5" ], "hidden_test_results": [ - "(0, 0)", - "(0, 3)", - "(2, 2)", - "(4, 6)", - "(2, 2)", - "(-1, -1)", - "(-1, -1)", - "(3, 4)", - "(2, 4)", - "(4, 7)" + "[0,0]", + "[0,3]", + "[2,2]", + "[4,6]", + "[2,2]", + "[-1,-1]", + "[-1,-1]", + "[3,4]", + "[2,4]", + "[4,7]" ], "boilerplate": { "python": "class Solution:\n def searchRange(self, nums: List[int], target: int) -> List[int]:\n ", @@ -2311,7 +2311,7 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "if (result instanceof int[] && expected instanceof String) {\n int[] resultArray = (int[]) result;\n String expectedStr = (String) expected;\n // Parse the expected string to an int array\n String[] parts = expectedStr.replaceAll(\"[()\\s]\", \"\").split(\",\");\n int[] expectedArray = new int[parts.length];\n for (int i = 0; i < parts.length; i++) {\n expectedArray[i] = Integer.parseInt(parts[i]);\n }\n // Compare the arrays\n return Arrays.equals(resultArray, expectedArray);\n}\nreturn false;", + "java": "if (result == null && expected == null) {\n return true;\n }\n if (result == null || expected == null) {\n return false;\n }\n if (result.getClass().isArray() && expected.getClass().isArray()) {\n int[] arr1 = (int[]) result;\n int[] arr2 = (int[]) expected;\n if (arr1.length != arr2.length) {\n return false;\n }\n for (int i = 0; i < arr1.length; i++) {\n if (arr1[i] != arr2[i]) {\n return false;\n }\n }\n return true;\n }\n return result.equals(expected);", "cpp": "if (result.isArray() && expected.isString()) {\n // Convert expected string to a vector of integers\n std::string expectedStr = expected.asString();\n std::regex re(\"\\\\((-?\\\\d+),\\\\s*(-?\\\\d+)\\\\)\");\n std::smatch match;\n if (std::regex_search(expectedStr, match, re)) {\n std::vector expectedVec = {std::stoi(match[1]), std::stoi(match[2])};\n // Convert result JSON array to a vector of integers\n std::vector resultVec;\n for (const auto& elem : result) {\n resultVec.push_back(elem.asInt());\n }\n // Compare the vectors\n return resultVec == expectedVec;\n }\n}\nreturn false;" }, "explanation": "https://www.youtube.com/watch?v=4sQL7R5ySUU&pp=ygVATmVldENvZGUgRmluZCBGaXJzdCBhbmQgTGFzdCBQb3NpdGlvbiBvZiBFbGVtZW50IGluIFNvcnRlZCBBcnJheQ%3D%3D", @@ -2363,7 +2363,7 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return Objects.equals(result, expected);", + "java": "return result.equals(expected);", "cpp": "return result.asString() == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=iP4RH2zespg&pp=ygUWTmVldENvZGUgQ291bnQgYW5kIFNheQ%3D%3D", @@ -2415,7 +2415,7 @@ }, "compare_func": { "python": "return sorted([sorted(x) for x in result]) == eval(expected)", - "java": "Integer[][] resultArray = (Integer[][]) result;\nInteger[][] expectedArray = (Integer[][]) expected;\n\n// Sort each individual list in the result\nfor (Integer[] arr : resultArray) {\n Arrays.sort(arr);\n}\n// Sort the entire result array\nArrays.sort(resultArray, (a1, a2) -> Arrays.compare(a1, a2));\n\n// Sort each individual list in the expected\nfor (Integer[] arr : expectedArray) {\n Arrays.sort(arr);\n}\n// Sort the entire expected array\nArrays.sort(expectedArray, (a1, a2) -> Arrays.compare(a1, a2));\n\n// Compare the sorted arrays\nreturn Arrays.deepEquals(resultArray, expectedArray);", + "java": "if (result == null && expected == null) {\n return true;\n }\n if (result == null || expected == null) {\n return false;\n }\n\n if (result instanceof List && expected instanceof List) {\n List list1 = (List) result;\n List list2 = (List) expected;\n\n if (list1.size() != list2.size()) {\n return false;\n }\n\n // More robust comparison for nested lists and different element types\n for (int i = 0; i < list1.size(); i++) {\n \n System.out.println(\"Type of list1.get(i): \" + list1.get(i).getClass().getName());\n System.out.println(\"Type of list2.get(i): \" + list2.get(i).getClass().getName());\n if (!compare(list1.get(i), list2.get(i))) { // Recursive call\n return false;\n }\n }\n return true; // Lists are equal if all elements are equal\n } else if (result instanceof Integer && expected instanceof String) {\n Integer intResult = (Integer) result;\n String strExpected = (String) expected;\n return intResult.toString().equals(strExpected);\n } else if (result instanceof String && expected instanceof Integer) {\n return compare(expected, result);\n }\n\n // Handle other types (including primitive wrappers) directly\n return result.equals(expected);", "cpp": "std::vector> sortedResult;\nfor (const auto& vec : result) {\n std::vector sortedVec = vec;\n std::sort(sortedVec.begin(), sortedVec.end());\n sortedResult.push_back(sortedVec);\n}\nstd::sort(sortedResult.begin(), sortedResult.end());\n\nstd::vector> sortedExpected;\nfor (const auto& vec : expected) {\n std::vector sortedVec = vec;\n std::sort(sortedVec.begin(), sortedVec.end());\n sortedExpected.push_back(sortedVec);\n}\nstd::sort(sortedExpected.begin(), sortedExpected.end());\n\nreturn sortedResult == sortedExpected;" }, "explanation": "https://www.youtube.com/watch?v=FOyRpNUSFeA&pp=ygUbTmVldENvZGUgQ29tYmluYXRpb24gU3VtIElJ", @@ -2519,7 +2519,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return Integer.parseInt((String) expected) == (int) result;", + "java": "return result.equals(expected);", "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=dJ7sWiOoK7g&pp=ygUVTmVldENvZGUgSnVtcCBHYW1lIElJ", @@ -2571,7 +2571,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "java": "return result.equals(expected);", "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=5WZl3MMT0Eg&pp=ygUZTmVldENvZGUgTWF4aW11bSBTdWJhcnJheQ%3D%3D", @@ -2621,7 +2621,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "List resultList = (List) result;\nList expectedList = new Gson().fromJson((String) expected, new TypeToken>() {}.getType());\nreturn resultList.equals(expectedList);", + "java": "return result.equals(expected);", "cpp": "std::vector resultVec = jsonToValue>(result);\nstd::vector expectedVec = jsonToValue>(expected);\nreturn resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=BJnMZNwUk1M&pp=ygUWTmVldENvZGUgU3BpcmFsIE1hdHJpeA%3D%3D", @@ -2721,7 +2721,7 @@ }, "compare_func": { "python": "return str(sorted(result)) == str(eval(expected))", - "java": "int[][] resultArray = (int[][]) result;\nint[][] expectedArray = new Gson().fromJson(expected.toString(), int[][].class);\n\n// Sort both arrays by the first element of each interval\nArrays.sort(resultArray, (a, b) -> Integer.compare(a[0], b[0]));\nArrays.sort(expectedArray, (a, b) -> Integer.compare(a[0], b[0]));\n\n// Compare the sorted arrays\nreturn Arrays.deepEquals(resultArray, expectedArray);", + "java": "if (result == null && expected == null) {\n return true;\n }\n if (result == null || expected == null) {\n return false;\n }\n\n if (result instanceof int[][] && expected instanceof int[][]) {\n int[][] arr1 = (int[][]) result;\n int[][] arr2 = (int[][]) expected;\n\n if (arr1.length != arr2.length) {\n return false;\n }\n\n for (int i = 0; i < arr1.length; i++) {\n if (!Arrays.equals(arr1[i], arr2[i])) { // Correct comparison for int[]\n return false;\n }\n }\n return true;\n }\n return result.equals(expected);", "cpp": "// Convert result and expected to vectors of vectors of integers\nstd::vector> resultVec = jsonToValue>>(result);\nstd::vector> expectedVec = jsonToValue>>(expected);\n\n// Sort both vectors by the first element of each interval\nstd::sort(resultVec.begin(), resultVec.end(), [](const std::vector& a, const std::vector& b) {\n return a[0] < b[0];\n});\nstd::sort(expectedVec.begin(), expectedVec.end(), [](const std::vector& a, const std::vector& b) {\n return a[0] < b[0];\n});\n\n// Compare the sorted vectors\nreturn resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=A8NUOmlwOlM&pp=ygUYTmVldENvZGUgSW5zZXJ0IEludGVydmFs", @@ -2771,7 +2771,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "java": "return result.equals(expected);", "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=d3UOz7zdE4I&pp=ygUYTmVldENvZGUgVW5pcXVlIFBhdGhzIElJ", @@ -2879,7 +2879,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "java": "return result.equals(expected);", "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=XYi2-LPrwm4&pp=ygUWTmVldENvZGUgRWRpdCBEaXN0YW5jZQ%3D%3D", @@ -2931,7 +2931,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=Ber2pi2C0j0&pp=ygUbTmVldENvZGUgU2VhcmNoIGEgMkQgTWF0cml4", @@ -2983,7 +2983,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=pfiQ_PS1g8E&pp=ygUUTmVldENvZGUgV29yZCBTZWFyY2g%3D", @@ -3035,7 +3035,7 @@ }, "compare_func": { "python": "return sorted([sorted(x) for x in result]) == sorted(eval(expected))", - "java": "List> resultList = (List>) result;\nList> expectedList = (List>) expected;\n\nComparator> listComparator = (a, b) -> {\n int minLength = Math.min(a.size(), b.size());\n for (int i = 0; i < minLength; i++) {\n int cmp = Integer.compare(a.get(i), b.get(i));\n if (cmp != 0) {\n return cmp;\n }\n }\n return Integer.compare(a.size(), b.size());\n};\n\nresultList.forEach(Collections::sort);\nexpectedList.forEach(Collections::sort);\n\nCollections.sort(resultList, listComparator);\nCollections.sort(expectedList, listComparator);\n\nreturn resultList.equals(expectedList);", + "java": "if ((result instanceof Integer) && (expected instanceof String)) {\n Integer intResult = (Integer) result;\n String strExpected = (String) expected;\n return intResult.toString().equals(strExpected);\n } else if ((result instanceof String) && (expected instanceof Integer)) {\n return compare(expected, result);\n } else if (result instanceof Integer && expected instanceof Integer) {\n return result.equals(expected);\n }\n\n List resultList = (List) result;\n List expectedList = (List) expected;\n\n if (resultList.size()!= expectedList.size()) {\n return false;\n }\n\n for (int i = 0; i < resultList.size(); i++) {\n Object resultItem = resultList.get(i);\n Object expectedItem = expectedList.get(i);\n\n if (!compare(resultItem, expectedItem)) {\n return false;\n }\n }\n\n return true;", "cpp": "bool compareFunction(const std::vector>& result, const std::vector>& expected) {\n auto sort_inner_vectors = [](std::vector& vec) {\n std::sort(vec.begin(), vec.end());\n };\n\n // Sort inner vectors of result\n std::vector> sorted_result = result;\n std::for_each(sorted_result.begin(), sorted_result.end(), sort_inner_vectors);\n std::sort(sorted_result.begin(), sorted_result.end());\n\n // Sort inner vectors of expected\n std::vector> sorted_expected = expected;\n std::for_each(sorted_expected.begin(), sorted_expected.end(), sort_inner_vectors);\n std::sort(sorted_expected.begin(), sorted_expected.end());\n\n return sorted_result == sorted_expected;\n}" }, "explanation": "https://www.youtube.com/watch?v=Vn2v6ajA7U0&pp=ygUTTmVldENvZGUgU3Vic2V0cyBJSQ%3D%3D", @@ -3087,7 +3087,7 @@ }, "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", - "java": "List resultList = (List) result;\nList expectedList = (List) expected;\nCollections.sort(resultList);\nCollections.sort(expectedList);\nreturn resultList.equals(expectedList);", + "java": "if (result == null && expected == null) {\n return true;\n }\n if (result == null || expected == null) {\n return false;\n }\n\n // Handle List comparison\n if (result instanceof List && expected instanceof List) {\n List resultList = (List) result;\n List expectedList = (List) expected;\n\n if (resultList.size() != expectedList.size()) {\n return false;\n }\n\n // Create sorted copies of both lists for comparison\n List sortedResult = new ArrayList<>();\n List sortedExpected = new ArrayList<>();\n\n for (Object item : resultList) {\n sortedResult.add(item.toString());\n }\n for (Object item : expectedList) {\n sortedExpected.add(item.toString());\n }\n\n Collections.sort(sortedResult);\n Collections.sort(sortedExpected);\n\n return sortedResult.equals(sortedExpected);\n }\n return result.equals(expected);", "cpp": "std::vector expectedVec = jsonToValue>(expected);\nstd::sort(result.begin(), result.end());\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn result == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=61tN4YEdiTM&pp=ygUdTmVldENvZGUgUmVzdG9yZSBJUCBBZGRyZXNzZXM%3D", @@ -3139,7 +3139,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return ((Boolean) result).toString().toLowerCase().equals(expected.toString().toLowerCase());", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=3Rw3p9LrgvE&pp=ygUcTmVldENvZGUgSW50ZXJsZWF2aW5nIFN0cmluZw%3D%3D", @@ -3189,7 +3189,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=OM1MTokvxs4&pp=ygURTmVldENvZGUgVHJpYW5nbGU%3D", @@ -3239,7 +3239,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=P6RZZMu_maU&pp=ygUlTmVldENvZGUgTG9uZ2VzdCBDb25zZWN1dGl2ZSBTZXF1ZW5jZQ%3D%3D", @@ -3289,7 +3289,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return Integer.toString((Integer) result).equals(expected);", + "java": "return result.equals(expected);", "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=lJwbPZGo05A&pp=ygUUTmVldENvZGUgR2FzIFN0YXRpb24%3D", @@ -3341,7 +3341,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return ((Boolean) result).equals(Boolean.parseBoolean(expected.toString()));", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=Sx9NNgInc3A&pp=ygUTTmVldENvZGUgV29yZCBCcmVhaw%3D%3D", @@ -3393,7 +3393,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt((String) result) == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=iu0082c4HDE&pp=ygUpTmVldENvZGUgRXZhbHVhdGUgUmV2ZXJzZSBQb2xpc2ggTm90YXRpb24%3D", @@ -3497,7 +3497,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return static_cast(result) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=nIVW4P8b1VA&pp=ygUtTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5", @@ -3547,7 +3547,7 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=kMzJy9es7Hc&pp=ygUaTmVldENvZGUgRmluZCBQZWFrIEVsZW1lbnQ%3D", @@ -3597,7 +3597,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=imCKT3T2Oao&pp=ygUUTmVldENvZGUgTWF4aW11bSBHYXA%3D", @@ -3701,7 +3701,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return Integer.toString((Integer) result).equals(expected);", + "java": "return result.equals(expected);", "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=8g78yfzMlao&pp=ygUfTmVldENvZGUgRmlyc3QgTWlzc2luZyBQb3NpdGl2ZQ%3D%3D", @@ -3907,7 +3907,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=zx5Sw9130L0&pp=ygUnTmVldENvZGUgTGFyZ2VzdCBSZWN0YW5nbGUgaW4gSGlzdG9ncmFt", @@ -3959,7 +3959,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=tOylVCugy9k&pp=ygUaTmVldENvZGUgTWF4aW1hbCBSZWN0YW5nbGU%3D", @@ -4011,7 +4011,7 @@ }, "compare_func": { "python": "return str(result).lower() == expected.lower()", - "java": "return ((Boolean) result).toString().equalsIgnoreCase((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asBool() == expected.asBool();" }, "explanation": "https://www.youtube.com/watch?v=MDmZm_aVDF8&pp=ygUYTmVldENvZGUgU2NyYW1ibGUgU3RyaW5n", @@ -4061,7 +4061,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt((String) result) == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=-RDzMJ33nx8&pp=ygUeTmVldENvZGUgRGlzdGluY3QgU3Vic2VxdWVuY2Vz", @@ -4113,7 +4113,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=37s1_xBiqH0&pp=ygUsTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJSUk%3D", @@ -4165,7 +4165,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return ((Integer) result).equals(Integer.parseInt((String) expected));", + "java": "return result.equals(expected);", "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=h9iTnkgv05E&pp=ygUUTmVldENvZGUgV29yZCBMYWRkZXI%3D", @@ -4217,7 +4217,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "java": "return result.equals(expected);", "cpp": "return std::to_string(result.asInt()) == expected.asString();" }, "explanation": "https://www.youtube.com/watch?v=1IzCRCcK17A&pp=ygUOTmVldENvZGUgQ2FuZHk%3D", @@ -4269,7 +4269,7 @@ }, "compare_func": { "python": "def normalize(s): return sorted([x.strip() for x in eval(s)])\n return normalize(str(result)) == normalize(expected)", - "java": "String normalize(String s) {\n return Arrays.stream(s.trim().substring(1, s.length() - 1).split(\",\"))\n .map(String::trim)\n .sorted()\n .collect(Collectors.joining(\",\"));\n}\n\nString resultNormalized = normalize(result.toString());\nString expectedNormalized = normalize(expected);\nreturn resultNormalized.equals(expectedNormalized);", + "java": "if (result == null && expected == null) {\n return true;\n }\n if (result == null || expected == null) {\n return false;\n }\n\n if (result instanceof List && expected instanceof List) {\n List resultList = (List) result;\n List expectedList = (List) expected;\n\n if (resultList.size()!= expectedList.size()) {\n return false;\n }\n\n for (int i = 0; i < resultList.size(); i++) {\n if (!Objects.deepEquals(resultList.get(i), expectedList.get(i))) {\n return false;\n }\n }\n return true;\n } else {\n return Objects.deepEquals(result, expected);\n }", "cpp": "std::vector resultVec = jsonToValue>(result);\nstd::vector expectedVec = jsonToValue>(expected);\nstd::sort(resultVec.begin(), resultVec.end());\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=QgLKdluDo08&pp=ygUWTmVldENvZGUgV29yZCBCcmVhayBJSQ%3D%3D", @@ -4321,7 +4321,7 @@ }, "compare_func": { "python": "return str(result) == expected", - "java": "return ((Integer) result).intValue() == Integer.parseInt((String) expected);", + "java": "return result.equals(expected);", "cpp": "return result.asInt() == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=oUnF7o88_Xc&pp=ygUwTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5IElJ", @@ -4423,7 +4423,7 @@ }, "compare_func": { "python": "return result == eval(expected)", - "java": "if (result instanceof List && expected instanceof String) {\n // Parse the expected string as a list of lists of integers\n Gson gson = new Gson();\n List> expectedList = gson.fromJson((String) expected, new TypeToken>>() {}.getType());\n // Cast the result to a list of lists of integers\n List> resultList = (List>) result;\n // Compare the two lists\n return resultList.equals(expectedList);\n} else {\n return result.equals(expected);\n}", + "java": "if (result == null && expected == null) return true;\n if (result == null || expected == null) return false;\n \n if (result instanceof List && expected instanceof List) {\n List resList = (List) result;\n List expList = (List) expected;\n if (resList.size() != expList.size()) return false;\n for (int i = 0; i < resList.size(); i++) {\n if (!compare(resList.get(i), expList.get(i))) return false;\n }\n return true;\n } else if (expected instanceof Unknown) {\n try {\n Object parsed = parseValue(((Unknown) expected).get(), result.getClass());\n return compare(result, parsed);\n } catch (Exception e) {\n return false;\n }\n }\n return result.equals(expected);", "cpp": "if (result.isArray() && expected.isString()) {\n // Parse the expected string as a JSON array\n Json::Value expectedJson;\n Json::CharReaderBuilder builder;\n std::string errors;\n std::unique_ptr reader(builder.newCharReader());\n if (!reader->parse(expected.asCString(), expected.asCString() + expected.asString().length(), &expectedJson, &errors)) {\n throw std::runtime_error(\"Failed to parse expected JSON: \" + errors);\n }\n \n // Sort both result and expectedJson\n auto sortJsonArray = [](Json::Value& array) {\n std::sort(array.begin(), array.end(), [](const Json::Value& a, const Json::Value& b) {\n if (a[0] != b[0]) return a[0].asInt() < b[0].asInt();\n return a[1].asInt() < b[1].asInt();\n });\n };\n \n sortJsonArray(result);\n sortJsonArray(expectedJson);\n \n // Compare the sorted arrays\n return result == expectedJson;\n} else {\n return result == expected;\n}" }, "explanation": "https://www.youtube.com/watch?v=XhzHXj7wrwo&pp=ygUcTmVldENvZGUgVGhlIFNreWxpbmUgUHJvYmxlbQ%3D%3D", @@ -4475,7 +4475,7 @@ }, "compare_func": { "python": "return int(result) == int(expected)", - "java": "return Integer.parseInt(result.toString()) == Integer.parseInt(expected.toString());", + "java": "return result.equals(expected);", "cpp": "return std::stoi(result.asString()) == std::stoi(expected.asString());" }, "explanation": "https://www.youtube.com/watch?v=zsJ-J08Qgdk&pp=ygUZTmVldENvZGUgQmFzaWMgQ2FsY3VsYXRvcg%3D%3D", diff --git a/app/services/execution/templates.py b/app/services/execution/templates.py index f553f10..796ffa0 100644 --- a/app/services/execution/templates.py +++ b/app/services/execution/templates.py @@ -100,6 +100,23 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): {code} public class {file_name} {{ + private static class Unknown {{ + private final String value; + + public Unknown(String value) {{ + this.value = value; + }} + + public String get() {{ + return value; + }} + + @Override + public String toString() {{ + return value; + }} + }} + private static boolean compare(Object result, Object expected) {{ {compare_func} }} @@ -107,19 +124,38 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): public static JsonArray runTests(Solution solution, JsonArray testData) {{ JsonArray results = new JsonArray(); Gson gson = new Gson(); - + + Method[] methods = Solution.class.getMethods(); + Method targetMethod = null; + + for (Method method : methods) {{ + if (method.getName().equals("{method_name}")) {{ + if (targetMethod == null) {{ + targetMethod = method; + }} else {{ + throw new RuntimeException("Multiple '{method_name}' methods found. Cannot determine which to use."); + }} + }} + }} + + if (targetMethod == null) {{ + throw new RuntimeException("Method '{method_name}' not found."); + }} + + Class[] paramTypes = targetMethod.getParameterTypes(); + Class returnType = targetMethod.getReturnType(); + for (JsonElement testElement : testData) {{ JsonObject test = testElement.getAsJsonObject(); JsonObject result = new JsonObject(); - + try {{ String inputStr = test.get("input").getAsString(); - Object[] args = parseArguments(inputStr); - Class[] paramTypes = getParameterTypes(args); - - Method method = Solution.class.getMethod("{method_name}", paramTypes); - Object output = method.invoke(solution, args); - boolean passed = compare(output, parseValue(test.get("expected").getAsString())); + Object[] args = parseArguments(inputStr, paramTypes); + Object output = targetMethod.invoke(solution, args); + Object expected = parseValue(test.get("expected").getAsString(), returnType); + + boolean passed = compare(output, expected); result.addProperty("passed", passed); result.addProperty("output", gson.toJson(output)); result.addProperty("expected", test.get("expected").getAsString()); @@ -132,90 +168,163 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): return results; }} - private static Class getArrayType(Object arr) {{ - if (!arr.getClass().isArray()) {{ - return arr.getClass(); + + private static Object parsePrimitiveArray(String arrayContent, Class componentType) {{ + if (arrayContent.trim().isEmpty()) {{ + return Array.newInstance(componentType, 0); }} - Class arrClass = arr.getClass(); - if (arrClass == int[].class) return int[].class; - if (arrClass == double[].class) return double[].class; - if (arrClass == boolean[].class) return boolean[].class; - if (arrClass == char[].class) return char[].class; - if (arrClass == long[].class) return long[].class; - if (arrClass == float[].class) return float[].class; - if (arrClass == byte[].class) return byte[].class; - if (arrClass == short[].class) return short[].class; - - Object[] array = (Object[]) arr; - if (array.length == 0) {{ - return Object[].class; - }} - - // Find the most specific common type among non-null elements - Class commonType = null; - for (Object element : array) {{ - if (element != null) {{ - Class currentType = element.getClass(); - if (commonType == null) {{ - commonType = currentType; + String[] elements = arrayContent.split("\\s*,\\s*"); + Object array = Array.newInstance(componentType, elements.length); + + for (int i = 0; i < elements.length; i++) {{ + String element = elements[i].trim(); + if (componentType == int.class) {{ + Array.setInt(array, i, Integer.parseInt(element)); + }} else if (componentType == long.class) {{ + Array.setLong(array, i, Long.parseLong(element)); + }} else if (componentType == double.class) {{ + Array.setDouble(array, i, Double.parseDouble(element)); + }} else if (componentType == float.class) {{ + Array.setFloat(array, i, Float.parseFloat(element)); + }} else if (componentType == boolean.class) {{ + Array.setBoolean(array, i, Boolean.parseBoolean(element)); + }} else if (componentType == byte.class) {{ + Array.setByte(array, i, Byte.parseByte(element)); + }} else if (componentType == short.class) {{ + Array.setShort(array, i, Short.parseShort(element)); + }} else if (componentType == char.class) {{ + Array.setChar(array, i, element.charAt(0)); + }} else {{ + throw new IllegalArgumentException("Unsupported primitive type: " + componentType); + }} + }} + return array; + }} + + private static Object parseValue(String value, Class targetType) {{ + if (value == null || value.trim().equals("null")) {{ + return null; + }} + + value = value.trim(); + + // Handle unknown + if (targetType == Unknown.class) {{ + return new Unknown(value); + }} + + // Handle arrays + if (targetType.isArray()) {{ + if (!value.startsWith("[") || !value.endsWith("]")) {{ + throw new IllegalArgumentException("Expected array value, got: " + value); + }} + + String arrayContent = value.substring(1, value.length() - 1); + Class componentType = targetType.getComponentType(); + + if (componentType.isPrimitive()) {{ + return parsePrimitiveArray(arrayContent, componentType); + }} else {{ + Object[] parsed = parseArray(arrayContent, componentType); + Object typedArray = Array.newInstance(componentType, parsed.length); + System.arraycopy(parsed, 0, typedArray, 0, parsed.length); + return typedArray; + }} + }} + + // Handle strings + if (targetType == String.class) {{ + if ((value.startsWith("\"") && value.endsWith("\"")) || + (value.startsWith("'") && value.endsWith("'"))) {{ + return value.substring(1, value.length() - 1); + }} + return value; + }} + + // Handle List type + if (List.class.isAssignableFrom(targetType)) {{ + if (!value.startsWith("[") || !value.endsWith("]")) {{ + throw new IllegalArgumentException("Expected list value, got: " + value); + }} + // Parse the content within the brackets recursively + // Passing String.class so that nested lists are also parsed correctly. + Object[] parsed = parseArray(value.substring(1, value.length() - 1), Unknown.class); + List list = new ArrayList<>(); + for (Object item : parsed) {{ + if (item instanceof Unknown) {{ + list.add(parseValueWithoutType(item.toString())); }} else {{ - // Find the most specific common superclass - while (!commonType.isAssignableFrom(currentType)) {{ - commonType = commonType.getSuperclass(); - if (commonType == null) {{ - return Object[].class; - }} - }} + list.add(item); }} }} + return list; }} - // If all elements are null or no common type found - if (commonType == null) {{ - return Object[].class; + // Handle primitive types and their wrappers + if (targetType == boolean.class || targetType == Boolean.class) {{ + return Boolean.parseBoolean(value); + }} + if (targetType == int.class || targetType == Integer.class) {{ + return Integer.parseInt(value); + }} + if (targetType == long.class || targetType == Long.class) {{ + return Long.parseLong(value); + }} + if (targetType == double.class || targetType == Double.class) {{ + return Double.parseDouble(value); + }} + if (targetType == float.class || targetType == Float.class) {{ + return Float.parseFloat(value); + }} + if (targetType == byte.class || targetType == Byte.class) {{ + return Byte.parseByte(value); + }} + if (targetType == short.class || targetType == Short.class) {{ + return Short.parseShort(value); + }} + if (targetType == char.class || targetType == Character.class) {{ + String trimmed = value.trim().substring(1, value.length() - 1); + if (trimmed.length() != 1) {{ + throw new IllegalArgumentException("Cannot convert to char: " + value); + }} + return trimmed.charAt(0); }} - // Handle primitive wrapper types - if (commonType == Integer.class) return int[].class; - if (commonType == Double.class) return double[].class; - if (commonType == Boolean.class) return boolean[].class; - if (commonType == Character.class) return char[].class; - if (commonType == Long.class) return long[].class; - if (commonType == Float.class) return float[].class; - if (commonType == Byte.class) return byte[].class; - if (commonType == Short.class) return short[].class; - - // For other types, return appropriate array type - return Array.newInstance(commonType, 0).getClass(); + throw new IllegalArgumentException("Unsupported type: " + targetType.getName()); }} - private static Class[] getParameterTypes(Object[] args) {{ - Class[] types = new Class[args.length]; - for (int i = 0; i < args.length; i++) {{ - if (args[i] == null) {{ - types[i] = Object.class; - }} else if (args[i].getClass().isArray()) {{ - types[i] = getArrayType(args[i]); - }} else {{ - Class type = args[i].getClass(); - if (type == Integer.class) type = int.class; - if (type == Double.class) type = double.class; - if (type == Boolean.class) type = boolean.class; - if (type == Character.class) type = char.class; - if (type == Long.class) type = long.class; - if (type == Float.class) type = float.class; - if (type == Byte.class) type = byte.class; - if (type == Short.class) type = short.class; - types[i] = type; + // Bad code alert + private static Object parseValueWithoutType(String value) {{ + value = value.trim(); + + if (value.startsWith("[") && value.endsWith("]")) {{ + return parseValue(value, List.class); + }} else if (value.startsWith("\"") && value.endsWith("\"") || value.startsWith("'") && value.endsWith("'")) {{ + return parseValue(value, String.class); + }} else if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false")) {{ + return parseValue(value, Boolean.class); + }} else if (value.matches("-?\\d+(\\.\\d+)?")) {{ + if (value.contains(".")) {{ + try {{ + return parseValue(value, Double.class); + }} catch (IllegalArgumentException ex) {{ + return parseValue(value, Float.class); + }} + }} + try {{ + return parseValue(value, Integer.class); + }} catch (IllegalArgumentException ex) {{ + return parseValue(value, Long.class); }} }} - return types; + return value; }} - private static Object[] parseArguments(String input) {{ + private static Object[] parseArguments(String input, Class[] paramTypes) {{ List arguments = new ArrayList<>(); String[] parts = input.split("--arg\\d+"); + int argIndex = 0; for (String part : parts) {{ if (part.trim().isEmpty()) continue; @@ -225,16 +334,25 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): value = value.substring(1).trim(); }} - arguments.add(parseValue(value)); + if (argIndex >= paramTypes.length) {{ + throw new IllegalArgumentException("More arguments provided than parameter types"); + }} + + arguments.add(parseValue(value, paramTypes[argIndex])); + argIndex++; + }} + + if (argIndex != paramTypes.length) {{ + throw new IllegalArgumentException("Not enough arguments provided for parameter types"); }} return arguments.toArray(); }} - private static Object[] parseArray(String arrayContent) {{ + private static Object[] parseArray(String arrayContent, Class componentType) {{ List elements = new ArrayList<>(); if (arrayContent.trim().isEmpty()) {{ - return new Object[0]; + return (Object[]) Array.newInstance(componentType, 0); }} StringBuilder current = new StringBuilder(); @@ -257,75 +375,24 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): }} else if (!inString && (c == ']' || c == '}}')) {{ depth--; current.append(c); - }} else if (!inString && c == ',' && depth == 0) {{ - elements.add(parseValue(current.toString().trim())); - current.setLength(0); // reset the StringBuilder + }} else if (c == ',' && depth == 0) {{ + if (inString) {{ + elements.add(current.toString().substring(1, current.length() - 1)); + }} else {{ + elements.add(parseValue(current.toString().trim(), componentType)); + }} + current.setLength(0); }} else {{ current.append(c); }} }} if (current.length() > 0) {{ - elements.add(parseValue(current.toString().trim())); + elements.add(parseValue(current.toString().trim(), componentType)); }} - return elements.toArray(); - }} - - private static Object parseValue(String value) {{ - value = value.trim(); - - // Keep quoted strings as is - if ((value.startsWith("'") && value.endsWith("'")) || - (value.startsWith("\"") && value.endsWith("\""))) {{ - return value.substring(1, value.length() - 1); - }} - - // Handle null - if (value.equals("null")) {{ - return null; - }} - - // Handle boolean - if (value.equals("true") || value.equals("false")) {{ - return Boolean.parseBoolean(value); - }} - - // Handle arrays - if (value.startsWith("[") && value.endsWith("]")) {{ - Object[] parsed = parseArray(value.substring(1, value.length() - 1)); - Class arrayType = getArrayType(parsed); - - // Convert to the appropriate array type - int length = parsed.length; - Object typedArray = Array.newInstance(arrayType.getComponentType(), length); - - for (int i = 0; i < length; i++) {{ - if (parsed[i] != null) {{ - Array.set(typedArray, i, parsed[i]); - }} - }} - - return typedArray; - }} - - // Handle objects/maps - if (value.startsWith("{{") && value.endsWith("}}")) {{ - Map map = new HashMap<>(); - // TODO: Implement object parsing if needed - return map; - }} - - // Handle numbers - try {{ - if (value.contains(".")) {{ - return Double.parseDouble(value); - }} - return Integer.parseInt(value); - }} catch (NumberFormatException e) {{ - // If not a number, return as string - return value; - }} + Object[] result = (Object[]) Array.newInstance(componentType, elements.size()); + return elements.toArray(result); }} // Wraps the results in a "test_results" field and adds a "summary" field. @@ -353,8 +420,10 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): Gson gson = new Gson(); Solution solution = new Solution(); - JsonArray testData = gson.fromJson("{test_data}", JsonArray.class); - JsonArray sampleData = gson.fromJson("{sample_data}", JsonArray.class); + String testStr = {test_data}; + String sampleStr = {sample_data}; + JsonArray testData = gson.fromJson(testStr, JsonArray.class); + JsonArray sampleData = gson.fromJson(sampleStr, JsonArray.class); JsonObject results = new JsonObject(); results.add("hidden_results", createResultObject(runTests(solution, testData))); diff --git a/app/services/execution/test_generator.py b/app/services/execution/test_generator.py index b22f63c..3445be0 100644 --- a/app/services/execution/test_generator.py +++ b/app/services/execution/test_generator.py @@ -3,13 +3,22 @@ from abc import ABC, abstractmethod from services.execution.templates import PYTHON_TEMPLATE, JAVA_TEMPLATE, CPP_TEMPLATE + class TestGenerator(ABC): """ A class to generate test runner code for a given solution code, test data and compare function. """ @abstractmethod - def generate_test_file(self, code: str, file_name: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + def generate_test_file( + self, + code: str, + file_name: str, + method_name: str, + test_data: List[Dict], + sample_data: List[Dict], + compare_func: str, + ) -> str: """ Generate test runner code for a given solution code, test data and compare function. @@ -18,21 +27,32 @@ def generate_test_file(self, code: str, file_name: str, method_name: str, test_d :param test_data: The test data. :param compare_func: The compare function. """ - + @abstractmethod def get_file_extension(self, lang: str) -> str: """ Get the file extension for the given language. """ - + def process_quotes(self, json_str: str) -> str: """ Process quotes in a JSON string. """ - return json_str.replace('"', '\\"').replace('\\\\"', '\\\\\\"') # cursed code alert + return json_str.replace('"', '\\"').replace( + '\\\\"', '\\\\\\"' + ) # cursed code alert + class PythonTestGenerator(TestGenerator): - def generate_test_file(self, code: str, file_name: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + def generate_test_file( + self, + code: str, + file_name: str, + method_name: str, + test_data: List[Dict], + sample_data: List[Dict], + compare_func: str, + ) -> str: return PYTHON_TEMPLATE.format( code=code, method_name=method_name, @@ -44,32 +64,77 @@ def generate_test_file(self, code: str, file_name: str, method_name: str, test_d def get_file_extension(self, lang: str) -> str: return ".py" + class JavaTestGenerator(TestGenerator): - def generate_test_file(self, code: str, file_name: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + def generate_test_file( + self, + code: str, + file_name: str, + method_name: str, + test_data: List[Dict], + sample_data: List[Dict], + compare_func: str, + ) -> str: + MAX_STR_LEN = 60000 + test_data = self.process_quotes(json.dumps(test_data)) + sample_data = self.process_quotes(json.dumps(sample_data)) + if len(test_data) > MAX_STR_LEN: + test_data = self.data_chunks(test_data) + else: + test_data = f'"{test_data}"' + if len(sample_data) > MAX_STR_LEN: + sample_data = self.data_chunks(test_data) + else: + sample_data = f'"{sample_data}"' + return JAVA_TEMPLATE.format( code=code, file_name=file_name, method_name=method_name, compare_func=compare_func, - test_data=self.process_quotes(json.dumps(test_data)), - sample_data=self.process_quotes(json.dumps(sample_data)), + test_data=test_data, + sample_data=sample_data, ) def get_file_extension(self, lang: str) -> str: return ".java" + # Apparently string variables can only be 65k characters max in java + def data_chunks(self, data: str) -> str: + """Converts the data to a string of concatenated JSON strings.""" + MAX_LENGTH = 1000 + json_strings = [] + cur = 0 + while cur < len(data): + if cur + MAX_LENGTH < len(data): + next_chunk = data[cur : cur + MAX_LENGTH] + else: + next_chunk = data[cur:] + json_strings.append(next_chunk) + cur += MAX_LENGTH + chunks = ''.join(['.append("' + s + '")' for s in json_strings]) + return f"new StringBuilder(){chunks}.toString()" + class CppTestGenerator(TestGenerator): - def generate_test_file(self, code: str, file_name: str, method_name: str, test_data: List[Dict], sample_data: List[Dict], compare_func: str) -> str: + def generate_test_file( + self, + code: str, + file_name: str, + method_name: str, + test_data: List[Dict], + sample_data: List[Dict], + compare_func: str, + ) -> str: args_init, args_param = self.process_args(test_data[0]["input"]) return CPP_TEMPLATE.format( code=code, file_name=file_name, - method_name=method_name, + method_name=method_name, compare_func=compare_func, test_data=self.process_quotes(json.dumps(test_data)), sample_data=self.process_quotes(json.dumps(sample_data)), args_init=args_init, - args_param=args_param + args_param=args_param, ) def process_args(self, args: str) -> (str, str): From 3a41e329662c7e0a1ec2b8e4a91babab70284aa4 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Thu, 13 Feb 2025 12:39:56 -0500 Subject: [PATCH 16/24] Tested 100 cpp tests + Update docker result parsing --- app/db/combined.json | 32 ++++----- app/services/execution/docker.py | 52 ++++++++++---- app/services/execution/templates.py | 71 ++++++++++++------- app/services/execution/test_generator.py | 57 +++++++++++++-- app/tests/unit/code_execution_test.py | 2 +- ...dation_test.py => test_generation_test.py} | 3 +- 6 files changed, 153 insertions(+), 64 deletions(-) rename app/tests/unit/{code_validation_test.py => test_generation_test.py} (98%) diff --git a/app/db/combined.json b/app/db/combined.json index 52e9f27..279f400 100644 --- a/app/db/combined.json +++ b/app/db/combined.json @@ -45,8 +45,8 @@ }, "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", - "java": "return Arrays.equals((int[]) result, (int []) expected);", - "cpp": "std::sort(result.begin(), result.end());\nstd::vector expected_vector;\nstd::stringstream ss(expected.asString());\nint number;\nwhile (ss >> number) {\n expected_vector.push_back(number);\n if (ss.peek() == ',') {\n ss.ignore();\n }\n}\nstd::sort(expected_vector.begin(), expected_vector.end());\nreturn result == expected_vector;" + "java": "int[] resultArr = (int[]) result;\n int[] expectedArr = (int[]) expected;\n \n if (resultArr.length != expectedArr.length) {\n return false;\n }\n \n // Sort both arrays to make order-independent comparison\n int[] sortedResult = resultArr.clone();\n int[] sortedExpected = expectedArr.clone();\n Arrays.sort(sortedResult);\n Arrays.sort(sortedExpected);\n \n return Arrays.equals(sortedResult, sortedExpected);", + "cpp": "std::vector result_vector;\n for (const auto& value : result) {\n result_vector.push_back(value.asInt());\n }\n\n std::vector expected_vector;\n for (const auto& value : expected) {\n expected_vector.push_back(value.asInt());\n }\n\n std::sort(result_vector.begin(), result_vector.end());\n std::sort(expected_vector.begin(), expected_vector.end());\n\n return result_vector == expected_vector;" }, "explanation": "https://www.youtube.com/watch?v=KLlXCFG5TnA&pp=ygUQTmVldENvZGUgVHdvIFN1bQ%3D%3D", "method_name": "twoSum" @@ -872,7 +872,7 @@ "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", "java": "return result.equals(expected);", - "cpp": "std::vector expected_result;\neval(expected, expected_result); // Assume eval is a function that populates expected_result\nstd::sort(result.begin(), result.end());\nstd::sort(expected_result.begin(), expected_result.end());\nreturn result == expected_result;" + "cpp": "if (!result.isArray() || !expected.isArray()) {\n return false;\n }\n if (result.size() != expected.size()) {\n return false;\n }\n for (size_t i = 0; i < result.size(); ++i) {\n if (result[static_cast(i)] != expected[static_cast(i)]) { \n return false;\n }\n }\n return true;" }, "explanation": "https://www.youtube.com/watch?v=ZHJDwbfqoa8&pp=ygUXTmVldENvZGUgU3VtbWFyeSBSYW5nZXM%3D", "method_name": "summaryRanges" @@ -1284,7 +1284,7 @@ "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", "java": "if (result instanceof Unknown || expected instanceof Unknown) {\n return true;\n }\n\n if (result == null || expected == null) {\n return result == expected;\n }\n\n if (result.getClass().isArray()) {\n if (!expected.getClass().isArray()) {\n return false;\n }\n int length = Array.getLength(result);\n if (length != Array.getLength(expected)) {\n return false;\n }\n // Convert arrays to lists for sorting\n List resultList = new ArrayList<>();\n List expectedList = new ArrayList<>();\n for (int i = 0; i < length; i++) {\n resultList.add(Array.get(result, i));\n expectedList.add(Array.get(expected, i));\n }\n Collections.sort(resultList, Comparator.comparing(Object::toString));\n Collections.sort(expectedList, Comparator.comparing(Object::toString));\n for (int i = 0; i < length; i++) {\n if (!compare(resultList.get(i), expectedList.get(i))) {\n return false;\n }\n }\n return true;\n }\n\n if (result instanceof List && expected instanceof List) {\n if (!(expected instanceof List)) {\n return false;\n }\n List resultList = new ArrayList<>((List) result);\n List expectedList = new ArrayList<>((List) expected);\n if (resultList.size() != expectedList.size()) {\n return false;\n }\n // Sort both lists\n Collections.sort((List)resultList, Comparator.comparing(Object::toString));\n Collections.sort((List)expectedList, Comparator.comparing(Object::toString));\n for (int i = 0; i < resultList.size(); i++) {\n if (!compare(resultList.get(i), expectedList.get(i))) {\n return false;\n }\n }\n return true;\n }\n\n return result.equals(expected);", - "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedVec;\nistringstream iss(expected.substr(1, expected.size() - 2));\nint number;\nwhile (iss >> number) {\n expectedVec.push_back(number);\n if (iss.peek() == ',')\n iss.ignore();\n}\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn result == expectedVec;" + "cpp": "std::vector result_vector;\n for (const auto& value : result) {\n result_vector.push_back(value.asInt());\n }\n\n std::vector expected_vector;\n for (const auto& value : expected) {\n expected_vector.push_back(value.asInt());\n }\n\n std::sort(result_vector.begin(), result_vector.end());\n std::sort(expected_vector.begin(), expected_vector.end());\n\n return result_vector == expected_vector;" }, "explanation": "https://www.youtube.com/watch?v=fwUTXaMom6U&pp=ygUmTmVldENvZGUgSW50ZXJzZWN0aW9uIG9mIFR3byBBcnJheXMgSUk%3D", "method_name": "intersect" @@ -1492,7 +1492,7 @@ "compare_func": { "python": "def sorted_list_strings(lst):\n return sorted([str(x) for x in eval(lst)])\n return sorted(result) == sorted_list_strings(expected)", "java": "if (result == null && expected == null) {\n return true;\n }\n if (result == null || expected == null) {\n return false;\n }\n\n List resultList;\n List expectedList;\n\n if (result instanceof List) {\n resultList = (List) result;\n } else if (result instanceof String[]) {\n resultList = Arrays.asList((String[]) result);\n } else {\n return false;\n }\n\n if (expected instanceof List) {\n expectedList = (List) expected;\n } else if (expected instanceof String[]) {\n expectedList = Arrays.asList((String[]) expected);\n } else {\n return false;\n }\n\n if (resultList.size() != expectedList.size()) {\n return false;\n }\n List sortedResult = new ArrayList<>(resultList);\n List sortedExpected = new ArrayList<>(expectedList);\n Collections.sort(sortedResult);\n Collections.sort(sortedExpected);\n return sortedResult.equals(sortedExpected);\n", - "cpp": "std::multiset sorted_list_strings(const std::string& lst) {\n std::multiset sortedStrings;\n std::string cleaned = lst;\n // Remove leading/trailing whitespace\n cleaned.erase(0, cleaned.find_first_not_of(\" \\t\\n\\r\"));\n cleaned.erase(cleaned.find_last_not_of(\" \\t\\n\\r\") + 1);\n \n // Substitute all commas with spaces\n std::replace(cleaned.begin(), cleaned.end(), ',', ' ');\n std::stringstream ss(cleaned);\n std::string item;\n \n while(ss >> item) {\n sortedStrings.insert(item);\n }\n return sortedStrings;\n}\n\nreturn std::multiset(result.begin(), result.end()) == sorted_list_strings(expected);" + "cpp": "if (!result.isArray() ||!expected.isArray()) {\n return false; // Both must be arrays\n }\n\n if (result.size()!= expected.size()) return false;\n\n std::vector resultVec;\n std::vector expectedVec;\n\n for (const auto& val: result) {\n if (!val.isString()) return false; // Ensure all elements are strings\n resultVec.push_back(val.asString());\n }\n for (const auto& val: expected) {\n if (!val.isString()) return false; // Ensure all elements are strings\n expectedVec.push_back(val.asString());\n }\n\n std::sort(resultVec.begin(), resultVec.end());\n std::sort(expectedVec.begin(), expectedVec.end());\n\n return resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=0BanwDe6cMY&pp=ygUVTmVldENvZGUgQmluYXJ5IFdhdGNo", "method_name": "readBinaryWatch" @@ -1906,7 +1906,7 @@ "compare_func": { "python": "expected = eval(expected); return result[0]*result[1] == expected[0]*expected[1] and result[0] >= result[1] and abs(result[0]-result[1]) <= abs(expected[0]-expected[1])", "java": "if (result == null && expected == null) return true;\n if (result == null || expected == null) return false;\n try {\n int[] r = (int[])result;\n int[] e = (int[])expected;\n return r.length == e.length && Arrays.equals(r, e);\n } catch (ClassCastException ex) {\n return false;\n }", - "cpp": "// Assuming `result` and `expected` are both arrays of integers with size 2\nauto resultProduct = result[0] * result[1];\nauto expectedProduct = expected[0] * expected[1];\nauto resultDiff = std::abs(result[0] - result[1]);\nauto expectedDiff = std::abs(expected[0] - expected[1]);\n\nreturn resultProduct == expectedProduct && result[0] >= result[1] && resultDiff <= expectedDiff;" + "cpp": "if (!result.isArray() ||!expected.isArray()) {\n return false;\n }\n\n if (result.size()!= expected.size() || result.size()!= 2) {\n return false;\n }\n\n std::vector resultVec;\n std::vector expectedVec;\n\n for (const auto& val: result) {\n if (!val.isInt()) return false;\n resultVec.push_back(val.asInt());\n }\n\n for (const auto& val: expected) {\n if (!val.isInt()) return false;\n expectedVec.push_back(val.asInt());\n }\n\n std::sort(resultVec.begin(), resultVec.end());\n std::sort(expectedVec.begin(), expectedVec.end());\n\n return resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=-Lb4SvVyPCM&pp=ygUgTmVldENvZGUgQ29uc3RydWN0IHRoZSBSZWN0YW5nbGU%3D", "method_name": "constructRectangle" @@ -2416,7 +2416,7 @@ "compare_func": { "python": "return sorted([sorted(x) for x in result]) == eval(expected)", "java": "if (result == null && expected == null) {\n return true;\n }\n if (result == null || expected == null) {\n return false;\n }\n\n if (result instanceof List && expected instanceof List) {\n List list1 = (List) result;\n List list2 = (List) expected;\n\n if (list1.size() != list2.size()) {\n return false;\n }\n\n // More robust comparison for nested lists and different element types\n for (int i = 0; i < list1.size(); i++) {\n \n System.out.println(\"Type of list1.get(i): \" + list1.get(i).getClass().getName());\n System.out.println(\"Type of list2.get(i): \" + list2.get(i).getClass().getName());\n if (!compare(list1.get(i), list2.get(i))) { // Recursive call\n return false;\n }\n }\n return true; // Lists are equal if all elements are equal\n } else if (result instanceof Integer && expected instanceof String) {\n Integer intResult = (Integer) result;\n String strExpected = (String) expected;\n return intResult.toString().equals(strExpected);\n } else if (result instanceof String && expected instanceof Integer) {\n return compare(expected, result);\n }\n\n // Handle other types (including primitive wrappers) directly\n return result.equals(expected);", - "cpp": "std::vector> sortedResult;\nfor (const auto& vec : result) {\n std::vector sortedVec = vec;\n std::sort(sortedVec.begin(), sortedVec.end());\n sortedResult.push_back(sortedVec);\n}\nstd::sort(sortedResult.begin(), sortedResult.end());\n\nstd::vector> sortedExpected;\nfor (const auto& vec : expected) {\n std::vector sortedVec = vec;\n std::sort(sortedVec.begin(), sortedVec.end());\n sortedExpected.push_back(sortedVec);\n}\nstd::sort(sortedExpected.begin(), sortedExpected.end());\n\nreturn sortedResult == sortedExpected;" + "cpp": "if (!result.isArray() ||!expected.isArray()) {\n return false; // Both must be arrays\n }\n\n if (result.size()!= expected.size()) {\n return false;\n }\n\n std::vector> resultVec;\n std::vector> expectedVec;\n\n for (const auto& val: result) {\n if (!val.isArray()) return false;\n std::vector innerVec;\n for (const auto& innerVal: val) {\n if (!innerVal.isInt()) return false;\n innerVec.push_back(innerVal.asInt());\n }\n std::sort(innerVec.begin(), innerVec.end()); // Sort inner vectors\n resultVec.push_back(innerVec);\n }\n\n for (const auto& val: expected) {\n if (!val.isArray()) return false;\n std::vector innerVec;\n for (const auto& innerVal: val) {\n if (!innerVal.isInt()) return false;\n innerVec.push_back(innerVal.asInt());\n }\n std::sort(innerVec.begin(), innerVec.end()); // Sort inner vectors\n expectedVec.push_back(innerVec);\n }\n\n // Sort the outer vectors (important for comparing sets of combinations)\n std::sort(resultVec.begin(), resultVec.end());\n std::sort(expectedVec.begin(), expectedVec.end());\n\n return resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=FOyRpNUSFeA&pp=ygUbTmVldENvZGUgQ29tYmluYXRpb24gU3VtIElJ", "method_name": "combinationSum2" @@ -2672,7 +2672,7 @@ "compare_func": { "python": "return str(sorted(result)) == str(eval(expected))", "java": "int[][] resultArray = (int[][]) result;\nint[][] expectedArray = (int[][]) expected;\n\n// Sort both arrays of intervals\nArrays.sort(resultArray, (a, b) -> Integer.compare(a[0], b[0]));\nArrays.sort(expectedArray, (a, b) -> Integer.compare(a[0], b[0]));\n\n// Compare the sorted arrays\nreturn Arrays.deepEquals(resultArray, expectedArray);", - "cpp": "// Convert expected to a vector of vectors of ints\nstd::vector> expectedVec;\nfor (const auto& interval : expected) {\n std::vector temp;\n for (const auto& num : interval) {\n temp.push_back(num.asInt());\n }\n expectedVec.push_back(temp);\n}\n\n// Sort both result and expected vectors\nstd::sort(result.begin(), result.end());\nstd::sort(expectedVec.begin(), expectedVec.end());\n\n// Compare the sorted vectors\nreturn result == expectedVec;" + "cpp": "if (!result.isArray() ||!expected.isArray() || result.size()!= expected.size()) {\n return false;\n }\n\n std::vector> resultVec;\n std::vector> expectedVec;\n\n for (const auto& val: result) {\n if (!val.isArray() || val.size()!= 2) return false;\n std::vector innerVec;\n for (const auto& innerVal: val) {\n if (!innerVal.isInt()) return false;\n innerVec.push_back(innerVal.asInt());\n }\n resultVec.push_back(innerVec);\n }\n\n for (const auto& val: expected) {\n if (!val.isArray() || val.size()!= 2) return false;\n std::vector innerVec;\n for (const auto& innerVal: val) {\n if (!innerVal.isInt()) return false;\n innerVec.push_back(innerVal.asInt());\n }\n expectedVec.push_back(innerVec);\n }\n\n return resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=44H3cEC2fFM&pp=ygUYTmVldENvZGUgTWVyZ2UgSW50ZXJ2YWxz", "method_name": "merge" @@ -2722,7 +2722,7 @@ "compare_func": { "python": "return str(sorted(result)) == str(eval(expected))", "java": "if (result == null && expected == null) {\n return true;\n }\n if (result == null || expected == null) {\n return false;\n }\n\n if (result instanceof int[][] && expected instanceof int[][]) {\n int[][] arr1 = (int[][]) result;\n int[][] arr2 = (int[][]) expected;\n\n if (arr1.length != arr2.length) {\n return false;\n }\n\n for (int i = 0; i < arr1.length; i++) {\n if (!Arrays.equals(arr1[i], arr2[i])) { // Correct comparison for int[]\n return false;\n }\n }\n return true;\n }\n return result.equals(expected);", - "cpp": "// Convert result and expected to vectors of vectors of integers\nstd::vector> resultVec = jsonToValue>>(result);\nstd::vector> expectedVec = jsonToValue>>(expected);\n\n// Sort both vectors by the first element of each interval\nstd::sort(resultVec.begin(), resultVec.end(), [](const std::vector& a, const std::vector& b) {\n return a[0] < b[0];\n});\nstd::sort(expectedVec.begin(), expectedVec.end(), [](const std::vector& a, const std::vector& b) {\n return a[0] < b[0];\n});\n\n// Compare the sorted vectors\nreturn resultVec == expectedVec;" + "cpp": "if (!result.isArray() ||!expected.isArray() || result.size()!= expected.size()) {\n return false;\n }\n\n std::vector> resultVec;\n std::vector> expectedVec;\n\n for (const auto& val: result) {\n if (!val.isArray() || val.size()!= 2) return false;\n std::vector innerVec;\n for (const auto& innerVal: val) {\n if (!innerVal.isInt()) return false;\n innerVec.push_back(innerVal.asInt());\n }\n resultVec.push_back(innerVec);\n }\n\n for (const auto& val: expected) {\n if (!val.isArray() || val.size()!= 2) return false;\n std::vector innerVec;\n for (const auto& innerVal: val) {\n if (!innerVal.isInt()) return false;\n innerVec.push_back(innerVal.asInt());\n }\n expectedVec.push_back(innerVec);\n }\n\n return resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=A8NUOmlwOlM&pp=ygUYTmVldENvZGUgSW5zZXJ0IEludGVydmFs", "method_name": "insert" @@ -3036,7 +3036,7 @@ "compare_func": { "python": "return sorted([sorted(x) for x in result]) == sorted(eval(expected))", "java": "if ((result instanceof Integer) && (expected instanceof String)) {\n Integer intResult = (Integer) result;\n String strExpected = (String) expected;\n return intResult.toString().equals(strExpected);\n } else if ((result instanceof String) && (expected instanceof Integer)) {\n return compare(expected, result);\n } else if (result instanceof Integer && expected instanceof Integer) {\n return result.equals(expected);\n }\n\n List resultList = (List) result;\n List expectedList = (List) expected;\n\n if (resultList.size()!= expectedList.size()) {\n return false;\n }\n\n for (int i = 0; i < resultList.size(); i++) {\n Object resultItem = resultList.get(i);\n Object expectedItem = expectedList.get(i);\n\n if (!compare(resultItem, expectedItem)) {\n return false;\n }\n }\n\n return true;", - "cpp": "bool compareFunction(const std::vector>& result, const std::vector>& expected) {\n auto sort_inner_vectors = [](std::vector& vec) {\n std::sort(vec.begin(), vec.end());\n };\n\n // Sort inner vectors of result\n std::vector> sorted_result = result;\n std::for_each(sorted_result.begin(), sorted_result.end(), sort_inner_vectors);\n std::sort(sorted_result.begin(), sorted_result.end());\n\n // Sort inner vectors of expected\n std::vector> sorted_expected = expected;\n std::for_each(sorted_expected.begin(), sorted_expected.end(), sort_inner_vectors);\n std::sort(sorted_expected.begin(), sorted_expected.end());\n\n return sorted_result == sorted_expected;\n}" + "cpp": "if (!result.isArray() ||!expected.isArray() || result.size()!= expected.size()) {\n return false; \n }\n\n std::vector> resultVec;\n std::vector> expectedVec;\n\n for (const auto& val: result) {\n if (!val.isArray()) return false;\n std::vector innerVec;\n for (const auto& innerVal: val) {\n if (!innerVal.isInt()) return false;\n innerVec.push_back(innerVal.asInt());\n }\n std::sort(innerVec.begin(), innerVec.end()); // Sort inner vectors\n resultVec.push_back(innerVec);\n }\n\n for (const auto& val: expected) {\n if (!val.isArray()) return false;\n std::vector innerVec;\n for (const auto& innerVal: val) {\n if (!innerVal.isInt()) return false;\n innerVec.push_back(innerVal.asInt());\n }\n std::sort(innerVec.begin(), innerVec.end()); // Sort inner vectors\n expectedVec.push_back(innerVec);\n }\n\n std::sort(resultVec.begin(), resultVec.end()); // Sort outer vectors\n std::sort(expectedVec.begin(), expectedVec.end());\n\n return resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=Vn2v6ajA7U0&pp=ygUTTmVldENvZGUgU3Vic2V0cyBJSQ%3D%3D", "method_name": "subsetsWithDup" @@ -3088,7 +3088,7 @@ "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", "java": "if (result == null && expected == null) {\n return true;\n }\n if (result == null || expected == null) {\n return false;\n }\n\n // Handle List comparison\n if (result instanceof List && expected instanceof List) {\n List resultList = (List) result;\n List expectedList = (List) expected;\n\n if (resultList.size() != expectedList.size()) {\n return false;\n }\n\n // Create sorted copies of both lists for comparison\n List sortedResult = new ArrayList<>();\n List sortedExpected = new ArrayList<>();\n\n for (Object item : resultList) {\n sortedResult.add(item.toString());\n }\n for (Object item : expectedList) {\n sortedExpected.add(item.toString());\n }\n\n Collections.sort(sortedResult);\n Collections.sort(sortedExpected);\n\n return sortedResult.equals(sortedExpected);\n }\n return result.equals(expected);", - "cpp": "std::vector expectedVec = jsonToValue>(expected);\nstd::sort(result.begin(), result.end());\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn result == expectedVec;" + "cpp": "if (!result.isArray() ||!expected.isArray() || result.size()!= expected.size()) {\n return false;\n }\n\n std::vector resultVec;\n std::vector expectedVec;\n\n for (const auto& val: result) {\n if (!val.isString()) return false;\n resultVec.push_back(val.asString());\n }\n\n for (const auto& val: expected) {\n if (!val.isString()) return false;\n expectedVec.push_back(val.asString());\n }\n\n std::sort(resultVec.begin(), resultVec.end()); // Sort the result vector\n std::sort(expectedVec.begin(), expectedVec.end()); // Sort the expected vector\n\n return resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=61tN4YEdiTM&pp=ygUdTmVldENvZGUgUmVzdG9yZSBJUCBBZGRyZXNzZXM%3D", "method_name": "restoreIpAddresses" @@ -3498,7 +3498,7 @@ "compare_func": { "python": "return int(result) == int(expected)", "java": "return result.equals(expected);", - "cpp": "return static_cast(result) == std::stoi(expected.asString());" + "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=nIVW4P8b1VA&pp=ygUtTmVldENvZGUgRmluZCBNaW5pbXVtIGluIFJvdGF0ZWQgU29ydGVkIEFycmF5", "method_name": "findMin" @@ -4374,7 +4374,7 @@ "compare_func": { "python": "return str(result) == expected", "java": "return ((Integer) result).toString().equals(expected);", - "cpp": "return std::to_string(result.asInt()) == expected.asString();" + "cpp": "return result.asInt() == expected.asInt();" }, "explanation": "https://www.youtube.com/watch?v=NshLjAWa03c&pp=ygUrTmVldENvZGUgQmVzdCBUaW1lIHRvIEJ1eSBhbmQgU2VsbCBTdG9jayBJVg%3D%3D", "method_name": "maxProfit" @@ -4424,7 +4424,7 @@ "compare_func": { "python": "return result == eval(expected)", "java": "if (result == null && expected == null) return true;\n if (result == null || expected == null) return false;\n \n if (result instanceof List && expected instanceof List) {\n List resList = (List) result;\n List expList = (List) expected;\n if (resList.size() != expList.size()) return false;\n for (int i = 0; i < resList.size(); i++) {\n if (!compare(resList.get(i), expList.get(i))) return false;\n }\n return true;\n } else if (expected instanceof Unknown) {\n try {\n Object parsed = parseValue(((Unknown) expected).get(), result.getClass());\n return compare(result, parsed);\n } catch (Exception e) {\n return false;\n }\n }\n return result.equals(expected);", - "cpp": "if (result.isArray() && expected.isString()) {\n // Parse the expected string as a JSON array\n Json::Value expectedJson;\n Json::CharReaderBuilder builder;\n std::string errors;\n std::unique_ptr reader(builder.newCharReader());\n if (!reader->parse(expected.asCString(), expected.asCString() + expected.asString().length(), &expectedJson, &errors)) {\n throw std::runtime_error(\"Failed to parse expected JSON: \" + errors);\n }\n \n // Sort both result and expectedJson\n auto sortJsonArray = [](Json::Value& array) {\n std::sort(array.begin(), array.end(), [](const Json::Value& a, const Json::Value& b) {\n if (a[0] != b[0]) return a[0].asInt() < b[0].asInt();\n return a[1].asInt() < b[1].asInt();\n });\n };\n \n sortJsonArray(result);\n sortJsonArray(expectedJson);\n \n // Compare the sorted arrays\n return result == expectedJson;\n} else {\n return result == expected;\n}" + "cpp": "if (!result.isArray() || !expected.isArray() || result.size() != expected.size()) {\n return false;\n }\n\n for (Json::Value::const_iterator it_result = result.begin(), it_expected = expected.begin();\n it_result != result.end() && it_expected != expected.end();\n ++it_result, ++it_expected) {\n const Json::Value& result_element = *it_result;\n const Json::Value& expected_element = *it_expected;\n\n if (!result_element.isArray() || !expected_element.isArray() || result_element.size() != expected_element.size()) {\n return false;\n }\n\n for (Json::Value::const_iterator inner_it_result = result_element.begin(), inner_it_expected = expected_element.begin();\n inner_it_result != result_element.end() && inner_it_expected != expected_element.end();\n ++inner_it_result, ++inner_it_expected) {\n if (*inner_it_result != *inner_it_expected) {\n return false;\n }\n }\n }\n return true;" }, "explanation": "https://www.youtube.com/watch?v=XhzHXj7wrwo&pp=ygUcTmVldENvZGUgVGhlIFNreWxpbmUgUHJvYmxlbQ%3D%3D", "method_name": "getSkyline" @@ -4578,7 +4578,7 @@ "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", "java": "List resultList = (List) result;\nList expectedList = (List) expected;\nCollections.sort(resultList);\nCollections.sort(expectedList);\nreturn resultList.equals(expectedList);", - "cpp": "std::vector sorted_result = result.as>();\nstd::vector sorted_expected = expected.as>();\n\nstd::sort(sorted_result.begin(), sorted_result.end());\nstd::sort(sorted_expected.begin(), sorted_expected.end());\n\nreturn sorted_result == sorted_expected;" + "cpp": "if (!result.isArray() ||!expected.isArray() || result.size()!= expected.size()) {\n return false;\n }\n\n std::vector resultVec;\n std::vector expectedVec;\n\n for (const auto& val: result) {\n if (!val.isString()) return false;\n resultVec.push_back(val.asString());\n }\n\n for (const auto& val: expected) {\n if (!val.isString()) return false;\n expectedVec.push_back(val.asString());\n }\n\n std::sort(resultVec.begin(), resultVec.end()); // Sort the result vector\n std::sort(expectedVec.begin(), expectedVec.end()); // Sort the expected vector\n\n return resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=tunRDBsP7OQ&pp=ygUhTmVldENvZGUgRXhwcmVzc2lvbiBBZGQgT3BlcmF0b3Jz", "method_name": "addOperators" @@ -4630,7 +4630,7 @@ "compare_func": { "python": "return sorted(result) == sorted(eval(expected))", "java": "List resultList = (List) result;\nList expectedList = (List) expected;\nCollections.sort(resultList);\nCollections.sort(expectedList);\nreturn resultList.equals(expectedList);", - "cpp": "std::sort(result.begin(), result.end());\nstd::vector expectedVec;\nstd::istringstream iss(expected.asString().substr(1, expected.asString().size() - 2));\nstd::string token;\nwhile (std::getline(iss, token, ',')) {\n token.erase(remove(token.begin(), token.end(), '\\''), token.end());\n expectedVec.push_back(token);\n}\nstd::sort(expectedVec.begin(), expectedVec.end());\nreturn result == expectedVec;" + "cpp": "if (!result.isArray() ||!expected.isArray() || result.size()!= expected.size()) {\n return false;\n }\n\n std::vector resultVec;\n std::vector expectedVec;\n\n for (const auto& val: result) {\n if (!val.isString()) return false;\n resultVec.push_back(val.asString());\n }\n\n for (const auto& val: expected) {\n if (!val.isString()) return false;\n expectedVec.push_back(val.asString());\n }\n\n std::sort(resultVec.begin(), resultVec.end()); // Sort the result vector\n std::sort(expectedVec.begin(), expectedVec.end()); // Sort the expected vector\n\n return resultVec == expectedVec;" }, "explanation": "https://www.youtube.com/watch?v=mgQ4O9iUEbg&pp=ygUjTmVldENvZGUgUmVtb3ZlIEludmFsaWQgUGFyZW50aGVzZXM%3D", "method_name": "removeInvalidParentheses" diff --git a/app/services/execution/docker.py b/app/services/execution/docker.py index b2df6be..c2a969e 100644 --- a/app/services/execution/docker.py +++ b/app/services/execution/docker.py @@ -31,6 +31,9 @@ def __init__(self, client: docker.DockerClient): "medium": [medium_mem, medium_time], "hard": [hard_mem, hard_time], } + self.last_logs = "" + self.last_stderr = "" + self.last_status_code = 0 def get_run_commands(self, lang: str, file_path: str) -> list: """ @@ -98,7 +101,9 @@ def run_container(self, lang: str, file_path: str, difficulty: str) -> Execution try: # Wait for the container to finish and get the logs result = container.wait(timeout=time_limit / 1000) - logs = container.logs().decode('utf-8') + self.last_logs = container.logs().decode('utf-8') + self.last_stderr = container.logs(stdout=False, stderr=True).decode('utf-8') + self.last_status_code = result["StatusCode"] # Check if the container stopped unexpectedly if result["StatusCode"] != 0: @@ -109,29 +114,36 @@ def run_container(self, lang: str, file_path: str, difficulty: str) -> Execution ) return ExecutionResult( success=False, - message="Runtime Error Detected\n" + logs.strip(), + message="Runtime Error Detected\n" + self.last_logs.strip(), ) - - # When successful, the test runner returns 'EXECUTION_RESULTS:' in its - # output, followed by a JSON object with the test results and execution time. - if "EXECUTION_RESULTS:" in logs: - execution_data = json.loads( - logs.split("EXECUTION_RESULTS:")[1].strip() + + if self.last_stderr.strip(): + return ExecutionResult( + success=False, + message="Runtime Error Detected\n" + self.last_stderr.strip(), ) + base_name = os.path.basename(file_path).split('.')[0] + results_file = os.path.join(dir_path, f"{base_name}-results.txt") + + if os.path.exists(results_file): + with open(results_file, 'r') as f: + execution_data = json.load(f) + os.remove(results_file) return ExecutionResult( success=True, test_results=execution_data["hidden_results"]["test_results"], sample_results=execution_data["sample_results"]["test_results"], ) - - # If the success string is not found, means an exception occurred - return ExecutionResult( - success=False, - message="Test Runner Error Detected\n" + logs.strip(), - ) + else: + return ExecutionResult( + success=False, + message="Test Runner Error: Results file not found\n" + self.last_logs.strip(), + ) except Exception as e: # Check for timeout, else raise the exception + self.last_logs = container.logs().decode('utf-8') + self.last_stderr = container.logs(stdout=False, stderr=True).decode('utf-8') if "timed out" in str(e): return ExecutionResult( success=False, @@ -153,3 +165,15 @@ def run_container(self, lang: str, file_path: str, difficulty: str) -> Execution success=False, message=f"Execution Error", ) + + def get_last_logs(self) -> str: + """Returns combined stdout/stderr logs from last container run""" + return self.last_logs + + def get_last_errors(self) -> str: + """Returns stderr logs from last container run""" + return self.last_stderr + + def get_last_status(self) -> int: + """Returns exit status code from last container run""" + return self.last_status_code diff --git a/app/services/execution/templates.py b/app/services/execution/templates.py index 796ffa0..fc63852 100644 --- a/app/services/execution/templates.py +++ b/app/services/execution/templates.py @@ -73,21 +73,19 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): }} if __name__ == "__main__": - test_data = {test_data} method_name = {method_name!r} + test_data = {test_data} sample_data = {sample_data} - try: - solution = Solution() - hidden_results = run_tests(solution, method_name, test_data, is_sample=False) - sample_results = run_tests(solution, method_name, sample_data, is_sample=True) - results = {{ - "hidden_results": hidden_results, - "sample_results": sample_results - }} - print("EXECUTION_RESULTS:", json.dumps(results)) - except Exception as e: - print("GLOBAL_ERROR:\\n" + traceback.format_exc()) + solution = Solution() + hidden_results = run_tests(solution, method_name, test_data, is_sample=False) + sample_results = run_tests(solution, method_name, sample_data, is_sample=True) + results = {{ + "hidden_results": hidden_results, + "sample_results": sample_results + }} + with open("{file_name}-results.txt", "w") as f: + f.write(json.dumps(results)) """ JAVA_TEMPLATE = r""" @@ -429,28 +427,36 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): results.add("hidden_results", createResultObject(runTests(solution, testData))); results.add("sample_results", createResultObject(runTests(solution, sampleData))); - System.out.println("EXECUTION_RESULTS:" + results); + java.io.FileWriter file = new java.io.FileWriter("{file_name}-results.txt"); + file.write(results.toString()); + file.close(); }} catch (Exception e) {{ Throwable cause = e; if (e instanceof InvocationTargetException && e.getCause() != null) {{ cause = e.getCause(); }} - System.out.println("GLOBAL_ERROR:\n" + cause.toString()); + throw new RuntimeException(cause); }} }} }} """ -CPP_TEMPLATE = r"""#include +CPP_TEMPLATE = r"""#include +#include #include #include #include #include #include #include +#include #include +using namespace std; + +{code} + template struct function_traits; template struct always_false : std::false_type {{}}; template struct is_vector : std::false_type {{}}; @@ -459,22 +465,16 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): template struct function_traits {{ using return_type = R; - using args_tuple = std::tuple< - typename std::remove_reference::type... - >; + using args_tuple = std::tuple::type...>; static constexpr size_t arg_count = sizeof...(Args); }}; template using tuple_element_t = typename std::tuple_element::type; template struct arg_type {{ - using type = tuple_element_t::args_tuple>; + using type = std::tuple_element_t::args_tuple>; }}; -using namespace std; - -{code} - template T jsonToValue(const Json::Value &val) {{ // Handle nested vectors recursively if constexpr (is_vector::value) {{ @@ -485,6 +485,19 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): }} return result; }} + // Handle chars specifically + else if constexpr (std::is_same_v) {{ + if (val.isString()) {{ + std::string str_val = val.asString(); + if (!str_val.empty()) {{ + return str_val[0]; + }} else {{ + throw std::runtime_error("JSON string for char is empty"); + }} + }} else {{ + throw std::runtime_error("JSON value for char is not a string"); + }} + }} // Handle arithmetic types (int, float, double) else if constexpr (std::is_arithmetic_v) {{ if (val.isNumeric()) {{ @@ -549,8 +562,12 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): if (reader->parse(value_str.c_str(), value_str.c_str() + value_str.length(), &json_val, &errors)) {{ args.push_back({{json_val}}); }} else {{ - // If not valid JSON, treat as string - args.push_back({{Json::Value(value_str)}}); + // If not valid JSON, treat as string (highly likely with single quotes) + if (value_str.front() == '\'' && value_str.back() == '\'') {{ + args.push_back({{Json::Value(value_str.substr(1, value_str.length() - 2))}}); + }} else {{ + args.push_back({{Json::Value(value_str)}}); + }} }} }} delete reader; @@ -637,7 +654,9 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): results["hidden_results"] = formatResults(runTests(solution, test_data)); results["sample_results"] = formatResults(runTests(solution, sample_data)); - cout << "EXECUTION_RESULTS:" << results.toStyledString(); + ofstream output_file("{file_name}-results.txt"); + output_file << results.toStyledString() << endl; + output_file.close(); return 0; }} """ diff --git a/app/services/execution/test_generator.py b/app/services/execution/test_generator.py index 3445be0..5b241c6 100644 --- a/app/services/execution/test_generator.py +++ b/app/services/execution/test_generator.py @@ -2,6 +2,7 @@ from typing import Dict, List from abc import ABC, abstractmethod from services.execution.templates import PYTHON_TEMPLATE, JAVA_TEMPLATE, CPP_TEMPLATE +import re class TestGenerator(ABC): @@ -32,11 +33,15 @@ def generate_test_file( def get_file_extension(self, lang: str) -> str: """ Get the file extension for the given language. + + :param lang: The language. """ def process_quotes(self, json_str: str) -> str: """ Process quotes in a JSON string. + + :param json_str: The JSON string. """ return json_str.replace('"', '\\"').replace( '\\\\"', '\\\\\\"' @@ -55,6 +60,7 @@ def generate_test_file( ) -> str: return PYTHON_TEMPLATE.format( code=code, + file_name=file_name, method_name=method_name, compare_func=compare_func, test_data=json.dumps(test_data), @@ -99,9 +105,13 @@ def generate_test_file( def get_file_extension(self, lang: str) -> str: return ".java" - # Apparently string variables can only be 65k characters max in java def data_chunks(self, data: str) -> str: - """Converts the data to a string of concatenated JSON strings.""" + """ + Converts the data to a string of concatenated JSON strings. + Since C++ code can only handle 65k characters max in a string variable. + + :param data: The test data string to process. + """ MAX_LENGTH = 1000 json_strings = [] cur = 0 @@ -112,9 +122,10 @@ def data_chunks(self, data: str) -> str: next_chunk = data[cur:] json_strings.append(next_chunk) cur += MAX_LENGTH - chunks = ''.join(['.append("' + s + '")' for s in json_strings]) + chunks = "".join(['.append("' + s + '")' for s in json_strings]) return f"new StringBuilder(){chunks}.toString()" + class CppTestGenerator(TestGenerator): def generate_test_file( self, @@ -126,6 +137,8 @@ def generate_test_file( compare_func: str, ) -> str: args_init, args_param = self.process_args(test_data[0]["input"]) + test_data = self.process_test_data(test_data) + sample_data = self.process_test_data(sample_data) return CPP_TEMPLATE.format( code=code, file_name=file_name, @@ -138,10 +151,25 @@ def generate_test_file( ) def process_args(self, args: str) -> (str, str): - args_list = args.split() + """ + Process the args string and return the initialization lines and parameters. + + Example: + + `args = "--arg1=? --arg2=?"` + + Output: + ```cpp + auto arg1 = args[0].get::type>(); + auto arg2 = args[1].get::type>(); + ``` + + :param args: The args string. + """ init_lines = [] params = [] - for i in range(len(args_list)): + matches = list(re.finditer(r"--arg(\d+)=", args)) + for i in range(len(matches)): var_name = f"arg{i+1}" line = f"auto {var_name} = args[{i}].get::type>();" init_lines.append(line) @@ -151,5 +179,24 @@ def process_args(self, args: str) -> (str, str): args_param = ", ".join(params) return args_init, args_param + def process_test_data(self, test_data: List[Dict]) -> List[Dict]: + """ + Reformat the test data to be a valid JSON (No single quotes) + + :param test_data: The test data to process. + """ + processed_data = [] + for data in test_data: + if ( + "expected" in data + and isinstance(data["expected"], str) + and ( + data["expected"].startswith("[") or data["expected"].startswith("'") + ) + ): + data["expected"] = json.dumps(eval(data["expected"])) # bad code alert + processed_data.append(data) + return processed_data + def get_file_extension(self, lang: str) -> str: return ".cpp" diff --git a/app/tests/unit/code_execution_test.py b/app/tests/unit/code_execution_test.py index 9ce9be5..1adf9cf 100644 --- a/app/tests/unit/code_execution_test.py +++ b/app/tests/unit/code_execution_test.py @@ -259,7 +259,7 @@ def invalid_syntax_solution(self): return """ class Solution { public int add(int a, int b) { - return a + b + a + b } } """ diff --git a/app/tests/unit/code_validation_test.py b/app/tests/unit/test_generation_test.py similarity index 98% rename from app/tests/unit/code_validation_test.py rename to app/tests/unit/test_generation_test.py index 2f87989..4334549 100644 --- a/app/tests/unit/code_validation_test.py +++ b/app/tests/unit/test_generation_test.py @@ -30,7 +30,7 @@ async def generate_code(self, title: str, description: str, boilerplate: str) -> return CodeGenerationResponse() try: completion = await self.client.beta.chat.completions.parse( - model="gpt-4o", + model="gpt-4o-mini", messages=[ {"role": "system", "content": "You are a code generation assistant. Generate correct solutions in python, java, and c++."}, {"role": "user", "content": f"Title: {title}\nProblem description:\n{description}\nBoilerplates:\n{boilerplate.python}\n{boilerplate.java}\n{boilerplate.cpp}\nReturn only JSON with python, java, and cpp fields."} @@ -65,7 +65,6 @@ async def test_code_validation_all_problems(db: Session): executor = CodeExecutionService() problems = db.query(Problem).all() print(f"Validating {len(problems)} problems") - # import pdb; pdb.set_trace() for problem in problems: print(f"Validating problem: {problem.title}") code_res = await code_generator.generate_code(problem.title, problem.description, problem.boilerplate) From 9c2610552b455dac0b17a825c655ef6a7e7b014c Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Thu, 13 Feb 2025 12:50:57 -0500 Subject: [PATCH 17/24] Add black formatting --- .githooks/pre-push | 10 ++++++++++ requirements.txt | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .githooks/pre-push diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100644 index 0000000..a9712a1 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,10 @@ +#!/bin/sh + +# Run black to format all Python code +black . + +# Amend the commit message +git commit --amend -m "chore: format code" -u + +# Push the changes +git push \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e2920e8..de19cee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,4 +12,5 @@ SQLAlchemy==2.0.36 openai==1.58.1 google-auth-oauthlib==1.2.1 google-api-python-client==2.158.0 -pytest_asyncio==0.25.3 \ No newline at end of file +pytest_asyncio==0.25.3 +black==25.1.0 \ No newline at end of file From 4dadde7ab96df4de462f48b744dd393984c7f674 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Thu, 13 Feb 2025 12:54:04 -0500 Subject: [PATCH 18/24] chore: format code --- app/api/endpoints/game.py | 219 ++++--- app/api/endpoints/room.py | 158 ++--- app/api/endpoints/users.py | 176 +++--- app/core/config.py | 131 +++-- app/core/security/jwt.py | 51 +- app/core/security/password.py | 8 +- app/db/init.py | 58 +- app/db/models/problem.py | 28 +- app/db/models/user.py | 14 +- app/db/session.py | 6 +- app/schemas/game.py | 6 +- app/schemas/user.py | 25 +- app/services/email/service.py | 32 +- app/services/email/templates.py | 1 + app/services/execution/docker.py | 53 +- app/services/execution/runtime_analysis.py | 16 +- app/services/execution/service.py | 25 +- app/services/execution/types.py | 17 +- app/services/game/ability.py | 107 ++-- app/services/game/manager.py | 161 +++-- app/services/game/matchmaker.py | 22 +- app/services/game/ranked.py | 19 +- app/services/game/state.py | 7 +- app/services/problem/service.py | 24 +- app/services/room/service.py | 55 +- app/services/room/state.py | 26 +- app/tests/integration/auth_test.py | 22 +- app/tests/integration/functions.py | 91 +-- app/tests/integration/game_test.py | 647 ++++++++++++++------- app/tests/integration/room_test.py | 184 ++++-- app/tests/unit/code_execution_test.py | 177 +++--- app/tests/unit/problem_test.py | 1 + app/tests/unit/test_generation_test.py | 43 +- 33 files changed, 1490 insertions(+), 1120 deletions(-) diff --git a/app/api/endpoints/game.py b/app/api/endpoints/game.py index 6fe446c..d06b814 100644 --- a/app/api/endpoints/game.py +++ b/app/api/endpoints/game.py @@ -24,7 +24,7 @@ async def queue_websocket( websocket: WebSocket, current_user: User = Depends(get_current_user_ws), - db: Session = Depends(get_db) + db: Session = Depends(get_db), ): """ WebSocket endpoint for the unranked matchmaking queue @@ -64,34 +64,24 @@ async def queue_websocket( # Create game and notify players game_state = await game_manager.create_game( - player1, - player2, - problems, - "unranked", - db + player1, player2, problems, "unranked", db ) match_data = { "match_id": game_state.id, "opponent": { "username": player2.username, - "display_name": player2.display_name - } + "display_name": player2.display_name, + }, } - await ws1.send_json({ - "type": "match_found", - "data": match_data - }) + await ws1.send_json({"type": "match_found", "data": match_data}) match_data["opponent"] = { "username": player1.username, - "display_name": player1.display_name + "display_name": player1.display_name, } - await ws2.send_json({ - "type": "match_found", - "data": match_data - }) + await ws2.send_json({"type": "match_found", "data": match_data}) break @@ -110,7 +100,7 @@ async def queue_websocket( async def ranked_queue_websocket( websocket: WebSocket, current_user: User = Depends(get_current_user_ws), - db: Session = Depends(get_db) + db: Session = Depends(get_db), ): """ WebSocket endpoint for the ranked matchmaking queue @@ -144,8 +134,7 @@ async def ranked_queue_websocket( # Get problems based on average rating avg_rating = (player1.rating + player2.rating) / 2 distribution = matchmaker.get_problem_distribution( - ranked=True, - rating=avg_rating + ranked=True, rating=avg_rating ) problems = await ProblemManager.get_problems_by_distribution( @@ -154,35 +143,25 @@ async def ranked_queue_websocket( # Create game and notify players game_state = await game_manager.create_game( - player1, - player2, - problems, - "ranked", - db + player1, player2, problems, "ranked", db ) match_data = { "match_id": game_state.id, "opponent": { "username": player2.username, - "display_name": player2.display_name - } + "display_name": player2.display_name, + }, } - await ws1.send_json({ - "type": "match_found", - "data": match_data - }) + await ws1.send_json({"type": "match_found", "data": match_data}) match_data["opponent"] = { "username": player1.username, - "display_name": player1.display_name + "display_name": player1.display_name, } - await ws2.send_json({ - "type": "match_found", - "data": match_data - }) + await ws2.send_json({"type": "match_found", "data": match_data}) break @@ -201,7 +180,7 @@ async def game_websocket( websocket: WebSocket, game_id: str, current_user: User = Depends(get_current_user_ws), - db: Session = Depends(get_db) + db: Session = Depends(get_db), ): """ WebSocket endpoint for the game @@ -215,7 +194,9 @@ async def game_websocket( # Check if the game exists and is not finished if not game_state or game_state.status == GameStatus.FINISHED: - return await websocket.close(code=4000, reason="Game not found or already finished") + return await websocket.close( + code=4000, reason="Game not found or already finished" + ) # Check if the user is a player in the game if current_user.id not in [game_state.player1.user_id, game_state.player2.user_id]: @@ -238,39 +219,30 @@ async def game_websocket( try: game_view = game_manager.create_game_view(game_state, current_user.id) - await websocket.send_json({ - "type": "game_state", - "data": game_view.model_dump() - }) + await websocket.send_json( + {"type": "game_state", "data": game_view.model_dump()} + ) # Send the current problem if the game is in progress - if game_state.status == GameStatus.IN_PROGRESS and player.current_problem_index < len(game_state.problems): + if ( + game_state.status == GameStatus.IN_PROGRESS + and player.current_problem_index < len(game_state.problems) + ): current_problem = ProblemManager.prepare_problem_for_client( game_state.problems[player.current_problem_index] ) - await websocket.send_json({ - "type": "problem", - "data": current_problem - }) + await websocket.send_json({"type": "problem", "data": current_problem}) # Start the game if both players are connected and the game is waiting opponent = game_state.get_opponent_state(current_user.id) - if (opponent and opponent.ws and game_state.status == GameStatus.WAITING): + if opponent and opponent.ws and game_state.status == GameStatus.WAITING: game_state.status = GameStatus.IN_PROGRESS - problem = ProblemManager.prepare_problem_for_client( - game_state.problems[0] - ) + problem = ProblemManager.prepare_problem_for_client(game_state.problems[0]) - await game_state.broadcast_event(GameEvent( - type="game_start", - data={} - )) + await game_state.broadcast_event(GameEvent(type="game_start", data={})) - await game_state.broadcast_event(GameEvent( - type="problem", - data=problem - )) + await game_state.broadcast_event(GameEvent(type="problem", data=problem)) while True: try: @@ -282,33 +254,30 @@ async def game_websocket( # Handle chat messages if data["type"] == "chat": - await game_state.broadcast_event(GameEvent( - type="chat", - data={ - "sender": current_user.username, - "message": data["data"]["message"], - "timestamp": time.time() - } - )) + await game_state.broadcast_event( + GameEvent( + type="chat", + data={ + "sender": current_user.username, + "message": data["data"]["message"], + "timestamp": time.time(), + }, + ) + ) elif data["type"] == "ability": error = await ability_manager.handle_ability_message( - game_state, - game_manager, - current_user.id, - data["data"] + game_state, game_manager, current_user.id, data["data"] ) if error: - await websocket.send_json({ - "type": "error", - "data": {"message": error} - }) + await websocket.send_json( + {"type": "error", "data": {"message": error}} + ) elif data["type"] == "query": - await websocket.send_json({ - "type": "game_state", - "data": game_view.model_dump() - }) + await websocket.send_json( + {"type": "game_state", "data": game_view.model_dump()} + ) # Handle player forfeits elif data["type"] == "forfeit": await game_manager.forfeit_game(game_id, current_user.id) @@ -317,21 +286,28 @@ async def game_websocket( elif data["type"] == "submit": # Check if the player is submitting too fast current_time = time.time() - submission_cooldown = settings.SUBMISSION_COOLDOWN if not settings.TESTING else 2 - if (player.last_submission is not None and current_time - player.last_submission < submission_cooldown): - await player.send_event(GameEvent( - type="error", - data={ - "message": "You're submitting too fast. Please wait before submitting again" - } - )) + submission_cooldown = ( + settings.SUBMISSION_COOLDOWN if not settings.TESTING else 2 + ) + if ( + player.last_submission is not None + and current_time - player.last_submission < submission_cooldown + ): + await player.send_event( + GameEvent( + type="error", + data={ + "message": "You're submitting too fast. Please wait before submitting again" + }, + ) + ) continue player.last_submission = current_time # Execute the player's code on the hidden test cases code = data["data"]["code"] - lang = data["data"]["lang"] # java, cpp, python + lang = data["data"]["lang"] # java, cpp, python problem_index = player.current_problem_index problem = game_state.problems[problem_index] @@ -356,56 +332,67 @@ async def game_websocket( game_id, current_user.id, result["summary"]["passed_tests"], - result["summary"]["total_tests"] + result["summary"]["total_tests"], ) # Send the submission result to the player - await player.send_event(GameEvent( - type="submission_result", - data={**result, **submission_result} - )) + await player.send_event( + GameEvent( + type="submission_result", + data={**result, **submission_result}, + ) + ) # Send the game state to both players - await game_state.player1.send_event(GameEvent( - type="game_state", - data=game_manager.create_game_view(game_state, game_state.player1.user_id).model_dump() - )) + await game_state.player1.send_event( + GameEvent( + type="game_state", + data=game_manager.create_game_view( + game_state, game_state.player1.user_id + ).model_dump(), + ) + ) - await game_state.player2.send_event(GameEvent( - type="game_state", - data=game_manager.create_game_view(game_state, game_state.player2.user_id).model_dump() - )) + await game_state.player2.send_event( + GameEvent( + type="game_state", + data=game_manager.create_game_view( + game_state, game_state.player2.user_id + ).model_dump(), + ) + ) # Send the next problem if the current one was solved - if (submission_result["problem_solved"] and problem_index < len(game_state.problems) - 1): + if ( + submission_result["problem_solved"] + and problem_index < len(game_state.problems) - 1 + ): next_problem = ProblemManager.prepare_problem_for_client( game_state.problems[problem_index + 1] ) - await player.send_event(GameEvent( - type="problem", - data=next_problem - )) + await player.send_event( + GameEvent(type="problem", data=next_problem) + ) # Check if the game has ended and handle it if await game_manager.check_game_end(game_id): await game_manager.handle_game_end(game_state, db) else: # Submission failed, send the result to the player - await player.send_event(GameEvent( - type="submission_result", - data=result - )) + await player.send_event( + GameEvent(type="submission_result", data=result) + ) except asyncio.TimeoutError: continue except Exception as e: try: - await websocket.send_json({ - "type": "error", - "data": { - "message": "An error occurred: " + str(e) + await websocket.send_json( + { + "type": "error", + "data": {"message": "An error occurred: " + str(e)}, } - }) + ) except Exception: raise e @@ -419,7 +406,7 @@ async def game_websocket( @router.get("/current-game", response_model=Optional[GameView]) async def get_current_game( - current_user: User = Depends(get_current_user) + current_user: User = Depends(get_current_user), ) -> Optional[GameView]: """ Check if the user is in a game and return the game state. Used for reconnection. diff --git a/app/api/endpoints/room.py b/app/api/endpoints/room.py index f0c9994..fe10dd3 100644 --- a/app/api/endpoints/room.py +++ b/app/api/endpoints/room.py @@ -6,8 +6,14 @@ from api.endpoints.users import get_current_user, get_current_user_ws from db.models.user import User from db.session import get_db -from fastapi import (APIRouter, Depends, HTTPException, WebSocket, - WebSocketDisconnect, status) +from fastapi import ( + APIRouter, + Depends, + HTTPException, + WebSocket, + WebSocketDisconnect, + status, +) from services.game.manager import game_manager from services.room.service import room_service from services.room.state import RoomSettings, RoomStatus @@ -20,7 +26,7 @@ async def create_room( is_public: bool = True, settings: Optional[RoomSettings] = None, - current_user: User = Depends(get_current_user) + current_user: User = Depends(get_current_user), ): """ Create a new room @@ -35,14 +41,12 @@ async def create_room( for room in room_service.rooms.values(): if room.is_player_in_room(current_user.id): raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, - detail="Already in a room" + status_code=status.HTTP_400_BAD_REQUEST, detail="Already in a room" ) if game_manager.get_player_game(current_user.id): raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, - detail="Already in a game" + status_code=status.HTTP_400_BAD_REQUEST, detail="Already in a game" ) room = room_service.create_room(current_user, is_public, settings) @@ -53,7 +57,7 @@ async def create_room( async def get_room( room_code: str, current_user: User = Depends(get_current_user), - db: Session = Depends(get_db) + db: Session = Depends(get_db), ): """ Get room information @@ -67,8 +71,7 @@ async def get_room( room = room_service.get_room(room_code) if not room: raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="Room not found" + status_code=status.HTTP_404_NOT_FOUND, detail="Room not found" ) users = {} @@ -83,7 +86,7 @@ async def get_room( async def update_room_settings( room_code: str, settings: RoomSettings, - current_user: User = Depends(get_current_user) + current_user: User = Depends(get_current_user), ): """ Update room settings (host only) @@ -97,27 +100,23 @@ async def update_room_settings( room = room_service.get_room(room_code) if not room: raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="Room not found" + status_code=status.HTTP_404_NOT_FOUND, detail="Room not found" ) if room.host_id != current_user.id: raise HTTPException( status_code=status.HTTP_403_FORBIDDEN, - detail="Only the host can update room settings" + detail="Only the host can update room settings", ) if room.status != RoomStatus.WAITING: raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, - detail="Cannot modify room settings while game is in progress" + detail="Cannot modify room settings while game is in progress", ) room.settings = settings - await room.broadcast({ - "type": "settings_updated", - "data": settings.model_dump() - }) + await room.broadcast({"type": "settings_updated", "data": settings.model_dump()}) if room.is_public: asyncio.create_task(room_service.handle_room_update()) @@ -127,8 +126,7 @@ async def update_room_settings( @router.websocket("/lobby") async def room_lobby_websocket( - websocket: WebSocket, - current_user: User = Depends(get_current_user_ws) + websocket: WebSocket, current_user: User = Depends(get_current_user_ws) ): """ WebSocket endpoint for room lobby @@ -155,7 +153,7 @@ async def room_websocket( websocket: WebSocket, room_code: str, current_user: User = Depends(get_current_user_ws), - db: Session = Depends(get_db) + db: Session = Depends(get_db), ): """ WebSocket endpoint for room management @@ -182,7 +180,9 @@ async def room_websocket( # New guest joining the room # Check if user is already in any room (except this one) - if room_service.is_user_in_any_room(current_user.id) and not room.is_player_in_room(current_user.id): + if room_service.is_user_in_any_room( + current_user.id + ) and not room.is_player_in_room(current_user.id): return await websocket.close(code=4005, reason="Already in another room") room.guest_id = current_user.id @@ -197,13 +197,17 @@ async def room_websocket( users = {} users[room.host_id] = db.query(User).filter(User.id == room.host_id).first() if room.guest_id: - users[room.guest_id] = db.query(User).filter(User.id == room.guest_id).first() + users[room.guest_id] = ( + db.query(User).filter(User.id == room.guest_id).first() + ) # Broadcast updated room state to all players - await room.broadcast({ - "type": "room_state", - "data": room_service.create_room_view(room, users).model_dump() - }) + await room.broadcast( + { + "type": "room_state", + "data": room_service.create_room_view(room, users).model_dump(), + } + ) if room.is_public: await room_service.broadcast_room_list() @@ -217,9 +221,9 @@ async def room_websocket( room.host_id: db.query(User).filter(User.id == room.host_id).first() } if room.guest_id: - users[room.guest_id] = db.query(User).filter( - User.id == room.guest_id - ).first() + users[room.guest_id] = ( + db.query(User).filter(User.id == room.guest_id).first() + ) if data["type"] == "toggle_ready": # Toggle ready status @@ -227,39 +231,48 @@ async def room_websocket( room.set_player_ready(current_user.id, not current_ready) # Broadcast updated room state - await room.broadcast({ - "type": "room_state", - "data": room_service.create_room_view(room, users).model_dump() - }) + await room.broadcast( + { + "type": "room_state", + "data": room_service.create_room_view( + room, users + ).model_dump(), + } + ) elif data["type"] == "start_game": if current_user.id != room.host_id: - await websocket.send_json({ - "type": "error", - "data": {"message": "Only the host can start the game"} - }) + await websocket.send_json( + { + "type": "error", + "data": {"message": "Only the host can start the game"}, + } + ) continue if not room.is_full(): - await websocket.send_json({ - "type": "error", - "data": {"message": "Need 2 players to start"} - }) + await websocket.send_json( + { + "type": "error", + "data": {"message": "Need 2 players to start"}, + } + ) continue if not room.are_players_ready(): - await websocket.send_json({ - "type": "error", - "data": {"message": "All players must be ready to start"} - }) + await websocket.send_json( + { + "type": "error", + "data": { + "message": "All players must be ready to start" + }, + } + ) continue # Create game with room settings game_state = await game_manager.create_game_with_settings( - users[room.host_id], - users[room.guest_id], - room.settings, - db + users[room.host_id], users[room.guest_id], room.settings, db ) room.status = RoomStatus.IN_GAME @@ -267,21 +280,22 @@ async def room_websocket( room.reset_ready_status() # Notify players - await room.broadcast({ - "type": "game_started", - "data": {"game_id": game_state.id} - }) + await room.broadcast( + {"type": "game_started", "data": {"game_id": game_state.id}} + ) elif data["type"] == "chat": # Broadcast chat message - await room.broadcast({ - "type": "chat", - "data": { - "sender": current_user.username, - "message": data["data"]["message"], - "timestamp": time.time() + await room.broadcast( + { + "type": "chat", + "data": { + "sender": current_user.username, + "message": data["data"]["message"], + "timestamp": time.time(), + }, } - }) + ) except asyncio.TimeoutError: continue @@ -305,14 +319,20 @@ async def room_websocket( else: # Broadcast updated room state - users = {room.host_id: db.query(User).filter(User.id == room.host_id).first()} + users = { + room.host_id: db.query(User).filter(User.id == room.host_id).first() + } if room.guest_id: - users[room.guest_id] = db.query(User).filter(User.id == room.guest_id).first() - - await room.broadcast({ - "type": "room_state", - "data": room_service.create_room_view(room, users).model_dump() - }) + users[room.guest_id] = ( + db.query(User).filter(User.id == room.guest_id).first() + ) + + await room.broadcast( + { + "type": "room_state", + "data": room_service.create_room_view(room, users).model_dump(), + } + ) if room.is_public: asyncio.create_task(room_service.handle_room_update()) diff --git a/app/api/endpoints/users.py b/app/api/endpoints/users.py index 02bef21..c7e38e3 100644 --- a/app/api/endpoints/users.py +++ b/app/api/endpoints/users.py @@ -10,8 +10,16 @@ from db.session import get_db from fastapi import APIRouter, Depends, HTTPException, WebSocket, Request, status from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm -from schemas.user import (ForgotPassword, PasswordReset, Token, TokenRefresh, - UserCreate, UserCreateWithGoogle, UserResponse, UserUpdate) +from schemas.user import ( + ForgotPassword, + PasswordReset, + Token, + TokenRefresh, + UserCreate, + UserCreateWithGoogle, + UserResponse, + UserUpdate, +) from services.email.service import email_service from sqlalchemy.orm import Session import jwt @@ -22,9 +30,9 @@ router = APIRouter(prefix="/users", tags=["users"]) oath2_scheme = OAuth2PasswordBearer(tokenUrl=f"users/login") + async def get_current_user( - token: Annotated[str, Depends(oath2_scheme)], - db: Session = Depends(get_db) + token: Annotated[str, Depends(oath2_scheme)], db: Session = Depends(get_db) ) -> User: """ Dependency to get the current user from the JWT token @@ -41,9 +49,7 @@ async def get_current_user( try: payload = jwt.decode( - token, - settings.SECRET_KEY, - algorithms=[settings.ALGORITHM] + token, settings.SECRET_KEY, algorithms=[settings.ALGORITHM] ) # Extract the username and token secret from the payload @@ -68,8 +74,7 @@ async def get_current_user( async def get_current_user_ws( - websocket: WebSocket, - db: Session = Depends(get_db) + websocket: WebSocket, db: Session = Depends(get_db) ) -> User: """ Dependency to get the current user from the JWT token in a WebSocket connection. @@ -81,12 +86,11 @@ async def get_current_user_ws( # Define an exception to raise if the credentials are invalid credentials_exception = HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, - detail="Could not validate credentials" + detail="Could not validate credentials", ) async def close_ws_and_raise( - code: int = 4001, - reason: str = "Could not validate credentials" + code: int = 4001, reason: str = "Could not validate credentials" ): try: await websocket.close(code=code, reason=reason) @@ -109,9 +113,7 @@ async def close_ws_and_raise( await close_ws_and_raise() payload = jwt.decode( - token, - settings.SECRET_KEY, - algorithms=[settings.ALGORITHM] + token, settings.SECRET_KEY, algorithms=[settings.ALGORITHM] ) # Extract the username and token secret from the payload @@ -136,11 +138,10 @@ async def close_ws_and_raise( return user -@router.post("/register", response_model=UserResponse, status_code=status.HTTP_201_CREATED) -async def register_user( - user: UserCreate, - db: Session = Depends(get_db) -): +@router.post( + "/register", response_model=UserResponse, status_code=status.HTTP_201_CREATED +) +async def register_user(user: UserCreate, db: Session = Depends(get_db)): """ Register a new user. @@ -154,14 +155,12 @@ async def register_user( # Check for existing username or email if db.query(User).filter(User.username == user.username).first(): raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, - detail="Username already exists" + status_code=status.HTTP_400_BAD_REQUEST, detail="Username already exists" ) if db.query(User).filter(User.email == user.email).first(): raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, - detail="Email already registered" + status_code=status.HTTP_400_BAD_REQUEST, detail="Email already registered" ) # Send verification email @@ -177,7 +176,7 @@ async def register_user( email=user.email, display_name=user.display_name, hashed_password=PasswordManager.hash_password(user.password), - verification_token=verification_token + verification_token=verification_token, ) db.add(db_user) db.commit() @@ -188,8 +187,7 @@ async def register_user( @router.post("/login", response_model=Token) async def login( - form_data: OAuth2PasswordRequestForm = Depends(), - db: Session = Depends(get_db) + form_data: OAuth2PasswordRequestForm = Depends(), db: Session = Depends(get_db) ): """ Log in a user. @@ -202,12 +200,18 @@ async def login( :return: The user's access and refresh tokens """ # Query the database for the user with the username or email - user = db.query(User).filter( - (User.username == form_data.username) | (User.email == form_data.username) - ).first() + user = ( + db.query(User) + .filter( + (User.username == form_data.username) | (User.email == form_data.username) + ) + .first() + ) # Check if the user exists and the password is correct - if not user or not PasswordManager.verify_password(form_data.password, user.hashed_password): + if not user or not PasswordManager.verify_password( + form_data.password, user.hashed_password + ): raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Incorrect login credentials", @@ -241,8 +245,7 @@ async def verify_email(token: str, db: Session = Depends(get_db)): user = db.query(User).filter(User.verification_token == token).first() if not user: raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, - detail="Invalid verification token" + status_code=status.HTTP_400_BAD_REQUEST, detail="Invalid verification token" ) user.is_verified = True @@ -253,10 +256,7 @@ async def verify_email(token: str, db: Session = Depends(get_db)): @router.post("/forgot-password") -async def forgot_password( - forgot_pwd: ForgotPassword, - db: Session = Depends(get_db) -): +async def forgot_password(forgot_pwd: ForgotPassword, db: Session = Depends(get_db)): """ Send a password reset email. @@ -268,9 +268,7 @@ async def forgot_password( # Same message to avoid leaking information if not user: - return { - "message": "If the email exists, a password reset link will be sent" - } + return {"message": "If the email exists, a password reset link will be sent"} # Generate and store the reset token, and send the email reset_token = PasswordManager.generate_secret_token() @@ -289,10 +287,7 @@ async def forgot_password( @router.post("/reset-password") -async def reset_password( - reset_data: PasswordReset, - db: Session = Depends(get_db) -): +async def reset_password(reset_data: PasswordReset, db: Session = Depends(get_db)): """ Reset a user's password. @@ -303,10 +298,14 @@ async def reset_password( user = db.query(User).filter(User.reset_token == reset_data.token).first() # Check if the user exists and the reset token is valid - if not user or not user.reset_token_expires or user.reset_token_expires < time.time(): + if ( + not user + or not user.reset_token_expires + or user.reset_token_expires < time.time() + ): raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, - detail="Invalid or expired reset token" + detail="Invalid or expired reset token", ) # Reset the password and clear the reset token @@ -326,9 +325,7 @@ async def reset_password( @router.get("/me", response_model=UserResponse) -async def read_users_me( - current_user: Annotated[User, Depends(get_current_user)] -): +async def read_users_me(current_user: Annotated[User, Depends(get_current_user)]): """ Get the current user. @@ -341,7 +338,7 @@ async def read_users_me( async def update_user( user_update: UserUpdate, current_user: Annotated[User, Depends(get_current_user)], - db: Session = Depends(get_db) + db: Session = Depends(get_db), ): """ Update the current user. @@ -354,7 +351,7 @@ async def update_user( if current_user.is_guest: raise HTTPException( status_code=status.HTTP_403_FORBIDDEN, - detail="Guest users cannot change their account details" + detail="Guest users cannot change their account details", ) # Update the user fields specified in the user update dictionary @@ -369,7 +366,7 @@ async def update_user( @router.delete("/me", status_code=status.HTTP_204_NO_CONTENT) async def delete_user( current_user: Annotated[User, Depends(get_current_user)], - db: Session = Depends(get_db) + db: Session = Depends(get_db), ): """ Delete the current user. @@ -379,16 +376,11 @@ async def delete_user( """ db.delete(current_user) db.commit() - return { - "message": "User deleted successfully" - } + return {"message": "User deleted successfully"} @router.post("/refresh", response_model=Token) -async def refresh_token( - token_data: TokenRefresh, - db: Session = Depends(get_db) -): +async def refresh_token(token_data: TokenRefresh, db: Session = Depends(get_db)): """ Refresh the user's access and refresh tokens. @@ -400,7 +392,7 @@ async def refresh_token( if not user: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, - detail="Invalid or expired refresh token" + detail="Invalid or expired refresh token", ) # Revoke the refresh token and create new tokens @@ -420,7 +412,7 @@ async def refresh_token( async def logout( token_data: TokenRefresh, current_user: Annotated[User, Depends(get_current_user)], - db: Session = Depends(get_db) + db: Session = Depends(get_db), ): """ Log out the user by revoking their provided refresh token. @@ -447,20 +439,18 @@ async def create_guest_account(db: Session = Depends(get_db)): time_limit = time.time() - (2 * 60 * 60) # 2 hours ago # First delete associated refresh tokens - old_guest_users = db.query(User).filter( - User.is_guest == True, - User.created_at < time_limit - ).all() + old_guest_users = ( + db.query(User) + .filter(User.is_guest == True, User.created_at < time_limit) + .all() + ) for user in old_guest_users: - db.query(RefreshToken).filter( - RefreshToken.user_id == user.id - ).delete() + db.query(RefreshToken).filter(RefreshToken.user_id == user.id).delete() # Then delete the guest users db.query(User).filter( - User.is_guest == True, - User.created_at < time_limit + User.is_guest == True, User.created_at < time_limit ).delete() db.commit() @@ -469,7 +459,9 @@ async def create_guest_account(db: Session = Depends(get_db)): print(f"Error cleaning up guest accounts: {e}") # Generate guest credentials - random_string = ''.join(random.choices(string.ascii_lowercase + string.digits, k=10)) + random_string = "".join( + random.choices(string.ascii_lowercase + string.digits, k=10) + ) username = f"guest_{random_string}" display_name = f"Guest_{random_string[:5]}" email = f"{random_string}-not-an-actual@email.com" @@ -483,7 +475,7 @@ async def create_guest_account(db: Session = Depends(get_db)): hashed_password=PasswordManager.hash_password(password), is_verified=True, is_guest=True, - token_secret=PasswordManager.generate_secret_token() + token_secret=PasswordManager.generate_secret_token(), ) try: @@ -494,15 +486,13 @@ async def create_guest_account(db: Session = Depends(get_db)): db.rollback() raise HTTPException( status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail="Error creating guest account" + detail="Error creating guest account", ) # Generate tokens access_token, refresh_token = jwt_manager.create_tokens(db_user, db) - return { - "access_token": access_token, - "refresh_token": refresh_token - } + return {"access_token": access_token, "refresh_token": refresh_token} + def create_google_flow(state=None): """ @@ -521,9 +511,10 @@ def create_google_flow(state=None): }, scopes=settings.GOOGLE_CLIENT_SCOPES, redirect_uri=settings.GOOGLE_REDIRECT_URI, - state=state + state=state, ) + @router.get("/google/redirect") async def google_redirect(): """ @@ -531,7 +522,8 @@ async def google_redirect(): """ flow = create_google_flow() url, _ = flow.authorization_url() - return { "url": url } + return {"url": url} + @router.post("/google/login") async def google_login( @@ -548,15 +540,17 @@ async def google_login( code = request.query_params.get("code") state = request.query_params.get("state") if not code: - raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="No code found") - + raise HTTPException( + status_code=status.HTTP_400_BAD_REQUEST, detail="No code found" + ) + flow = create_google_flow(state=state) # Exchange code for tokens and retrieve user info flow.fetch_token(code=code) credentials = flow.credentials oauth2_client = build("oauth2", "v2", credentials=credentials) - user_info = oauth2_client.userinfo().get().execute() + user_info = oauth2_client.userinfo().get().execute() # Extract relevant fields google_id = user_info.get("id") @@ -567,7 +561,7 @@ async def google_login( if not google_id or not email: raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, - detail="Missing account information from Google" + detail="Missing account information from Google", ) # See if user already exists @@ -587,7 +581,7 @@ async def google_login( "google_id": google_id, "email": email, "name": name, - "avatar_url": avatar_url + "avatar_url": avatar_url, } access_token, refresh_token = jwt_manager.create_tokens(db_user, db) @@ -597,10 +591,10 @@ async def google_login( "refresh_token": refresh_token, } + @router.post("/google/register") async def google_register( - user: UserCreateWithGoogle, - db: Session = Depends(get_db) + user: UserCreateWithGoogle, db: Session = Depends(get_db) ) -> dict: """ Register a new user with Google OAuth. @@ -615,14 +609,12 @@ async def google_register( # Check for existing username or email if db.query(User).filter(User.username == user.username).first(): raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, - detail="Username already exists" + status_code=status.HTTP_400_BAD_REQUEST, detail="Username already exists" ) if db.query(User).filter(User.email == user.email).first(): raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, - detail="Email already registered" + status_code=status.HTTP_400_BAD_REQUEST, detail="Email already registered" ) # Create the user @@ -633,7 +625,7 @@ async def google_register( hashed_password="", google_id=user.google_id, avatar_url=user.avatar_url, - is_verified=True + is_verified=True, ) db.add(db_user) db.commit() @@ -644,4 +636,4 @@ async def google_register( return { "access_token": access_token, "refresh_token": refresh_token, - } \ No newline at end of file + } diff --git a/app/core/config.py b/app/core/config.py index 7dc5a69..f9627a1 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -7,92 +7,99 @@ class Settings(BaseSettings): """ Provide typed access to the settings defined in the .env file. """ + # General - PROJECT_NAME: str = "Beatcode" # Name of the project - VERSION: str = "1.0.0" # Version of the project - API_STR: str = "/api" # Base URL for the API + PROJECT_NAME: str = "Beatcode" # Name of the project + VERSION: str = "1.0.0" # Version of the project + API_STR: str = "/api" # Base URL for the API # Testing - TESTING: bool # Enable testing mode - TEST_EMAIL_TOKEN: str # Email token for testing verification and password reset - TEST_DATABASE_URL: str # URL for the test database + TESTING: bool # Enable testing mode + TEST_EMAIL_TOKEN: str # Email token for testing verification and password reset + TEST_DATABASE_URL: str # URL for the test database # Signup - USERNAME_MIN_LENGTH: int # Minimum length for usernames - USERNAME_MAX_LENGTH: int # Maximum length for usernames - USERNAME_REGEX: str # Regex pattern for usernames - DISPLAY_NAME_MIN_LENGTH: int # Minimum length for display names - DISPLAY_NAME_MAX_LENGTH: int # Maximum length for display names - DISPLAY_NAME_REGEX: str # Regex pattern for display names - PASSWORD_MIN_LENGTH: int # Minimum length for passwords + USERNAME_MIN_LENGTH: int # Minimum length for usernames + USERNAME_MAX_LENGTH: int # Maximum length for usernames + USERNAME_REGEX: str # Regex pattern for usernames + DISPLAY_NAME_MIN_LENGTH: int # Minimum length for display names + DISPLAY_NAME_MAX_LENGTH: int # Maximum length for display names + DISPLAY_NAME_REGEX: str # Regex pattern for display names + PASSWORD_MIN_LENGTH: int # Minimum length for passwords # Email - RESEND_API_KEY: str # API key for the Resend service - FROM_EMAIL: str # Email address to send emails from - FRONTEND_URL: str # URL of the frontend (included in email links) - PASSWORD_RESET_TOKEN_EXPIRE: int # Time in minutes for the password reset token to expire + RESEND_API_KEY: str # API key for the Resend service + FROM_EMAIL: str # Email address to send emails from + FRONTEND_URL: str # URL of the frontend (included in email links) + PASSWORD_RESET_TOKEN_EXPIRE: ( + int # Time in minutes for the password reset token to expire + ) # Google OAuth - GOOGLE_CLIENT_ID: str # Client ID for Google OAuth - GOOGLE_CLIENT_SECRET: str # Client secret for Google OAuth - GOOGLE_REDIRECT_URI: str # Redirect URI for Google OAuth - GOOGLE_CLIENT_SCOPES: list[str] = ['openid', 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile'] + GOOGLE_CLIENT_ID: str # Client ID for Google OAuth + GOOGLE_CLIENT_SECRET: str # Client secret for Google OAuth + GOOGLE_REDIRECT_URI: str # Redirect URI for Google OAuth + GOOGLE_CLIENT_SCOPES: list[str] = [ + "openid", + "https://www.googleapis.com/auth/userinfo.email", + "https://www.googleapis.com/auth/userinfo.profile", + ] # Database - DATABASE_URL: str # URL for the database + DATABASE_URL: str # URL for the database # JWT - SECRET_KEY: str # Secret key for JWT - ALGORITHM: str # Encryption algorithm for JWT - ACCESS_TOKEN_EXPIRE_MINUTES: int # Time in minutes for the access token to expire - REFRESH_TOKEN_EXPIRE_DAYS: int # Time in days for the refresh token to expire + SECRET_KEY: str # Secret key for JWT + ALGORITHM: str # Encryption algorithm for JWT + ACCESS_TOKEN_EXPIRE_MINUTES: int # Time in minutes for the access token to expire + REFRESH_TOKEN_EXPIRE_DAYS: int # Time in days for the refresh token to expire # Code Execution - MAX_CONCURRENT: str # Maximum number of problems that can be executed concurrently for each difficulty - OPENAI_API_KEY: str # API key for OpenAI (Used for Runtime Analysis) + MAX_CONCURRENT: str # Maximum number of problems that can be executed concurrently for each difficulty + OPENAI_API_KEY: str # API key for OpenAI (Used for Runtime Analysis) # Docker Settings - DOCKER_IMAGE_PYTHON: str # Docker image for running Python code - DOCKER_IMAGE_JAVA: str # Docker image for running Java code - DOCKER_IMAGE_CPP: str # Docker image for running C++ code - DOCKER_MEMORY_LIMIT: str # Memory limit (mb) for problems - DOCKER_TIME_LIMIT: str # Time limit (ms) for problems - DOCKER_CPU_LIMIT: float # CPU limit (0-1.0) for each container + DOCKER_IMAGE_PYTHON: str # Docker image for running Python code + DOCKER_IMAGE_JAVA: str # Docker image for running Java code + DOCKER_IMAGE_CPP: str # Docker image for running C++ code + DOCKER_MEMORY_LIMIT: str # Memory limit (mb) for problems + DOCKER_TIME_LIMIT: str # Time limit (ms) for problems + DOCKER_CPU_LIMIT: float # CPU limit (0-1.0) for each container # Game Settings - SUBMISSION_COOLDOWN: int # Cooldown time (s) between submissions - STARTING_HP: int # Starting HP for each player - MATCH_PROBLEM_COUNT: int # Number of problems in each match - MATCH_TIMEOUT_MINUTES: int # Time limit (min) for each match - STARTING_SP: int # Starting SP for each player - STARTING_MP: int # Starting MP for each player - MANA_RECHARGE: int # Mana recharge per problem solved + SUBMISSION_COOLDOWN: int # Cooldown time (s) between submissions + STARTING_HP: int # Starting HP for each player + MATCH_PROBLEM_COUNT: int # Number of problems in each match + MATCH_TIMEOUT_MINUTES: int # Time limit (min) for each match + STARTING_SP: int # Starting SP for each player + STARTING_MP: int # Starting MP for each player + MANA_RECHARGE: int # Mana recharge per problem solved # Unranked Problem Distribution - UNRANKED_PROBS: str # Probability of an easy problem + UNRANKED_PROBS: str # Probability of an easy problem # HP Deduction Settings - HP_DEDUCTION_BASE: int # HP deduction for each test case - HP_MULTIPLIER: str # HP multiplier for each difficulty + HP_DEDUCTION_BASE: int # HP deduction for each test case + HP_MULTIPLIER: str # HP multiplier for each difficulty # Ranked Settings - RATING_K_FACTOR: int # K factor for Elo rating - RANK_THRESHOLDS: str # Thresholds for each rank - RANK_NAMES: str # Names for each rank - RANK_PROBLEM_DISTRIBUTION: str # Problem distribution for each rank + RATING_K_FACTOR: int # K factor for Elo rating + RANK_THRESHOLDS: str # Thresholds for each rank + RANK_NAMES: str # Names for each rank + RANK_PROBLEM_DISTRIBUTION: str # Problem distribution for each rank # Room Settings - ROOM_CODE_LENGTH: int # Length of the room code - ROOM_PROBLEM_COUNT: int # Number of problems - ROOM_STARTING_HP: int # Starting HP for each player - ROOM_HP_MULTIPLIER: str # HP multiplier for each difficulty - ROOM_DISTRIBUTION: str # Distribution mode for problems - ROOM_PROBLEM_DISTRIBUTION: str # Problem distribution for room - ROOM_UPDATE_THROTTLE: int # Minimum seconds between room broadcasts - ROOM_BASE_HP_DEDUCTION: int # Base HP deduction for each test case - ROOM_STARTING_SP: int # Starting SP for each player in room - ROOM_STARTING_MP: int # Starting MP for each player in room - ROOM_MANA_RECHARGE: int # Mana recharge per problem solved + ROOM_CODE_LENGTH: int # Length of the room code + ROOM_PROBLEM_COUNT: int # Number of problems + ROOM_STARTING_HP: int # Starting HP for each player + ROOM_HP_MULTIPLIER: str # HP multiplier for each difficulty + ROOM_DISTRIBUTION: str # Distribution mode for problems + ROOM_PROBLEM_DISTRIBUTION: str # Problem distribution for room + ROOM_UPDATE_THROTTLE: int # Minimum seconds between room broadcasts + ROOM_BASE_HP_DEDUCTION: int # Base HP deduction for each test case + ROOM_STARTING_SP: int # Starting SP for each player in room + ROOM_STARTING_MP: int # Starting MP for each player in room + ROOM_MANA_RECHARGE: int # Mana recharge per problem solved @property def DEFAULT_ROOM_SETTINGS(self) -> dict: @@ -105,21 +112,21 @@ def DEFAULT_ROOM_SETTINGS(self) -> dict: "problem_distribution": self.ROOM_PROBLEM_DISTRIBUTION, "starting_sp": self.ROOM_STARTING_SP, "starting_mp": self.ROOM_STARTING_MP, - "mana_recharge": self.ROOM_MANA_RECHARGE + "mana_recharge": self.ROOM_MANA_RECHARGE, } model_config = SettingsConfigDict( env_file="../.env", env_file_encoding="utf-8", case_sensitive=True, - extra="ignore" + extra="ignore", ) @lru_cache() def get_settings(): """ - Get the settings object. + Get the settings object. This function is cached so that the settings are only loaded once. """ return Settings() diff --git a/app/core/security/jwt.py b/app/core/security/jwt.py index 92f149e..f8dd9e2 100644 --- a/app/core/security/jwt.py +++ b/app/core/security/jwt.py @@ -23,7 +23,7 @@ def create_access_token( self, data: dict, user: Optional[User] = None, - expires_delta: Optional[int] = None + expires_delta: Optional[int] = None, ) -> str: """ Create an access token with the given data. @@ -44,23 +44,12 @@ def create_access_token( expire = time.time() + self.access_token_expire_minutes * 60 # Add the expiration time and the user's secret to the token. - to_encode.update({ - "exp": expire, - "secret": user.token_secret if user else None - }) + to_encode.update({"exp": expire, "secret": user.token_secret if user else None}) # Return the encoded token. - return jwt.encode( - to_encode, - key=self.secret_key, - algorithm=self.algorithm - ) + return jwt.encode(to_encode, key=self.secret_key, algorithm=self.algorithm) - def create_tokens( - self, - user: User, - db: Session - ) -> Tuple[str, str]: + def create_tokens(self, user: User, db: Session) -> Tuple[str, str]: """ Create an access token and a refresh token for the given user. @@ -73,7 +62,7 @@ def create_tokens( access_token = self.create_access_token( data={"sub": user.username}, user=user, - expires_delta=self.access_token_expire_minutes * 60 + expires_delta=self.access_token_expire_minutes * 60, ) # Create a refresh token for the user and save it to the database. @@ -81,9 +70,7 @@ def create_tokens( expires_at = time.time() + self.refresh_token_expire_days * 24 * 60 * 60 db_token = RefreshToken( - token=refresh_token, - user_id=user.id, - expires_at=expires_at + token=refresh_token, user_id=user.id, expires_at=expires_at ) db.add(db_token) @@ -92,11 +79,7 @@ def create_tokens( # Return the access token and the refresh token. return access_token, refresh_token - def verify_refresh_token( - self, - token: str, - db: Session - ) -> Optional[User]: + def verify_refresh_token(self, token: str, db: Session) -> Optional[User]: """ Verify the given refresh token and return the associated user. @@ -111,7 +94,8 @@ def verify_refresh_token( .filter( RefreshToken.token == token, RefreshToken.expires_at > time.time(), - ).first() + ) + .first() ) if db_token: @@ -119,11 +103,7 @@ def verify_refresh_token( return None - def revoke_refresh_token( - self, - token: str, - db: Session - ): + def revoke_refresh_token(self, token: str, db: Session): """ Revoke the given refresh token. @@ -131,9 +111,7 @@ def revoke_refresh_token( :param db: The database session to use. """ # Query for a token that matches the given token and delete it. - db.query(RefreshToken).filter( - RefreshToken.token == token - ).delete() + db.query(RefreshToken).filter(RefreshToken.token == token).delete() db.commit() @@ -145,9 +123,7 @@ def revoke_all_refresh_tokens(self, user_id: int, db: Session): :param db: The database session to use. """ # Delete all refresh tokens that match the given user ID. - db.query(RefreshToken).filter( - RefreshToken.user_id == user_id - ).delete() + db.query(RefreshToken).filter(RefreshToken.user_id == user_id).delete() db.commit() @@ -160,8 +136,7 @@ def cleanup_refresh_tokens(self, user_id: int, db: Session): """ # Delete all refresh tokens that are expired. db.query(RefreshToken).filter( - RefreshToken.user_id == user_id, - RefreshToken.expires_at < time.time() + RefreshToken.user_id == user_id, RefreshToken.expires_at < time.time() ).delete() db.commit() diff --git a/app/core/security/password.py b/app/core/security/password.py index b9f774d..ac4f82e 100644 --- a/app/core/security/password.py +++ b/app/core/security/password.py @@ -16,10 +16,10 @@ def hash_password(password: str) -> str: :param password: The password to hash. :return: The hashed password """ - password_bytes = password.encode('utf-8') + password_bytes = password.encode("utf-8") salt = bcrypt.gensalt() hashed_password = bcrypt.hashpw(password_bytes, salt) - return hashed_password.decode('utf-8') + return hashed_password.decode("utf-8") @staticmethod def verify_password(plain_password: str, hashed_password: str) -> bool: @@ -31,8 +31,8 @@ def verify_password(plain_password: str, hashed_password: str) -> bool: :return: Whether the password is correct. """ - password_bytes = plain_password.encode('utf-8') - hashed_bytes = hashed_password.encode('utf-8') + password_bytes = plain_password.encode("utf-8") + hashed_bytes = hashed_password.encode("utf-8") return bcrypt.checkpw(password_bytes, hashed_bytes) @staticmethod diff --git a/app/db/init.py b/app/db/init.py index 026a1ea..81b160b 100644 --- a/app/db/init.py +++ b/app/db/init.py @@ -9,7 +9,9 @@ def init_db(test=False): - engine = create_engine(settings.DATABASE_URL if not test else settings.TEST_DATABASE_URL) + engine = create_engine( + settings.DATABASE_URL if not test else settings.TEST_DATABASE_URL + ) if not database_exists(engine.url): create_database(engine.url) @@ -22,33 +24,33 @@ def init_db(test=False): session = SessionLocal() try: - with open('db/combined.json', 'r') as file: + with open("db/combined.json", "r") as file: problems = json.load(file) for problem in problems: new_problem = Problem( - title=problem['title'], - source=problem['source'], - description=problem['description'], - explanation=problem['explanation'], - difficulty=problem['difficulty'], - sample_test_cases=problem['sample_test_cases'], - sample_test_results=problem['sample_test_results'], - hidden_test_cases=problem['hidden_test_cases'], - hidden_test_results=problem['hidden_test_results'], - method_name=problem['method_name'], + title=problem["title"], + source=problem["source"], + description=problem["description"], + explanation=problem["explanation"], + difficulty=problem["difficulty"], + sample_test_cases=problem["sample_test_cases"], + sample_test_results=problem["sample_test_results"], + hidden_test_cases=problem["hidden_test_cases"], + hidden_test_results=problem["hidden_test_results"], + method_name=problem["method_name"], ) new_boilerplate = Boilerplate( - java=problem['boilerplate']['java'], - cpp=problem['boilerplate']['cpp'], - python=problem['boilerplate']['python'], + java=problem["boilerplate"]["java"], + cpp=problem["boilerplate"]["cpp"], + python=problem["boilerplate"]["python"], ) new_compare_func = CompareFunc( - java=problem['compare_func']['java'], - cpp=problem['compare_func']['cpp'], - python=problem['compare_func']['python'], + java=problem["compare_func"]["java"], + cpp=problem["compare_func"]["cpp"], + python=problem["compare_func"]["python"], ) new_problem.boilerplate = new_boilerplate @@ -70,39 +72,43 @@ def init_db(test=False): def drop_all_db(test=False): - engine = create_engine(settings.DATABASE_URL if not test else settings.TEST_DATABASE_URL) + engine = create_engine( + settings.DATABASE_URL if not test else settings.TEST_DATABASE_URL + ) if database_exists(engine.url): Base.metadata.drop_all(bind=engine) print("Dropped all tables") + def drop_db(table_names, test=False): - engine = create_engine(settings.DATABASE_URL if not test else settings.TEST_DATABASE_URL) + engine = create_engine( + settings.DATABASE_URL if not test else settings.TEST_DATABASE_URL + ) if database_exists(engine.url): - table_list = [Base.metadata.tables[name] for name in table_names.split(',')] + table_list = [Base.metadata.tables[name] for name in table_names.split(",")] Base.metadata.drop_all(bind=engine, tables=table_list) print(f"Dropped tables: {table_names}") + if __name__ == "__main__": import argparse parser = argparse.ArgumentParser() parser.add_argument( - "--dropall", - action="store_true", - help="Drop existing tables before creation" + "--dropall", action="store_true", help="Drop existing tables before creation" ) parser.add_argument( "--drop", type=str, - help="Drop specific tables (comma-separated, ex: --drop=table1,table2)" + help="Drop specific tables (comma-separated, ex: --drop=table1,table2)", ) parser.add_argument( "--droptest", action="store_true", - help="Drop existing test tables before creation" + help="Drop existing test tables before creation", ) args = parser.parse_args() diff --git a/app/db/models/problem.py b/app/db/models/problem.py index 8d4d52e..3755bbb 100644 --- a/app/db/models/problem.py +++ b/app/db/models/problem.py @@ -3,6 +3,7 @@ from sqlalchemy.sql import func from sqlalchemy.orm import relationship + class Problem(Base): """ Database model representing a problem. @@ -15,8 +16,9 @@ class Problem(Base): :param sample_test_results: The sample test results of the problem. :param hidden_test_cases: The hidden test cases of the problem. :param hidden_test_results: The hidden test results of the problem. - :param created_at: Epoch time when the problem was created. + :param created_at: Epoch time when the problem was created. """ + __tablename__ = "problems" id = Column(Integer, primary_key=True, index=True) @@ -30,10 +32,15 @@ class Problem(Base): hidden_test_cases = Column(JSON, nullable=False) hidden_test_results = Column(JSON, nullable=False) method_name = Column(String, nullable=False) - created_at = Column(Float, server_default=func.extract('epoch', func.now())) + created_at = Column(Float, server_default=func.extract("epoch", func.now())) + + boilerplate = relationship( + "Boilerplate", back_populates="problem", uselist=False, lazy="joined" + ) + compare_func = relationship( + "CompareFunc", back_populates="problem", uselist=False, lazy="joined" + ) - boilerplate = relationship("Boilerplate", back_populates="problem", uselist=False, lazy="joined") - compare_func = relationship("CompareFunc", back_populates="problem", uselist=False, lazy="joined") class Boilerplate(Base): """ @@ -44,15 +51,17 @@ class Boilerplate(Base): :param cpp: The boilerplate code in C++. :param python: The boilerplate code in Python. """ + __tablename__ = "boilerplates" - + pid = Column(Integer, ForeignKey("problems.id"), primary_key=True) java = Column(Text) cpp = Column(Text) python = Column(Text) - + problem = relationship("Problem", back_populates="boilerplate") + class CompareFunc(Base): """ Database model representing the comparison function for a problem. @@ -62,11 +71,12 @@ class CompareFunc(Base): :param cpp: The comparison function in C++. :param python: The comparison function in Python. """ + __tablename__ = "compare_funcs" - + pid = Column(Integer, ForeignKey("problems.id"), primary_key=True) java = Column(Text) cpp = Column(Text) python = Column(Text) - - problem = relationship("Problem", back_populates="compare_func") \ No newline at end of file + + problem = relationship("Problem", back_populates="compare_func") diff --git a/app/db/models/user.py b/app/db/models/user.py index 0b7d8a8..9b31ed5 100644 --- a/app/db/models/user.py +++ b/app/db/models/user.py @@ -20,10 +20,11 @@ class User(Base): :param verification_token: The token used to verify the user's email. :param reset_token: The token used to reset the user's password. :param reset_token_expires: The expiration date of the reset token. - :param token_secret: The secret token used to immediately revoke access when events like password changes happen. + :param token_secret: The secret token used to immediately revoke access when events like password changes happen. :param created_at: The epoch time when the user was created. :param updated_at: The epoch time when the user was last updated. """ + __tablename__ = "users" id = Column(Integer, primary_key=True, index=True) @@ -37,12 +38,15 @@ class User(Base): verification_token = Column(String, unique=True, nullable=True) reset_token = Column(String, unique=True, nullable=True) reset_token_expires = Column(Float, nullable=True) - token_secret = Column(String, nullable=True, server_default=PasswordManager.generate_secret_token()) - created_at = Column(Float, server_default=func.extract('epoch', func.now())) - updated_at = Column(Float, server_default=func.extract('epoch', func.now())) + token_secret = Column( + String, nullable=True, server_default=PasswordManager.generate_secret_token() + ) + created_at = Column(Float, server_default=func.extract("epoch", func.now())) + updated_at = Column(Float, server_default=func.extract("epoch", func.now())) google_id = Column(String, unique=True, index=True, nullable=True) avatar_url = Column(String, nullable=True) + class RefreshToken(Base): """ Database model representing a refresh token. @@ -60,7 +64,7 @@ class RefreshToken(Base): token = Column(String, unique=True, index=True, nullable=False) user_id = Column(Integer, ForeignKey("users.id"), nullable=True) expires_at = Column(Float, nullable=False) - created_at = Column(Float, server_default=func.extract('epoch', func.now())) + created_at = Column(Float, server_default=func.extract("epoch", func.now())) # Relationship allows for querying the user associated with the refresh token or vice versa. user = relationship("User", backref="refresh_tokens") diff --git a/app/db/session.py b/app/db/session.py index fcf4869..eb2ce29 100644 --- a/app/db/session.py +++ b/app/db/session.py @@ -2,13 +2,15 @@ from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker -engine = create_engine(settings.DATABASE_URL if not settings.TESTING else settings.TEST_DATABASE_URL) +engine = create_engine( + settings.DATABASE_URL if not settings.TESTING else settings.TEST_DATABASE_URL +) SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) def get_db(): """ - Get a database session. + Get a database session. Automatically closes the session when the context is exited. """ db = SessionLocal() diff --git a/app/schemas/game.py b/app/schemas/game.py index 6260712..a9d0c71 100644 --- a/app/schemas/game.py +++ b/app/schemas/game.py @@ -5,7 +5,7 @@ class GameView(BaseModel): """ - A model for a user's view of a game. + A model for a user's view of a game. :param match_id: The match ID. :param opponent_name: The opponent's username. @@ -18,9 +18,10 @@ class GameView(BaseModel): :param match_type: The type of the match. :param start_time: The start time of the match (epoch) :param status: The status of the match. - :param winner: The winner of the match. + :param winner: The winner of the match. :param rating_change: The rating change of the user. """ + match_id: str opponent_name: str opponent_display_name: str @@ -47,5 +48,6 @@ class GameEvent(BaseModel): :param type: The type of the event. :param data: The data of the event. """ + type: str data: Dict diff --git a/app/schemas/user.py b/app/schemas/user.py index 3c3e52f..bfe4af8 100644 --- a/app/schemas/user.py +++ b/app/schemas/user.py @@ -9,28 +9,25 @@ Field( min_length=settings.USERNAME_MIN_LENGTH, max_length=settings.USERNAME_MAX_LENGTH, - pattern=settings.USERNAME_REGEX) + pattern=settings.USERNAME_REGEX, + ), ] DisplayNameStr = Annotated[ str, Field( min_length=settings.DISPLAY_NAME_MIN_LENGTH, max_length=settings.DISPLAY_NAME_MAX_LENGTH, - pattern=settings.DISPLAY_NAME_REGEX - ) -] -PasswordStr = Annotated[ - str, - Field( - min_length=settings.PASSWORD_MIN_LENGTH - ) + pattern=settings.DISPLAY_NAME_REGEX, + ), ] +PasswordStr = Annotated[str, Field(min_length=settings.PASSWORD_MIN_LENGTH)] class UserBase(BaseModel): """ Base schema for user data. """ + username: UsernameStr email: EmailStr display_name: DisplayNameStr @@ -40,22 +37,27 @@ class UserCreate(UserBase): """ Schema for creating a new user. """ + password: PasswordStr + class UserCreateWithGoogle(UserBase): """ Schema for creating a new user with Google OAuth. """ + username: UsernameStr email: EmailStr display_name: DisplayNameStr google_id: str avatar_url: str + class UserUpdate(BaseModel): """ Schema for updating user data. """ + display_name: Optional[DisplayNameStr] = None @@ -63,6 +65,7 @@ class UserResponse(BaseModel): """ A response schema to return user data to the client. """ + username: UsernameStr email: EmailStr display_name: DisplayNameStr @@ -81,6 +84,7 @@ class ForgotPassword(BaseModel): """ A schema for requesting a password reset. """ + email: EmailStr @@ -88,6 +92,7 @@ class PasswordReset(BaseModel): """ A schema for resetting the password. """ + token: str new_password: PasswordStr @@ -96,6 +101,7 @@ class Token(BaseModel): """ A schema for returning the access token. """ + access_token: str refresh_token: str @@ -104,4 +110,5 @@ class TokenRefresh(BaseModel): """ A schema for refreshing the access token. """ + refresh_token: str diff --git a/app/services/email/service.py b/app/services/email/service.py index 141bcb0..88ef17b 100644 --- a/app/services/email/service.py +++ b/app/services/email/service.py @@ -24,12 +24,14 @@ def send_verification_email(self, to_email: str, token: str): verify_url = f"{self.frontend_url}/verify-email?token={token}" try: - response = resend.Emails.send({ - "from": self.from_email, - "to": to_email, - "subject": "Verify your BeatCode account", - "html": EmailTemplates.verification_email(verify_url) - }) + response = resend.Emails.send( + { + "from": self.from_email, + "to": to_email, + "subject": "Verify your BeatCode account", + "html": EmailTemplates.verification_email(verify_url), + } + ) return response except Exception as e: @@ -42,17 +44,21 @@ def send_password_reset_email(self, to_email: str, token: str): Send a password reset email to the user's email address. :param to_email: The email address to send the email to. - :param token: The password reset token to include in the email. + :param token: The password reset token to include in the email. """ reset_url = f"{self.frontend_url}/reset-password?token={token}" try: - response = resend.Emails.send({ - "from": self.from_email, - "to": to_email, - "subject": "Reset your BeatCode password", - "html": EmailTemplates.password_reset_email(reset_url, self.expire_minutes) - }) + response = resend.Emails.send( + { + "from": self.from_email, + "to": to_email, + "subject": "Reset your BeatCode password", + "html": EmailTemplates.password_reset_email( + reset_url, self.expire_minutes + ), + } + ) return response except Exception as e: diff --git a/app/services/email/templates.py b/app/services/email/templates.py index 40de0b5..ee5f133 100644 --- a/app/services/email/templates.py +++ b/app/services/email/templates.py @@ -2,6 +2,7 @@ class EmailTemplates: """ A static class to generate email templates. """ + @staticmethod def verification_email(verify_url: str) -> str: """ diff --git a/app/services/execution/docker.py b/app/services/execution/docker.py index c2a969e..2b77624 100644 --- a/app/services/execution/docker.py +++ b/app/services/execution/docker.py @@ -34,7 +34,7 @@ def __init__(self, client: docker.DockerClient): self.last_logs = "" self.last_stderr = "" self.last_status_code = 0 - + def get_run_commands(self, lang: str, file_path: str) -> list: """ Get the command to run the code in a Docker container. @@ -44,27 +44,31 @@ def get_run_commands(self, lang: str, file_path: str) -> list: :return: The command to run the code in a Docker container. """ file_name = os.path.basename(file_path) - base_name = file_name.split('.')[0] - + base_name = file_name.split(".")[0] + if lang == "python": return ["python", file_name] - + # Needs to compile first before running unlike Python elif lang == "java": return [ - "sh", "-c", - f"javac -cp /lib/*:/code {file_name} && java -cp /lib/*:/code {base_name}" + "sh", + "-c", + f"javac -cp /lib/*:/code {file_name} && java -cp /lib/*:/code {base_name}", ] - + elif lang == "cpp": return [ - "sh", "-c", - f"g++ -std=c++17 -o {base_name} {file_name} -ljsoncpp && ./{base_name}" + "sh", + "-c", + f"g++ -std=c++17 -o {base_name} {file_name} -ljsoncpp && ./{base_name}", ] - + raise ValueError(f"Unsupported language: {lang}") - def run_container(self, lang: str, file_path: str, difficulty: str) -> ExecutionResult: + def run_container( + self, lang: str, file_path: str, difficulty: str + ) -> ExecutionResult: """ Run the code in a Docker container. @@ -101,13 +105,17 @@ def run_container(self, lang: str, file_path: str, difficulty: str) -> Execution try: # Wait for the container to finish and get the logs result = container.wait(timeout=time_limit / 1000) - self.last_logs = container.logs().decode('utf-8') - self.last_stderr = container.logs(stdout=False, stderr=True).decode('utf-8') + self.last_logs = container.logs().decode("utf-8") + self.last_stderr = container.logs(stdout=False, stderr=True).decode( + "utf-8" + ) self.last_status_code = result["StatusCode"] # Check if the container stopped unexpectedly if result["StatusCode"] != 0: - if result["StatusCode"] == 137: # SIGKILL - likely fired when memory limit is exceeded + if ( + result["StatusCode"] == 137 + ): # SIGKILL - likely fired when memory limit is exceeded return ExecutionResult( success=False, message="Runtime Error Detected: Memory Limit Exceeded", @@ -116,18 +124,18 @@ def run_container(self, lang: str, file_path: str, difficulty: str) -> Execution success=False, message="Runtime Error Detected\n" + self.last_logs.strip(), ) - + if self.last_stderr.strip(): return ExecutionResult( success=False, message="Runtime Error Detected\n" + self.last_stderr.strip(), ) - base_name = os.path.basename(file_path).split('.')[0] + base_name = os.path.basename(file_path).split(".")[0] results_file = os.path.join(dir_path, f"{base_name}-results.txt") - + if os.path.exists(results_file): - with open(results_file, 'r') as f: + with open(results_file, "r") as f: execution_data = json.load(f) os.remove(results_file) return ExecutionResult( @@ -138,12 +146,15 @@ def run_container(self, lang: str, file_path: str, difficulty: str) -> Execution else: return ExecutionResult( success=False, - message="Test Runner Error: Results file not found\n" + self.last_logs.strip(), + message="Test Runner Error: Results file not found\n" + + self.last_logs.strip(), ) except Exception as e: # Check for timeout, else raise the exception - self.last_logs = container.logs().decode('utf-8') - self.last_stderr = container.logs(stdout=False, stderr=True).decode('utf-8') + self.last_logs = container.logs().decode("utf-8") + self.last_stderr = container.logs(stdout=False, stderr=True).decode( + "utf-8" + ) if "timed out" in str(e): return ExecutionResult( success=False, diff --git a/app/services/execution/runtime_analysis.py b/app/services/execution/runtime_analysis.py index a9409a8..121ac37 100644 --- a/app/services/execution/runtime_analysis.py +++ b/app/services/execution/runtime_analysis.py @@ -17,7 +17,9 @@ class RuntimeAnalysisService: """ def __init__(self, api_key: str): - self.client = AsyncOpenAI(api_key=api_key) if api_key != 'your_api_key_here' else None + self.client = ( + AsyncOpenAI(api_key=api_key) if api_key != "your_api_key_here" else None + ) async def analyze_code(self, code: str) -> Optional[str]: """ @@ -33,11 +35,17 @@ async def analyze_code(self, code: str) -> Optional[str]: completion = await self.client.beta.chat.completions.parse( model="gpt-4o-mini", messages=[ - {"role": "system", "content": "You are a code analysis assistant. Analyze the code and provide ONLY the time complexity in Big O notation (e.g. O(n), O(n^2)). No other text or explanations."}, - {"role": "user", "content": f"Analyze this code:\n\n```\n{code}\n```"} + { + "role": "system", + "content": "You are a code analysis assistant. Analyze the code and provide ONLY the time complexity in Big O notation (e.g. O(n), O(n^2)). No other text or explanations.", + }, + { + "role": "user", + "content": f"Analyze this code:\n\n```\n{code}\n```", + }, ], response_format=RuntimeAnalysis, - temperature=0 + temperature=0, ) return completion.choices[0].message.parsed.complexity except Exception as e: diff --git a/app/services/execution/service.py b/app/services/execution/service.py index e8eeab7..fcaf46e 100644 --- a/app/services/execution/service.py +++ b/app/services/execution/service.py @@ -6,10 +6,15 @@ import docker from core.config import settings from services.execution.docker import DockerRunner -from services.execution.test_generator import PythonTestGenerator, JavaTestGenerator, CppTestGenerator +from services.execution.test_generator import ( + PythonTestGenerator, + JavaTestGenerator, + CppTestGenerator, +) from services.execution.types import ExecutionResult from services.execution.runtime_analysis import runtime_analysis_service + class CodeExecutionService: """ A service class in charge of executing code. @@ -22,9 +27,7 @@ def __init__(self): "java": JavaTestGenerator(), "cpp": CppTestGenerator(), } - easy, medium, hard = [ - int(x) for x in settings.MAX_CONCURRENT.split(",") - ] + easy, medium, hard = [int(x) for x in settings.MAX_CONCURRENT.split(",")] self._execution_semaphores = { "easy": asyncio.Semaphore(easy), "medium": asyncio.Semaphore(medium), @@ -41,7 +44,7 @@ async def execute_code( sample_expected_results: List[str], difficulty: str, compare_func: str, - lang: str = 'python' + lang: str = "python", ) -> ExecutionResult: """ Execute the code with the given test cases and expected results. @@ -60,7 +63,9 @@ async def execute_code( async with sem: # blocks until a semaphore is available # Create a temporary file to store the test runner file. - with tempfile.NamedTemporaryFile(mode='w', suffix=gen.get_file_extension(lang), delete=False) as f: + with tempfile.NamedTemporaryFile( + mode="w", suffix=gen.get_file_extension(lang), delete=False + ) as f: # Test data are pairs of test cases and its expected results. test_data = [ {"input": tc, "expected": er} @@ -70,9 +75,11 @@ async def execute_code( {"input": tc, "expected": er} for tc, er in zip(sample_test_cases, sample_expected_results) ] - - base_name = os.path.basename(f.name).split('.')[0] - file_content = gen.generate_test_file(code, base_name, method_name, test_data, sample_data, compare_func) + + base_name = os.path.basename(f.name).split(".")[0] + file_content = gen.generate_test_file( + code, base_name, method_name, test_data, sample_data, compare_func + ) f.write(file_content) file_path = f.name try: diff --git a/app/services/execution/types.py b/app/services/execution/types.py index 02bcd28..17562d9 100644 --- a/app/services/execution/types.py +++ b/app/services/execution/types.py @@ -26,7 +26,11 @@ def all_cleared(self) -> bool: """ Check if all tests passed. """ - return all(t.get("passed", False) for t in self.test_results) if self.test_results else False + return ( + all(t.get("passed", False) for t in self.test_results) + if self.test_results + else False + ) def to_dict(self) -> Dict: """ @@ -37,9 +41,14 @@ def to_dict(self) -> Dict: "message": self.message, "test_results": self.test_results, "sample_results": self.sample_results, - "summary": self.summary or { + "summary": self.summary + or { "total_tests": len(self.test_results) if self.test_results else 0, - "passed_tests": len([t for t in self.test_results if t.get("passed", False)]) if self.test_results else 0, + "passed_tests": ( + len([t for t in self.test_results if t.get("passed", False)]) + if self.test_results + else 0 + ), }, - "runtime_analysis": self.runtime_analysis + "runtime_analysis": self.runtime_analysis, } diff --git a/app/services/game/ability.py b/app/services/game/ability.py index 55e472a..dc16ccd 100644 --- a/app/services/game/ability.py +++ b/app/services/game/ability.py @@ -13,6 +13,7 @@ class Ability(BaseModel): :param sp_cost: The amount of skill points required to buy the ability :param mp_cost: The amount of mana points required to use the ability """ + sp_cost: int mp_cost: int @@ -37,7 +38,7 @@ async def handle_ability_message( game_state: GameState, game_manager: GameManager, player_id: int, - message: Dict + message: Dict, ) -> Optional[str]: """ Handle an ability message from the client @@ -50,17 +51,11 @@ async def handle_ability_message( action = message.get("action") if action == "buy": return await self.handle_buy_ability( - game_state, - game_manager, - player_id, - message.get("ability_id") + game_state, game_manager, player_id, message.get("ability_id") ) elif action == "use": return await self.handle_use_ability( - game_state, - game_manager, - player_id, - message.get("ability_id") + game_state, game_manager, player_id, message.get("ability_id") ) return "Invalid action" @@ -70,7 +65,7 @@ async def handle_buy_ability( game_state: GameState, game_manager: GameManager, player_id: int, - ability_id: str + ability_id: str, ) -> Optional[str]: """ Handle ability purchases @@ -96,30 +91,31 @@ async def handle_buy_ability( player.skill_points -= ability.sp_cost player.abilities.append(ability_id) - await game_state.broadcast_event(GameEvent( - type="ability_bought", - data={ - "player": player.username, - "ability": ability_id - } - )) + await game_state.broadcast_event( + GameEvent( + type="ability_bought", + data={"player": player.username, "ability": ability_id}, + ) + ) # Send updated player states to both players - await game_state.player1.send_event(GameEvent( - type="game_state", - data=game_manager.create_game_view( - game_state, - game_state.player1.user_id - ).model_dump() - )) - - await game_state.player2.send_event(GameEvent( - type="game_state", - data=game_manager.create_game_view( - game_state, - game_state.player2.user_id - ).model_dump() - )) + await game_state.player1.send_event( + GameEvent( + type="game_state", + data=game_manager.create_game_view( + game_state, game_state.player1.user_id + ).model_dump(), + ) + ) + + await game_state.player2.send_event( + GameEvent( + type="game_state", + data=game_manager.create_game_view( + game_state, game_state.player2.user_id + ).model_dump(), + ) + ) return None @@ -128,7 +124,7 @@ async def handle_use_ability( game_state: GameState, game_manager: GameManager, player_id: int, - ability_id: str + ability_id: str, ) -> Optional[str]: """ Handle ability uses @@ -158,30 +154,31 @@ async def handle_use_ability( if ability_id == "healio": player.hp += 20 # Heal for 20 - await game_state.broadcast_event(GameEvent( - type="ability_used", - data={ - "player": player.username, - "ability": ability_id - } - )) + await game_state.broadcast_event( + GameEvent( + type="ability_used", + data={"player": player.username, "ability": ability_id}, + ) + ) # Send updated player states to both players - await game_state.player1.send_event(GameEvent( - type="game_state", - data=game_manager.create_game_view( - game_state, - game_state.player1.user_id - ).model_dump() - )) - - await game_state.player2.send_event(GameEvent( - type="game_state", - data=game_manager.create_game_view( - game_state, - game_state.player2.user_id - ).model_dump() - )) + await game_state.player1.send_event( + GameEvent( + type="game_state", + data=game_manager.create_game_view( + game_state, game_state.player1.user_id + ).model_dump(), + ) + ) + + await game_state.player2.send_event( + GameEvent( + type="game_state", + data=game_manager.create_game_view( + game_state, game_state.player2.user_id + ).model_dump(), + ) + ) return None diff --git a/app/services/game/manager.py b/app/services/game/manager.py index e5b2bab..6114096 100644 --- a/app/services/game/manager.py +++ b/app/services/game/manager.py @@ -30,9 +30,7 @@ def __init__(self): self.timeout_tasks: Dict[str, asyncio.Task] = {} self.db_sessions: Dict[str, Session] = {} self.hp_deduction = settings.HP_DEDUCTION_BASE - easy, medium, hard = [ - float(x) for x in settings.HP_MULTIPLIER.split(",") - ] + easy, medium, hard = [float(x) for x in settings.HP_MULTIPLIER.split(",")] self.hp_multiplier = { "easy": easy, "medium": medium, @@ -50,7 +48,8 @@ def create_game_view(self, game_state: GameState, user_id: int) -> GameView: player = game_state.player1 if is_player1 else game_state.player2 opponent = game_state.player2 if is_player1 else game_state.player1 rating_change = ( - game_state.player1_rating_change if is_player1 + game_state.player1_rating_change + if is_player1 else game_state.player2_rating_change ) @@ -188,7 +187,11 @@ async def create_game_with_settings( distribution = { "easy": int(room_settings.prob_easy * room_settings.problem_count), "medium": int(room_settings.prob_medium * room_settings.problem_count), - "hard": int(room_settings.problem_count - int(room_settings.prob_easy * room_settings.problem_count) - int(room_settings.prob_medium * room_settings.problem_count)) + "hard": int( + room_settings.problem_count + - int(room_settings.prob_easy * room_settings.problem_count) + - int(room_settings.prob_medium * room_settings.problem_count) + ), } else: distribution = defaultdict(int) @@ -201,7 +204,9 @@ async def create_game_with_settings( else: distribution["hard"] += 1 - problems = await ProblemManager.get_problems_by_distribution(db, dict(distribution)) + problems = await ProblemManager.get_problems_by_distribution( + db, dict(distribution) + ) # Create the corresponding game state object game = GameState( @@ -214,7 +219,7 @@ async def create_game_with_settings( avatar_url=player1.avatar_url, hp=room_settings.starting_hp, skill_points=room_settings.starting_sp, - mana_points=room_settings.starting_mp + mana_points=room_settings.starting_mp, ), player2=PlayerState( user_id=player2.id, @@ -223,7 +228,7 @@ async def create_game_with_settings( avatar_url=player2.avatar_url, hp=room_settings.starting_hp, skill_points=room_settings.starting_sp, - mana_points=room_settings.starting_mp + mana_points=room_settings.starting_mp, ), problems=problems, start_time=time.time(), @@ -232,11 +237,11 @@ async def create_game_with_settings( "hp_multiplier": { "easy": room_settings.hp_multiplier_easy, "medium": room_settings.hp_multiplier_medium, - "hard": room_settings.hp_multiplier_hard + "hard": room_settings.hp_multiplier_hard, }, "base_hp_deduction": room_settings.base_hp_deduction, - "mana_recharge": room_settings.mana_recharge - } + "mana_recharge": room_settings.mana_recharge, + }, ) self.active_games[game_id] = game @@ -260,7 +265,9 @@ def get_player_game(self, player_id: int) -> Optional[GameState]: game_id = self.player_to_game.get(player_id) return self.active_games.get(game_id) if game_id else None - def calculate_hp_deduction(self, test_cases_solved: int, difficulty: str, game_state: GameState) -> int: + def calculate_hp_deduction( + self, test_cases_solved: int, difficulty: str, game_state: GameState + ) -> int: """ # SUBJECT TO CHANGE Calculates the HP deduction for a player based on the number of test cases solved and the problem difficulty. @@ -271,14 +278,21 @@ def calculate_hp_deduction(self, test_cases_solved: int, difficulty: str, game_s :return: The HP deduction. """ # Use custom base deduction if available, otherwise use default - if game_state.custom_settings and 'base_hp_deduction' in game_state.custom_settings: - base_deduction = game_state.custom_settings['base_hp_deduction'] * test_cases_solved + if ( + game_state.custom_settings + and "base_hp_deduction" in game_state.custom_settings + ): + base_deduction = ( + game_state.custom_settings["base_hp_deduction"] * test_cases_solved + ) else: base_deduction = self.hp_deduction * test_cases_solved # Use custom multipliers if available, otherwise use default - if game_state.custom_settings and 'hp_multiplier' in game_state.custom_settings: - multiplier = game_state.custom_settings['hp_multiplier'].get(difficulty.lower(), 1) + if game_state.custom_settings and "hp_multiplier" in game_state.custom_settings: + multiplier = game_state.custom_settings["hp_multiplier"].get( + difficulty.lower(), 1 + ) else: multiplier = self.hp_multiplier.get(difficulty.lower(), 1) @@ -311,9 +325,10 @@ async def process_submission( # Only update the player's state if they have made progress if test_cases_solved > prev_solved: hp_deduction = self.calculate_hp_deduction( - test_cases_solved - prev_solved, # Deduct HP based on new test cases solved only + test_cases_solved + - prev_solved, # Deduct HP based on new test cases solved only current_problem.difficulty, - game + game, ) opponent.hp = max(0, opponent.hp - hp_deduction) player.partial_progress[player.current_problem_index] = test_cases_solved @@ -348,10 +363,10 @@ async def check_game_end(self, game_id: str) -> bool: # If one player's HP reaches 0 or one player has solved all problems the game ends if ( - game.player1.hp <= 0 or - game.player2.hp <= 0 or - game.player1.problems_solved == len(game.problems) or - game.player2.problems_solved == len(game.problems) + game.player1.hp <= 0 + or game.player2.hp <= 0 + or game.player1.problems_solved == len(game.problems) + or game.player2.problems_solved == len(game.problems) ): game.winner = await self.get_winner(game) @@ -360,11 +375,7 @@ async def check_game_end(self, game_id: str) -> bool: return False - async def handle_game_end( - self, - game_state: GameState, - db: Session - ): + async def handle_game_end(self, game_state: GameState, db: Session): """ Handle the end of a game like saving the match data and cleaning up the game @@ -394,9 +405,13 @@ async def handle_game_end( end_time=time.time(), match_type=game_state.match_type, winner_id=( - game_state.player1.user_id if game_state.winner == game_state.player1.username - else game_state.player2.user_id if game_state.winner == game_state.player2.username - else None + game_state.player1.user_id + if game_state.winner == game_state.player1.username + else ( + game_state.player2.user_id + if game_state.winner == game_state.player2.username + else None + ) ), problems=[p.id for p in game_state.problems], player1_rating_change=game_state.player1_rating_change, @@ -412,8 +427,12 @@ async def handle_game_end( # Find the room this game belongs to room = next( - (room for room in room_service.rooms.values() if room.game_id == game_state.id), - None + ( + room + for room in room_service.rooms.values() + if room.game_id == game_state.id + ), + None, ) # If room exists, reset its status @@ -427,34 +446,40 @@ async def handle_game_end( room.host_id: db.query(User).filter(User.id == room.host_id).first(), } if room.guest_id: - users[room.guest_id] = db.query(User).filter( - User.id == room.guest_id - ).first() + users[room.guest_id] = ( + db.query(User).filter(User.id == room.guest_id).first() + ) # Broadcast updated room state - await room.broadcast({ - "type": "room_update", - "data": room_service.create_room_view(room, users).model_dump() - }) + await room.broadcast( + { + "type": "room_update", + "data": room_service.create_room_view(room, users).model_dump(), + } + ) # Broadcast the match result to the players - await game_state.player1.send_event(GameEvent( - type="match_end", - data=self.create_game_view(game_state, game_state.player1.user_id).model_dump() - )) + await game_state.player1.send_event( + GameEvent( + type="match_end", + data=self.create_game_view( + game_state, game_state.player1.user_id + ).model_dump(), + ) + ) - await game_state.player2.send_event(GameEvent( - type="match_end", - data=self.create_game_view(game_state, game_state.player2.user_id).model_dump() - )) + await game_state.player2.send_event( + GameEvent( + type="match_end", + data=self.create_game_view( + game_state, game_state.player2.user_id + ).model_dump(), + ) + ) await self.cleanup_game(game_state.id) - async def handle_ranked_match_end( - self, - game_state: GameState, - db: Session - ): + async def handle_ranked_match_end(self, game_state: GameState, db: Session): """ Handle the end of a ranked match including rating calculations @@ -464,8 +489,16 @@ async def handle_ranked_match_end( # Skip rating calculation if the game is a draw if game_state.winner: # Get winner and loser states - winner = game_state.player1 if game_state.winner == game_state.player1.username else game_state.player2 - loser = game_state.player2 if game_state.winner == game_state.player1.username else game_state.player1 + winner = ( + game_state.player1 + if game_state.winner == game_state.player1.username + else game_state.player2 + ) + loser = ( + game_state.player2 + if game_state.winner == game_state.player1.username + else game_state.player1 + ) # Get users from database winner_user = db.query(User).filter(User.id == winner.user_id).first() @@ -473,15 +506,11 @@ async def handle_ranked_match_end( # Calculate rating change winner_change = self.matchmaker.ranked_service.calculate_rating_change( - winner_user.rating, - loser_user.rating, - True + winner_user.rating, loser_user.rating, True ) loser_change = self.matchmaker.ranked_service.calculate_rating_change( - loser_user.rating, - winner_user.rating, - False + loser_user.rating, winner_user.rating, False ) # Update ratings @@ -489,8 +518,16 @@ async def handle_ranked_match_end( loser_user.rating = max(0, loser_user.rating + loser_change) # Save rating changes - game_state.player1_rating_change = winner_change if game_state.winner == game_state.player1.username else loser_change if loser_user.rating > 0 else 0 - game_state.player2_rating_change = winner_change if game_state.winner == game_state.player2.username else loser_change if loser_user.rating > 0 else 0 + game_state.player1_rating_change = ( + winner_change + if game_state.winner == game_state.player1.username + else loser_change if loser_user.rating > 0 else 0 + ) + game_state.player2_rating_change = ( + winner_change + if game_state.winner == game_state.player2.username + else loser_change if loser_user.rating > 0 else 0 + ) async def forfeit_game(self, game_id: str, player_id: int): """ diff --git a/app/services/game/matchmaker.py b/app/services/game/matchmaker.py index 0a68888..8e5ffe1 100644 --- a/app/services/game/matchmaker.py +++ b/app/services/game/matchmaker.py @@ -24,10 +24,7 @@ def __init__(self): self.ranked_service = RankedService() async def add_to_queue( - self, - ws: WebSocket, - user: User, - ranked: bool = False + self, ws: WebSocket, user: User, ranked: bool = False ) -> bool: """ Adds a player to the queue if they are not already in it. @@ -37,9 +34,8 @@ async def add_to_queue( :param ranked: Whether to add to ranked or unranked queue :return: True if the user was added to the queue, False otherwise. """ - if ( - any(user.id == u.id for _, u in self.unranked_queue) or - any(user.id == u.id for _, _, u in self.ranked_queue) + if any(user.id == u.id for _, u in self.unranked_queue) or any( + user.id == u.id for _, _, u in self.ranked_queue ): return False @@ -58,12 +54,12 @@ async def remove_from_queue(self, user_id: int): :param user_id: The ID of the user to remove from the queue. """ self.unranked_queue = { - (ws, user) for ws, user in self.unranked_queue - if user.id != user_id + (ws, user) for ws, user in self.unranked_queue if user.id != user_id } self.ranked_queue = [ - (rating, ws, user) for rating, ws, user in self.ranked_queue + (rating, ws, user) + for rating, ws, user in self.ranked_queue if user.id != user_id ] @@ -77,7 +73,7 @@ async def get_ranked_match(self) -> Optional[List[Tuple[WebSocket, User]]]: return None # Find the closest pair of ratings - min_diff = float('inf') + min_diff = float("inf") best_pair_idx = None # Compare adjacent pairs in the sorted queue @@ -113,9 +109,7 @@ async def get_random_player(self, count: int = 2) -> List[Tuple[WebSocket, User] return selected_players def get_problem_distribution( - self, - ranked: bool = False, - rating: float = 0 + self, ranked: bool = False, rating: float = 0 ) -> Dict[str, int]: """ Get the problem distribution based on queue type and rating. diff --git a/app/services/game/ranked.py b/app/services/game/ranked.py index 25291fb..a06ce34 100644 --- a/app/services/game/ranked.py +++ b/app/services/game/ranked.py @@ -9,12 +9,8 @@ class RankedService: """ def __init__(self): - thresholds = [ - int(x) for x in settings.RANK_THRESHOLDS.split(",") - ] - names = [ - x.strip() for x in settings.RANK_NAMES.split(",") - ] + thresholds = [int(x) for x in settings.RANK_THRESHOLDS.split(",")] + names = [x.strip() for x in settings.RANK_NAMES.split(",")] self.k_factor = settings.RATING_K_FACTOR # Map thresholds to rank names @@ -26,11 +22,7 @@ def __init__(self): for rank, dist in zip(names, distributions): easy, medium, hard = [int(x) for x in dist.split("-")] - self.rank_problems[rank] = { - "easy": easy, - "medium": medium, - "hard": hard - } + self.rank_problems[rank] = {"easy": easy, "medium": medium, "hard": hard} def get_rank(self, rating: float) -> str: """ @@ -57,10 +49,7 @@ def get_problem_distribution(self, rating: float) -> Dict[str, int]: return self.rank_problems[rank] def calculate_rating_change( - self, - player_rating: float, - opponent_rating: float, - won: bool + self, player_rating: float, opponent_rating: float, won: bool ) -> float: """ Calculate rating change using ELO-like system diff --git a/app/services/game/state.py b/app/services/game/state.py index 10a81ee..1a4541a 100644 --- a/app/services/game/state.py +++ b/app/services/game/state.py @@ -14,6 +14,7 @@ class GameStatus(str, Enum): """ Enum for the status of a game, useful for preventing typos. """ + WAITING = "waiting" IN_PROGRESS = "in_progress" FINISHED = "finished" @@ -36,6 +37,7 @@ class PlayerState(BaseModel): :param mana_points: The mana points (MP) of the player. :param abilities: List of abilities that the player has. """ + user_id: int username: str display_name: str @@ -83,6 +85,7 @@ class GameState(BaseModel): :param winner: The ID of the winner of the game. :param is_cleaning_up: A flag indicating whether the game is cleaning up. """ + id: str status: GameStatus player1: PlayerState @@ -142,5 +145,7 @@ def is_timed_out(self) -> bool: :return: True if the match has timed out, False otherwise. """ elapsed_time = time.time() - self.start_time - timeout = settings.MATCH_TIMEOUT_MINUTES * 60 if not settings.TESTING else 3 * 60 # change when testing (timeout test = 20, normal = 3 * 60) + timeout = ( + settings.MATCH_TIMEOUT_MINUTES * 60 if not settings.TESTING else 3 * 60 + ) # change when testing (timeout test = 20, normal = 3 * 60) return elapsed_time >= timeout diff --git a/app/services/problem/service.py b/app/services/problem/service.py index b1f4fd4..6e02a6f 100644 --- a/app/services/problem/service.py +++ b/app/services/problem/service.py @@ -10,11 +10,10 @@ class ProblemManager: """ A static class to handle all the operations related to fetching and preparing problems for the other services. """ + @staticmethod async def get_random_problems( - db: Session, - difficulty: str, - count: int + db: Session, difficulty: str, count: int ) -> List[Problem]: """ Get a specified number of problems of a specific difficulty level randomly. @@ -34,10 +33,7 @@ async def get_random_problems( ) @staticmethod - async def get_problem_by_id( - db: Session, - problem_id: int - ) -> Optional[Problem]: + async def get_problem_by_id(db: Session, problem_id: int) -> Optional[Problem]: """ Get a problem by its ID. @@ -46,17 +42,11 @@ async def get_problem_by_id( :return: The problem with the specified ID, if it exists. """ - return ( - db.query(Problem) - .filter(Problem.id == problem_id) - .first() - ) + return db.query(Problem).filter(Problem.id == problem_id).first() @staticmethod async def get_problems_by_distribution( - db: Session, - distribution: Dict[str, int], - shuffle: bool = False + db: Session, distribution: Dict[str, int], shuffle: bool = False ) -> List[Problem]: """ Get problems based on the distribution of difficulty levels. @@ -96,7 +86,7 @@ def prepare_problem_for_client(problem: Problem) -> Dict: "java": problem.boilerplate.java, "cpp": problem.boilerplate.cpp, "python": problem.boilerplate.python, - } + }, } @staticmethod @@ -138,7 +128,7 @@ def get_problem_for_validation(problem: Problem) -> Dict: "sample_test_results": [ "false", "true", - ] + ], } return { diff --git a/app/services/room/service.py b/app/services/room/service.py index 909f019..355074b 100644 --- a/app/services/room/service.py +++ b/app/services/room/service.py @@ -11,7 +11,7 @@ from services.room.state import RoomSettings, RoomState, RoomStatus, RoomView -class RoomService(): +class RoomService: """ A service class that handles custom rooms """ @@ -29,10 +29,11 @@ def _generate_room_code(self) -> str: :return: Room code """ while True: - code = code = ''.join(random.choices( - string.ascii_uppercase + string.digits, - k=settings.ROOM_CODE_LENGTH - )) + code = code = "".join( + random.choices( + string.ascii_uppercase + string.digits, k=settings.ROOM_CODE_LENGTH + ) + ) if code not in self.rooms: return code @@ -42,8 +43,13 @@ def _create_default_settings(self) -> RoomSettings: :return: Room settings """ - easy, medium, hard = [float(x) for x in settings.DEFAULT_ROOM_SETTINGS["hp_multiplier"].split(",")] - prob_easy, prob_medium, prob_hard = [float(x) for x in settings.DEFAULT_ROOM_SETTINGS["problem_distribution"].split(",")] + easy, medium, hard = [ + float(x) for x in settings.DEFAULT_ROOM_SETTINGS["hp_multiplier"].split(",") + ] + prob_easy, prob_medium, prob_hard = [ + float(x) + for x in settings.DEFAULT_ROOM_SETTINGS["problem_distribution"].split(",") + ] return RoomSettings( problem_count=settings.DEFAULT_ROOM_SETTINGS["problem_count"], @@ -58,7 +64,7 @@ def _create_default_settings(self) -> RoomSettings: prob_hard=prob_hard, starting_sp=settings.STARTING_SP, starting_mp=settings.STARTING_MP, - mana_recharge=settings.MANA_RECHARGE + mana_recharge=settings.MANA_RECHARGE, ) async def _get_user(self, user_id: int) -> User: @@ -96,10 +102,7 @@ async def _send_room_list(self, ws: WebSocket): room_list = await self._generate_room_list() try: - await ws.send_json({ - "type": "room_list", - "rooms": room_list - }) + await ws.send_json({"type": "room_list", "rooms": room_list}) except: self.lobby_connections.discard(ws) raise @@ -116,13 +119,15 @@ async def _generate_room_list(self) -> List[Dict]: for room in public_rooms: try: host = await self._get_user(room.host_id) - room_list.append({ - "room_code": room.room_code, - "host_name": host.username, - "host_display_name": host.display_name, - "settings": room.settings.model_dump(), - "player_count": 2 if room.guest_id else 1 - }) + room_list.append( + { + "room_code": room.room_code, + "host_name": host.username, + "host_display_name": host.display_name, + "settings": room.settings.model_dump(), + "player_count": 2 if room.guest_id else 1, + } + ) except: continue @@ -132,7 +137,7 @@ def create_room( self, host: User, is_public: bool = True, - settings: Optional[RoomSettings] = None + settings: Optional[RoomSettings] = None, ) -> RoomState: """ Create a new room @@ -188,7 +193,8 @@ def get_public_rooms(self) -> List[RoomState]: :return: List of public rooms """ return [ - room for room in self.rooms.values() + room + for room in self.rooms.values() if room.is_public and room.status == RoomStatus.WAITING ] @@ -214,7 +220,7 @@ def create_room_view(self, room: RoomState, users: Dict[int, User]) -> RoomView: status=room.status, settings=room.settings, host_ready=room.host_ready, - guest_ready=room.guest_ready if room.guest_id else None + guest_ready=room.guest_ready if room.guest_id else None, ) async def add_lobby_connection(self, ws: WebSocket): @@ -254,10 +260,7 @@ async def broadcast_room_list(self): dead_connections = set() for ws in self.lobby_connections: try: - await ws.send_json({ - "type": "room_list", - "rooms": room_list - }) + await ws.send_json({"type": "room_list", "rooms": room_list}) except: dead_connections.add(ws) diff --git a/app/services/room/state.py b/app/services/room/state.py index 1d633f8..6d70831 100644 --- a/app/services/room/state.py +++ b/app/services/room/state.py @@ -9,6 +9,7 @@ class RoomStatus(str, Enum): """ Enum for room status """ + WAITING = "waiting" IN_GAME = "in_game" @@ -28,6 +29,7 @@ class RoomSettings(BaseModel): :param prob_medium: Probability of a medium problem :param prob_hard: Probability of a hard problem """ + problem_count: int starting_hp: int base_hp_deduction: int @@ -46,7 +48,9 @@ class RoomSettings(BaseModel): def validate_problem_count(cls, v): min_count, max_count = 1, 10 if not (min_count <= v <= max_count): - raise ValueError(f"Problem count must be between {min_count} and {max_count}") + raise ValueError( + f"Problem count must be between {min_count} and {max_count}" + ) return v @field_validator("starting_hp") @@ -60,14 +64,18 @@ def validate_starting_hp(cls, v): def validate_base_hp_deduction(cls, v): min_deduction, max_deduction = 1, 100 if not (min_deduction <= v <= max_deduction): - raise ValueError(f"Base HP deduction must be between {min_deduction} and {max_deduction}") + raise ValueError( + f"Base HP deduction must be between {min_deduction} and {max_deduction}" + ) return v @field_validator("hp_multiplier_easy", "hp_multiplier_medium", "hp_multiplier_hard") def validate_hp_multiplier(cls, v): min_multiplier, max_multiplier = 0.1, 10.0 if not (min_multiplier <= v <= max_multiplier): - raise ValueError(f"HP multiplier must be between {min_multiplier} and {max_multiplier}") + raise ValueError( + f"HP multiplier must be between {min_multiplier} and {max_multiplier}" + ) return v @field_validator("prob_easy", "prob_medium", "prob_hard") @@ -80,10 +88,10 @@ def validate_prob(cls, v): @field_validator("prob_hard") def validate_prob_sum(cls, v, info): values = info.data - if 'prob_easy' in values and 'prob_medium' in values: - total = values['prob_easy'] + values['prob_medium'] + v + if "prob_easy" in values and "prob_medium" in values: + total = values["prob_easy"] + values["prob_medium"] + v if not (0.99 <= total <= 1.01): # Allow small floating point errors - raise ValueError('Probabilities must sum to 1') + raise ValueError("Probabilities must sum to 1") return v @field_validator("starting_sp") @@ -104,7 +112,9 @@ def validate_starting_mp(cls, v): def validate_mana_recharge(cls, v): min_recharge, max_recharge = 0, 500 if not (min_recharge <= v <= max_recharge): - raise ValueError(f"Mana recharge must be between {min_recharge} and {max_recharge}") + raise ValueError( + f"Mana recharge must be between {min_recharge} and {max_recharge}" + ) return v @@ -124,6 +134,7 @@ class RoomState(BaseModel): :param guest_ws: Guest websocket :param guest_id: Guest user ID """ + room_code: str host_id: int is_public: bool @@ -253,6 +264,7 @@ class RoomView(BaseModel): :param host_ready: Whether the host is ready :param guest_ready: Whether the guest is ready """ + room_code: str host_name: str host_display_name: str diff --git a/app/tests/integration/auth_test.py b/app/tests/integration/auth_test.py index fa9192d..32228e9 100644 --- a/app/tests/integration/auth_test.py +++ b/app/tests/integration/auth_test.py @@ -1,4 +1,3 @@ - import os import subprocess import sys @@ -14,15 +13,10 @@ # Important: Make sure server is in test mode. assert settings.TESTING, "Server is not in testing mode" # Clear database before hand with "python -m db.init --droptest" -subprocess.run( - ["python", "-m", "db.init", "--droptest"], - stdout=subprocess.DEVNULL -) +subprocess.run(["python", "-m", "db.init", "--droptest"], stdout=subprocess.DEVNULL) # Global Variables -SKIP = [ - -] +SKIP = [] print(f"Skipping tests: {SKIP}") # 1. Register a new user @@ -38,7 +32,11 @@ # 2. Register another user with same username or password if 2 not in SKIP: - print("Running test 2: Register another user with same username or password", end=" ", flush=True) + print( + "Running test 2: Register another user with same username or password", + end=" ", + flush=True, + ) broken_user1 = register_user("jdoe", "john@email.com", "password", "John Doe") assert broken_user1["detail"] == "Username already exists" broken_user1 = register_user("john", "jdoe@email.com", "password", "John Doe") @@ -167,7 +165,11 @@ # 10. Checking validity of access and refresh tokens after password change, user delete, logout if 10 not in SKIP: - print("Running test 10: Checking validity of access and refresh tokens after password change, user delete, logout", end=" ", flush=True) + print( + "Running test 10: Checking validity of access and refresh tokens after password change, user delete, logout", + end=" ", + flush=True, + ) register_user("user5", "user5@email.com", "password", "User Five") verify_email("test_email_token") user5 = login_user("user5", "password") diff --git a/app/tests/integration/functions.py b/app/tests/integration/functions.py index 1c1ee43..f0a93f7 100644 --- a/app/tests/integration/functions.py +++ b/app/tests/integration/functions.py @@ -28,7 +28,7 @@ def register_user(username, email, password, display_name): "username": username, "email": email, "password": password, - "display_name": display_name + "display_name": display_name, } response = requests.post(url, json=data) @@ -37,10 +37,7 @@ def register_user(username, email, password, display_name): def login_user(username, password): url = f"{BASE_URL}{API_MAP['login']}" - data = { - "username": username, - "password": password - } + data = {"username": username, "password": password} response = requests.post(url, data=data) return response.json() @@ -55,9 +52,7 @@ def verify_email(token): def get_user(access_token): url = f"{BASE_URL}{API_MAP['user']}" - headers = { - 'Authorization': f'Bearer {access_token}' - } + headers = {"Authorization": f"Bearer {access_token}"} response = requests.get(url, headers=headers) return response.json() @@ -65,9 +60,7 @@ def get_user(access_token): def update_user(access_token, data): url = f"{BASE_URL}{API_MAP['user']}" - headers = { - 'Authorization': f'Bearer {access_token}' - } + headers = {"Authorization": f"Bearer {access_token}"} response = requests.patch(url, headers=headers, json=data) return response.json() @@ -75,18 +68,14 @@ def update_user(access_token, data): def delete_user(access_token): url = f"{BASE_URL}{API_MAP['user']}" - headers = { - 'Authorization': f'Bearer {access_token}' - } + headers = {"Authorization": f"Bearer {access_token}"} response = requests.delete(url, headers=headers) def forgot_password(email): url = f"{BASE_URL}{API_MAP['forgot']}" - data = { - "email": email - } + data = {"email": email} response = requests.post(url, json=data) return response.json() @@ -94,10 +83,7 @@ def forgot_password(email): def reset_password(token, password): url = f"{BASE_URL}{API_MAP['reset']}" - data = { - "token": token, - "new_password": password - } + data = {"token": token, "new_password": password} response = requests.post(url, json=data) return response.json() @@ -105,9 +91,7 @@ def reset_password(token, password): def refresh_token(refresh_token): url = f"{BASE_URL}{API_MAP['refresh']}" - data = { - "refresh_token": refresh_token - } + data = {"refresh_token": refresh_token} response = requests.post(url, json=data) return response.json() @@ -115,12 +99,8 @@ def refresh_token(refresh_token): def logout_user(access_token, refresh_token): url = f"{BASE_URL}{API_MAP['logout']}" - headers = { - 'Authorization': f'Bearer {access_token}' - } - data = { - "refresh_token": refresh_token - } + headers = {"Authorization": f"Bearer {access_token}"} + data = {"refresh_token": refresh_token} response = requests.post(url, headers=headers, json=data) return response.json() @@ -142,11 +122,13 @@ async def make_user(username, email, password, display_name): "username": username, "email": email, "password": password, - "display_name": display_name + "display_name": display_name, } response = session.post(registration_url, json=data) session.get(verify_url + "/test_email_token") - response = session.post(login_url, data={"username": username, "password": password}) + response = session.post( + login_url, data={"username": username, "password": password} + ) access_token = response.json()["access_token"] return {"Authorization": f"Bearer {access_token}"} @@ -188,41 +170,27 @@ async def send_forfeit(ws: websockets.WebSocketClientProtocol): async def send_chat(ws: websockets.WebSocketClientProtocol, message: str): - return await ws.send(json.dumps({ - "type": "chat", - "data": { - "message": message - } - })) + return await ws.send(json.dumps({"type": "chat", "data": {"message": message}})) async def send_code(ws: websockets.WebSocketClientProtocol, code: str): - return await ws.send(json.dumps({ - "type": "submit", - "data": { - "code": code - } - })) + return await ws.send(json.dumps({"type": "submit", "data": {"code": code}})) async def buy_ability(ws: websockets.WebSocketClientProtocol, ability_id: str): - return await ws.send(json.dumps({ - "type": "ability", - "data": { - "action": "buy", - "ability_id": ability_id - } - })) + return await ws.send( + json.dumps( + {"type": "ability", "data": {"action": "buy", "ability_id": ability_id}} + ) + ) async def use_ability(ws: websockets.WebSocketClientProtocol, ability_id: str): - return await ws.send(json.dumps({ - "type": "ability", - "data": { - "action": "use", - "ability_id": ability_id - } - })) + return await ws.send( + json.dumps( + {"type": "ability", "data": {"action": "use", "ability_id": ability_id}} + ) + ) async def create_room(auth_headers, session, settings=None, is_public=None): @@ -256,9 +224,12 @@ async def update_room_settings(room_code: str, auth_headers, session, settings=N async def leave_room(room_code: str, auth_headers: dict): - async with websockets.connect(f"{WS_BASE_URL}/rooms/{room_code}", subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + f"{WS_BASE_URL}/rooms/{room_code}", + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await ws.close() def extract_token(auth_header): - return auth_header['Authorization'].split(" ")[1] + return auth_header["Authorization"].split(" ")[1] diff --git a/app/tests/integration/game_test.py b/app/tests/integration/game_test.py index d836ea2..f57009b 100644 --- a/app/tests/integration/game_test.py +++ b/app/tests/integration/game_test.py @@ -19,16 +19,11 @@ # Important: Make sure server is in test mode. assert settings.TESTING, "Server is not in testing mode" # Clear database before hand with "python -m db.init --droptest" -subprocess.run( - ["python", "-m", "db.init", "--droptest"], - stdout=subprocess.DEVNULL -) +subprocess.run(["python", "-m", "db.init", "--droptest"], stdout=subprocess.DEVNULL) # Global Variables -SKIP = [ - -] +SKIP = [] print(f"Skipping tests: {SKIP}") # Test 1 @@ -36,20 +31,30 @@ print("Running test 1: /queue and /ranked-queue endpoints", end=" ", flush=True) async def test1(): - auth_headers = await make_user("test1", "test1@email.com", "password", "Test User 1") + auth_headers = await make_user( + "test1", "test1@email.com", "password", "Test User 1" + ) test1_access2 = login_user("test1", "password")["access_token"] auth_headers_2 = {"Authorization": f"Bearer {test1_access2}"} - auth_headers2 = await make_user("test2", "test2@email.com", "password", "Test User 2") - auth_headers3 = await make_user("test3", "test3@email.com", "password", "Test User 3") - auth_headers4 = await make_user("test4", "test4@email.com", "password", "Test User 4") + auth_headers2 = await make_user( + "test2", "test2@email.com", "password", "Test User 2" + ) + auth_headers3 = await make_user( + "test3", "test3@email.com", "password", "Test User 3" + ) + auth_headers4 = await make_user( + "test4", "test4@email.com", "password", "Test User 4" + ) unranked_queue_url = f"{WS_BASE_URL}{API_MAP['queue']}" ranked_queue_url = f"{WS_BASE_URL}{API_MAP['queue_ranked']}" # Join queue with valid access token try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: assert True @@ -57,8 +62,10 @@ async def test1(): assert False try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: assert True @@ -68,8 +75,10 @@ async def test1(): # Join queue with invalid access token fake_headers = {"Authorization": "Bearer fake_token"} try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(fake_headers)}"]) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(fake_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: assert e.code == 4001 @@ -77,8 +86,10 @@ async def test1(): assert False try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(fake_headers)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(fake_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: assert e.code == 4001 @@ -104,10 +115,14 @@ async def test1(): # Join queue when already in queue (same access token) try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: assert e.code == 4000 @@ -115,10 +130,14 @@ async def test1(): assert False try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: assert e.code == 4000 @@ -127,10 +146,14 @@ async def test1(): # Join queue when already in queue (different access token) try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers_2)}"]) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers_2)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: assert e.code == 4000 @@ -138,10 +161,14 @@ async def test1(): assert False try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers_2)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers_2)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: assert e.code == 4000 @@ -150,10 +177,14 @@ async def test1(): # Join unranked queue when already in ranked queue and vice versa try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: assert e.code == 4000 @@ -161,10 +192,14 @@ async def test1(): assert False try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: assert e.code == 4000 @@ -173,15 +208,19 @@ async def test1(): # Leave queue and rejoin try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: try: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: pass - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: assert True @@ -189,15 +228,19 @@ async def test1(): assert False try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: try: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: pass - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: assert True @@ -206,22 +249,28 @@ async def test1(): # Join queue on one connection, leave and join on another try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: try: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: pass - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers_2)}"]) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers_2)}"], + ) as ws: try: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: pass - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers_2)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers_2)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: assert True @@ -229,22 +278,28 @@ async def test1(): assert False try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: try: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: pass - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers_2)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers_2)}"], + ) as ws: try: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: pass - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers_2)}"]) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers_2)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: assert True @@ -253,30 +308,38 @@ async def test1(): # Join queue when already in a match and then join queue after finishing a match try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws1: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers2)}"]) as ws2: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws1: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ) as ws2: response = await ws1.recv() match_id = json.loads(response)["data"]["match_id"] - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: assert e.code == 4000 except Exception: assert False finally: - async with websockets.connect(f"{WS_BASE_URL}/game/play/{match_id}", - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as game_ws: - await game_ws.send(json.dumps({ - "type": "forfeit" - })) + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{match_id}", + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as game_ws: + await game_ws.send(json.dumps({"type": "forfeit"})) try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: assert True @@ -284,30 +347,38 @@ async def test1(): assert False try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws1: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers2)}"]) as ws2: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws1: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ) as ws2: response = await ws1.recv() match_id = json.loads(response)["data"]["match_id"] - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: assert e.code == 4000 except Exception: assert False finally: - async with websockets.connect(f"{WS_BASE_URL}/game/play/{match_id}", - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as game_ws: - await game_ws.send(json.dumps({ - "type": "forfeit" - })) + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{match_id}", + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as game_ws: + await game_ws.send(json.dumps({"type": "forfeit"})) try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except TimeoutError: assert True @@ -316,49 +387,69 @@ async def test1(): # Join queue as 2 players and get matched try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws1: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers2)}"]) as ws2: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws1: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ) as ws2: response1 = await ws1.recv() response2 = await ws2.recv() - assert json.loads(response1)["data"]["match_id"] == json.loads(response2)["data"]["match_id"] + assert ( + json.loads(response1)["data"]["match_id"] + == json.loads(response2)["data"]["match_id"] + ) match_id = json.loads(response1)["data"]["match_id"] - async with websockets.connect(f"{WS_BASE_URL}/game/play/{match_id}", - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as game_ws: - await game_ws.send(json.dumps({ - "type": "forfeit" - })) + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{match_id}", + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as game_ws: + await game_ws.send(json.dumps({"type": "forfeit"})) except Exception: assert False try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws1: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers2)}"]) as ws2: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws1: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ) as ws2: response1 = await ws1.recv() response2 = await ws2.recv() - assert json.loads(response1)["data"]["match_id"] == json.loads(response2)["data"]["match_id"] + assert ( + json.loads(response1)["data"]["match_id"] + == json.loads(response2)["data"]["match_id"] + ) match_id = json.loads(response1)["data"]["match_id"] - async with websockets.connect(f"{WS_BASE_URL}/game/play/{match_id}", - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as game_ws: - await game_ws.send(json.dumps({ - "type": "forfeit" - })) + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{match_id}", + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as game_ws: + await game_ws.send(json.dumps({"type": "forfeit"})) except Exception: assert False # Join queue as 3 players and 2 get matched try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws1: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers2)}"]) as ws2: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers3)}"]) as ws3: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws1: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ) as ws2: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers3)}"], + ) as ws3: response1 = None response2 = None response3 = None @@ -376,7 +467,9 @@ async def test1(): for i in range(3): if responses[i]: valid_indexes.append(i) - user_to_match_id[json.loads(responses[i])["data"]["match_id"]] = i + user_to_match_id[ + json.loads(responses[i])["data"]["match_id"] + ] = i assert len(valid_indexes) == 2 assert len(user_to_match_id) == 1 @@ -385,22 +478,30 @@ async def test1(): match_id = list(user_to_match_id.keys())[0] user_index1 = user_to_match_id[match_id] - async with websockets.connect(f"{WS_BASE_URL}/game/play/{match_id}", - subprotocols=[f"access_token|{extract_token(auth_headers_list[user_index1])}"]) as game_ws: - await game_ws.send(json.dumps({ - "type": "forfeit" - })) + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{match_id}", + subprotocols=[ + f"access_token|{extract_token(auth_headers_list[user_index1])}" + ], + ) as game_ws: + await game_ws.send(json.dumps({"type": "forfeit"})) except Exception: assert False try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws1: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers2)}"]) as ws2: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers3)}"]) as ws3: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws1: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ) as ws2: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers3)}"], + ) as ws3: response1 = None response2 = None response3 = None @@ -418,7 +519,9 @@ async def test1(): for i in range(3): if responses[i]: valid_indexes.append(i) - user_to_match_id[json.loads(responses[i])["data"]["match_id"]] = i + user_to_match_id[ + json.loads(responses[i])["data"]["match_id"] + ] = i assert len(valid_indexes) == 2 assert len(user_to_match_id) == 1 @@ -427,34 +530,55 @@ async def test1(): match_id = list(user_to_match_id.keys())[0] user_index1 = user_to_match_id[match_id] - async with websockets.connect(f"{WS_BASE_URL}/game/play/{match_id}", - subprotocols=[f"access_token|{extract_token(auth_headers_list[user_index1])}"]) as game_ws: - await game_ws.send(json.dumps({ - "type": "forfeit" - })) + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{match_id}", + subprotocols=[ + f"access_token|{extract_token(auth_headers_list[user_index1])}" + ], + ) as game_ws: + await game_ws.send(json.dumps({"type": "forfeit"})) except Exception: assert False # Join queue as 4 players and all 4 get matched try: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws1: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers2)}"]) as ws2: - async with websockets.connect(unranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers3)}"]) as ws3: - async with websockets.connect(unranked_queue_url, subprotocols=[f"access_token|{extract_token(auth_headers4)}"]) as ws4: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws1: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ) as ws2: + async with websockets.connect( + unranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers3)}"], + ) as ws3: + async with websockets.connect( + unranked_queue_url, + subprotocols=[ + f"access_token|{extract_token(auth_headers4)}" + ], + ) as ws4: response1 = None response2 = None response3 = None response4 = None try: - response1 = await asyncio.wait_for(ws1.recv(), timeout=5) - response2 = await asyncio.wait_for(ws2.recv(), timeout=5) - response3 = await asyncio.wait_for(ws3.recv(), timeout=5) - response4 = await asyncio.wait_for(ws4.recv(), timeout=5) + response1 = await asyncio.wait_for( + ws1.recv(), timeout=5 + ) + response2 = await asyncio.wait_for( + ws2.recv(), timeout=5 + ) + response3 = await asyncio.wait_for( + ws3.recv(), timeout=5 + ) + response4 = await asyncio.wait_for( + ws4.recv(), timeout=5 + ) except TimeoutError: pass @@ -464,50 +588,80 @@ async def test1(): for i in range(4): if responses[i]: valid_indexes.append(i) - user_to_match_id[json.loads(responses[i])["data"]["match_id"]] = i + user_to_match_id[ + json.loads(responses[i])["data"]["match_id"] + ] = i assert len(valid_indexes) == 4 assert len(user_to_match_id) == 2 - auth_headers_list = [auth_headers, auth_headers2, auth_headers3, auth_headers4] + auth_headers_list = [ + auth_headers, + auth_headers2, + auth_headers3, + auth_headers4, + ] match_id_1 = list(user_to_match_id.keys())[0] user_index1 = user_to_match_id[match_id_1] match_id_2 = list(user_to_match_id.keys())[1] user_index2 = user_to_match_id[match_id_2] - async with websockets.connect(f"{WS_BASE_URL}/game/play/{match_id_1}", - subprotocols=[f"access_token|{extract_token(auth_headers_list[user_index1])}"]) as game_ws: - await game_ws.send(json.dumps({ - "type": "forfeit" - })) - - async with websockets.connect(f"{WS_BASE_URL}/game/play/{match_id_2}", - subprotocols=[f"access_token|{extract_token(auth_headers_list[user_index2])}"]) as game_ws: - await game_ws.send(json.dumps({ - "type": "forfeit" - })) + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{match_id_1}", + subprotocols=[ + f"access_token|{extract_token(auth_headers_list[user_index1])}" + ], + ) as game_ws: + await game_ws.send(json.dumps({"type": "forfeit"})) + + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{match_id_2}", + subprotocols=[ + f"access_token|{extract_token(auth_headers_list[user_index2])}" + ], + ) as game_ws: + await game_ws.send(json.dumps({"type": "forfeit"})) except Exception: assert False try: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers)}"]) as ws1: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers2)}"]) as ws2: - async with websockets.connect(ranked_queue_url, - subprotocols=[f"access_token|{extract_token(auth_headers3)}"]) as ws3: - async with websockets.connect(ranked_queue_url, subprotocols=[f"access_token|{extract_token(auth_headers4)}"]) as ws4: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers)}"], + ) as ws1: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ) as ws2: + async with websockets.connect( + ranked_queue_url, + subprotocols=[f"access_token|{extract_token(auth_headers3)}"], + ) as ws3: + async with websockets.connect( + ranked_queue_url, + subprotocols=[ + f"access_token|{extract_token(auth_headers4)}" + ], + ) as ws4: response1 = None response2 = None response3 = None response4 = None try: - response1 = await asyncio.wait_for(ws1.recv(), timeout=5) - response2 = await asyncio.wait_for(ws2.recv(), timeout=5) - response3 = await asyncio.wait_for(ws3.recv(), timeout=5) - response4 = await asyncio.wait_for(ws4.recv(), timeout=5) + response1 = await asyncio.wait_for( + ws1.recv(), timeout=5 + ) + response2 = await asyncio.wait_for( + ws2.recv(), timeout=5 + ) + response3 = await asyncio.wait_for( + ws3.recv(), timeout=5 + ) + response4 = await asyncio.wait_for( + ws4.recv(), timeout=5 + ) except TimeoutError: pass @@ -517,28 +671,39 @@ async def test1(): for i in range(4): if responses[i]: valid_indexes.append(i) - user_to_match_id[json.loads(responses[i])["data"]["match_id"]] = i + user_to_match_id[ + json.loads(responses[i])["data"]["match_id"] + ] = i assert len(valid_indexes) == 4 assert len(user_to_match_id) == 2 - auth_headers_list = [auth_headers, auth_headers2, auth_headers3, auth_headers4] + auth_headers_list = [ + auth_headers, + auth_headers2, + auth_headers3, + auth_headers4, + ] match_id_1 = list(user_to_match_id.keys())[0] user_index1 = user_to_match_id[match_id_1] match_id_2 = list(user_to_match_id.keys())[1] user_index2 = user_to_match_id[match_id_2] - async with websockets.connect(f"{WS_BASE_URL}/game/play/{match_id_1}", - subprotocols=[f"access_token|{extract_token(auth_headers_list[user_index1])}"]) as game_ws: - await game_ws.send(json.dumps({ - "type": "forfeit" - })) - - async with websockets.connect(f"{WS_BASE_URL}/game/play/{match_id_2}", - subprotocols=[f"access_token|{extract_token(auth_headers_list[user_index2])}"]) as game_ws: - await game_ws.send(json.dumps({ - "type": "forfeit" - })) + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{match_id_1}", + subprotocols=[ + f"access_token|{extract_token(auth_headers_list[user_index1])}" + ], + ) as game_ws: + await game_ws.send(json.dumps({"type": "forfeit"})) + + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{match_id_2}", + subprotocols=[ + f"access_token|{extract_token(auth_headers_list[user_index2])}" + ], + ) as game_ws: + await game_ws.send(json.dumps({"type": "forfeit"})) except Exception: assert False @@ -552,43 +717,56 @@ async def test1(): print("Running test 2: /game endpoint", end=" ", flush=True) async def test2(): - p1_auth_headers = await make_user("player1", "player1@email.com", "password", "Player 1") - p2_auth_headers = await make_user("player2", "player2@email.com", "password", "Player 2") - p3_auth_headers = await make_user("player3", "player3@email.com", "password", "Player 3") - p4_auth_headers = await make_user("player4", "player4@email.com", "password", "Player 4") + p1_auth_headers = await make_user( + "player1", "player1@email.com", "password", "Player 1" + ) + p2_auth_headers = await make_user( + "player2", "player2@email.com", "password", "Player 2" + ) + p3_auth_headers = await make_user( + "player3", "player3@email.com", "password", "Player 3" + ) + p4_auth_headers = await make_user( + "player4", "player4@email.com", "password", "Player 4" + ) unranked_queue_url = f"{WS_BASE_URL}{API_MAP['queue']}" ranked_queue_url = f"{WS_BASE_URL}{API_MAP['queue_ranked']}" game_url = f"{WS_BASE_URL}/game/play/" ERROR_SOLUTION = "class Solution:\r\n def NOTTEST(self, inp: bool) -> bool:\r\n return not inp" - NONE_SOLUTION = "class Solution:\r\n def test(self, inp: bool) -> bool:\r\n return inp" + NONE_SOLUTION = ( + "class Solution:\r\n def test(self, inp: bool) -> bool:\r\n return inp" + ) SOME_SOLUTION1 = "class Solution:\r\n def test(self, inp: bool) -> bool:\r\n return False" - SOME_SOLUTION2 = "class Solution:\r\n def test(self, inp: bool) -> bool:\r\n return True" + SOME_SOLUTION2 = ( + "class Solution:\r\n def test(self, inp: bool) -> bool:\r\n return True" + ) ALL_SOLUTION = "class Solution:\r\n def test(self, inp: bool) -> bool:\r\n return not inp" try: # Join queue as 2 players and get matched async with websockets.connect( unranked_queue_url, - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as q1: async with websockets.connect( unranked_queue_url, - subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"], ) as q2: response1 = await q1.recv() response2 = await q2.recv() - assert json.loads(response1)["data"]["match_id"] == json.loads(response2)["data"]["match_id"] + assert ( + json.loads(response1)["data"]["match_id"] + == json.loads(response2)["data"]["match_id"] + ) match_id = json.loads(response1)["data"]["match_id"] # Join with no access token try: - async with websockets.connect( - f"{game_url}{match_id}" - ) as ws: + async with websockets.connect(f"{game_url}{match_id}") as ws: await asyncio.wait_for(ws.recv(), timeout=1) except InvalidStatusCode as e: # 403 assert e.status_code == 403 @@ -600,7 +778,7 @@ async def test2(): try: async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(fake_headers)}"] + subprotocols=[f"access_token|{extract_token(fake_headers)}"], ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: @@ -612,7 +790,7 @@ async def test2(): try: async with websockets.connect( f"{game_url}fake", - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: @@ -624,7 +802,7 @@ async def test2(): try: async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p3_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p3_auth_headers)}"], ) as ws: await asyncio.wait_for(ws.recv(), timeout=1) except ConnectionClosedError as e: @@ -636,11 +814,11 @@ async def test2(): try: async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as ws1: async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as ws2: await asyncio.wait_for(ws1.recv(), timeout=5) await asyncio.wait_for(ws2.recv(), timeout=5) @@ -653,21 +831,21 @@ async def test2(): try: async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as p1: response = await asyncio.wait_for(p1.recv(), timeout=5) assert json.loads(response)["data"]["status"] == "waiting" async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as p1: p1_response = await asyncio.wait_for(p1.recv(), timeout=5) assert json.loads(p1_response)["data"]["status"] == "waiting" async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"], ) as p2: p1_response = await asyncio.wait_for(p1.recv(), timeout=5) assert json.loads(p1_response)["type"] == "game_start" @@ -682,22 +860,22 @@ async def test2(): async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as p1: async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"], ) as p2: await get_latest_message(p1) await get_latest_message(p2) async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as p1: async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"], ) as p2: # Game state is in-progress every rejoin p1_resp = await asyncio.wait_for(p1.recv(), timeout=5) @@ -714,13 +892,21 @@ async def test2(): p1_resp = await get_latest_message(p1) assert p1_resp["type"] == "chat" assert p1_resp["data"]["message"] == "Test" - assert curtime - 2 <= round(p1_resp["data"]["timestamp"]) <= curtime + 2 + assert ( + curtime - 2 + <= round(p1_resp["data"]["timestamp"]) + <= curtime + 2 + ) assert p1_resp["data"]["sender"] == "player1" p2_resp = await get_latest_message(p2) assert p2_resp["type"] == "chat" assert p2_resp["data"]["message"] == "Test" - assert curtime - 2 <= round(p2_resp["data"]["timestamp"]) <= curtime + 2 + assert ( + curtime - 2 + <= round(p2_resp["data"]["timestamp"]) + <= curtime + 2 + ) assert p2_resp["data"]["sender"] == "player1" # Query to get game state @@ -820,26 +1006,29 @@ async def test2(): try: async with websockets.connect( ranked_queue_url, - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as q1: async with websockets.connect( ranked_queue_url, - subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"], ) as q2: response1 = await q1.recv() response2 = await q2.recv() - assert json.loads(response1)["data"]["match_id"] == json.loads(response2)["data"]["match_id"] + assert ( + json.loads(response1)["data"]["match_id"] + == json.loads(response2)["data"]["match_id"] + ) match_id = json.loads(response1)["data"]["match_id"] async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as p1: async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"], ) as p2: await send_code(p1, ALL_SOLUTION) await asyncio.sleep(3) @@ -866,26 +1055,29 @@ async def test2(): try: async with websockets.connect( ranked_queue_url, - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as q1: async with websockets.connect( ranked_queue_url, - subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"], ) as q2: response1 = await q1.recv() response2 = await q2.recv() - assert json.loads(response1)["data"]["match_id"] == json.loads(response2)["data"]["match_id"] + assert ( + json.loads(response1)["data"]["match_id"] + == json.loads(response2)["data"]["match_id"] + ) match_id = json.loads(response1)["data"]["match_id"] async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as p1: async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"], ) as p2: await send_code(p1, ALL_SOLUTION) await send_forfeit(p1) @@ -1008,8 +1200,12 @@ async def test2(): print("Running test 3: /current-game endpoint", end=" ", flush=True) async def test3(): - p1_auth_headers = await make_user("skibidi1", "skibidi1@email.com", "password", "Skibidi 1") - p2_auth_headers = await make_user("skibidi2", "skibidi2@email.com", "password", "Skibidi 2") + p1_auth_headers = await make_user( + "skibidi1", "skibidi1@email.com", "password", "Skibidi 1" + ) + p2_auth_headers = await make_user( + "skibidi2", "skibidi2@email.com", "password", "Skibidi 2" + ) ranked_queue_url = f"{WS_BASE_URL}{API_MAP['queue_ranked']}" game_url = f"{WS_BASE_URL}/game/play/" @@ -1021,16 +1217,19 @@ async def test3(): try: async with websockets.connect( ranked_queue_url, - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as q1: async with websockets.connect( ranked_queue_url, - subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"], ) as q2: response1 = await q1.recv() response2 = await q2.recv() - assert json.loads(response1)["data"]["match_id"] == json.loads(response2)["data"]["match_id"] + assert ( + json.loads(response1)["data"]["match_id"] + == json.loads(response2)["data"]["match_id"] + ) match_id = json.loads(response1)["data"]["match_id"] @@ -1043,11 +1242,11 @@ async def test3(): async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p1_auth_headers)}"], ) as p1: async with websockets.connect( f"{game_url}{match_id}", - subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"] + subprotocols=[f"access_token|{extract_token(p2_auth_headers)}"], ) as p2: cur_game1 = await get_current_game(p1_auth_headers) cur_game2 = await get_current_game(p2_auth_headers) diff --git a/app/tests/integration/room_test.py b/app/tests/integration/room_test.py index 88c460b..61fb42f 100644 --- a/app/tests/integration/room_test.py +++ b/app/tests/integration/room_test.py @@ -18,15 +18,10 @@ # Important: Make sure server is in test mode. assert settings.TESTING, "Server is not in testing mode" # Clear database before hand with "python -m db.init --droptest" -subprocess.run( - ["python", "-m", "db.init", "--droptest"], - stdout=subprocess.DEVNULL -) +subprocess.run(["python", "-m", "db.init", "--droptest"], stdout=subprocess.DEVNULL) # Global Variables -SKIP = [ - -] +SKIP = [] print(f"Skipping tests: {SKIP}") # Test 1 @@ -34,8 +29,12 @@ print("Running test 1: Room Creation Tests", end=" ", flush=True) async def test1(): - auth_headers1 = await make_user("rtest1", "rtest1@email.com", "password", "RTester 1") - auth_headers2 = await make_user("rtest2", "rtest2@email.com", "password", "RTester 2") + auth_headers1 = await make_user( + "rtest1", "rtest1@email.com", "password", "RTester 1" + ) + auth_headers2 = await make_user( + "rtest2", "rtest2@email.com", "password", "RTester 2" + ) session = requests.Session() @@ -64,7 +63,6 @@ async def test1(): "starting_sp": 200, "starting_mp": 200, "mana_recharge": 50, - } room_data3 = await create_room(auth_headers2, session, settings=custom_settings) assert "room_code" in room_data3 @@ -108,7 +106,9 @@ async def test1(): print("Running test 2: Room Fetching Tests", end=" ", flush=True) async def test2(): - auth_headers = await make_user("rtest3", "rtest3@email.com", "password", "RTester 3") + auth_headers = await make_user( + "rtest3", "rtest3@email.com", "password", "RTester 3" + ) session = requests.Session() # Create a room @@ -134,8 +134,12 @@ async def test2(): print("Running test 3: Room Settings Update Tests", end=" ", flush=True) async def test3(): - auth_headers1 = await make_user("rtest4", "rtest4@email.com", "password", "RTester 4") - auth_headers2 = await make_user("rtest5", "rtest5@email.com", "password", "RTester 5") + auth_headers1 = await make_user( + "rtest4", "rtest4@email.com", "password", "RTester 4" + ) + auth_headers2 = await make_user( + "rtest5", "rtest5@email.com", "password", "RTester 5" + ) session = requests.Session() # Create a room @@ -158,21 +162,33 @@ async def test3(): "starting_mp": 200, "mana_recharge": 50, } - update_result = await update_room_settings(room_code, auth_headers1, session, new_settings) + update_result = await update_room_settings( + room_code, auth_headers1, session, new_settings + ) - assert "message" in update_result and update_result["message"] == "Settings updated successfully" + assert ( + "message" in update_result + and update_result["message"] == "Settings updated successfully" + ) room_info = await get_room(room_code, auth_headers1) assert room_info["settings"] == new_settings # Test: Update as non-host - update_result = await update_room_settings(room_code, auth_headers2, session, new_settings) - assert "detail" in update_result and update_result["detail"] == "Only the host can update room settings" + update_result = await update_room_settings( + room_code, auth_headers2, session, new_settings + ) + assert ( + "detail" in update_result + and update_result["detail"] == "Only the host can update room settings" + ) await leave_room(room_code, auth_headers1) # Test: Update non-existent room - update_result = await update_room_settings("INVALID", auth_headers1, session, new_settings) + update_result = await update_room_settings( + "INVALID", auth_headers1, session, new_settings + ) assert "detail" in update_result and update_result["detail"] == "Room not found" asyncio.run(test3()) @@ -183,14 +199,20 @@ async def test3(): print("Running test 4: Lobby WebSocket Tests", end=" ", flush=True) async def test4(): - auth_headers1 = await make_user("rtest6", "rtest6@email.com", "password", "RTester 6") - auth_headers2 = await make_user("rtest7", "rtest7@email.com", "password", "RTester 7") + auth_headers1 = await make_user( + "rtest6", "rtest6@email.com", "password", "RTester 6" + ) + auth_headers2 = await make_user( + "rtest7", "rtest7@email.com", "password", "RTester 7" + ) session = requests.Session() lobby_url = f"{WS_BASE_URL}/rooms/lobby" # Test: Connect to lobby - async with websockets.connect(lobby_url, subprotocols=[f"access_token|{extract_token(auth_headers1)}"]) as lobby_ws: + async with websockets.connect( + lobby_url, subprotocols=[f"access_token|{extract_token(auth_headers1)}"] + ) as lobby_ws: # Initial empty room list message = await get_latest_message(lobby_ws) assert message["type"] == "room_list" @@ -218,13 +240,18 @@ async def test4(): "starting_mp": 200, "mana_recharge": 50, } - await update_room_settings(room_data["room_code"], auth_headers2, session, new_settings) + await update_room_settings( + room_data["room_code"], auth_headers2, session, new_settings + ) message = await get_latest_message(lobby_ws) assert message["type"] == "room_list", "Wrong message type" assert message["rooms"][0]["settings"]["problem_count"] == 5 # Player joins and check broadcast - async with websockets.connect(f"{WS_BASE_URL}/rooms/{room_data['room_code']}", subprotocols=[f"access_token|{extract_token(auth_headers1)}"]) as _: + async with websockets.connect( + f"{WS_BASE_URL}/rooms/{room_data['room_code']}", + subprotocols=[f"access_token|{extract_token(auth_headers1)}"], + ) as _: message = await get_latest_message(lobby_ws) assert message["type"] == "room_list" assert message["rooms"][0]["player_count"] == 2 @@ -248,14 +275,23 @@ async def test4(): print("Running test 5: Room WebSocket Basic Tests", end=" ", flush=True) async def test5(): - auth_headers1 = await make_user("rtest8", "rtest8@email.com", "password", "RTester 8") - auth_headers2 = await make_user("rtest9", "rtest9@email.com", "password", "RTester 9") - auth_headers3 = await make_user("rtest10", "rtest10@email.com", "password", "RTester 10") + auth_headers1 = await make_user( + "rtest8", "rtest8@email.com", "password", "RTester 8" + ) + auth_headers2 = await make_user( + "rtest9", "rtest9@email.com", "password", "RTester 9" + ) + auth_headers3 = await make_user( + "rtest10", "rtest10@email.com", "password", "RTester 10" + ) session = requests.Session() # Test: Connect to non-existent room try: - async with websockets.connect(f"{WS_BASE_URL}/rooms/INVALID", subprotocols=[f"access_token|{extract_token(auth_headers1)}"]) as ws: + async with websockets.connect( + f"{WS_BASE_URL}/rooms/INVALID", + subprotocols=[f"access_token|{extract_token(auth_headers1)}"], + ) as ws: await ws.recv() assert False except ConnectionClosedError as e: @@ -266,8 +302,14 @@ async def test5(): room_code = room_data["room_code"] # Connect host and guest - async with websockets.connect(f"{WS_BASE_URL}/rooms/{room_code}", subprotocols=[f"access_token|{extract_token(auth_headers1)}"]) as host_ws: - async with websockets.connect(f"{WS_BASE_URL}/rooms/{room_code}", subprotocols=[f"access_token|{extract_token(auth_headers2)}"]) as guest_ws: + async with websockets.connect( + f"{WS_BASE_URL}/rooms/{room_code}", + subprotocols=[f"access_token|{extract_token(auth_headers1)}"], + ) as host_ws: + async with websockets.connect( + f"{WS_BASE_URL}/rooms/{room_code}", + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ) as guest_ws: # Test: Verify initial room state messages host_state = await get_latest_message(host_ws) guest_state = await get_latest_message(guest_ws) @@ -279,7 +321,10 @@ async def test5(): # Test: Connect to full room try: - async with websockets.connect(f"{WS_BASE_URL}/rooms/{room_code}", subprotocols=[f"access_token|{extract_token(auth_headers3)}"]) as third_ws: + async with websockets.connect( + f"{WS_BASE_URL}/rooms/{room_code}", + subprotocols=[f"access_token|{extract_token(auth_headers3)}"], + ) as third_ws: await asyncio.wait_for(third_ws.recv(), timeout=1) except asyncio.TimeoutError: assert False @@ -297,16 +342,26 @@ async def test5(): print("Running test 6: Room Ready State and Game Start Tests", end=" ", flush=True) async def test6(): - auth_headers1 = await make_user("rtest11", "rtest11@email.com", "password", "RTester 11") - auth_headers2 = await make_user("rtest12", "rtest12@email.com", "password", "RTester 12") + auth_headers1 = await make_user( + "rtest11", "rtest11@email.com", "password", "RTester 11" + ) + auth_headers2 = await make_user( + "rtest12", "rtest12@email.com", "password", "RTester 12" + ) session = requests.Session() # Create room with custom settings room_data = await create_room(auth_headers1, session) room_code = room_data["room_code"] - async with websockets.connect(f"{WS_BASE_URL}/rooms/{room_code}", subprotocols=[f"access_token|{extract_token(auth_headers1)}"]) as host_ws: - async with websockets.connect(f"{WS_BASE_URL}/rooms/{room_code}", subprotocols=[f"access_token|{extract_token(auth_headers2)}"]) as guest_ws: + async with websockets.connect( + f"{WS_BASE_URL}/rooms/{room_code}", + subprotocols=[f"access_token|{extract_token(auth_headers1)}"], + ) as host_ws: + async with websockets.connect( + f"{WS_BASE_URL}/rooms/{room_code}", + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ) as guest_ws: # Clear initial messages await get_latest_message(host_ws) await get_latest_message(guest_ws) @@ -321,13 +376,18 @@ async def test6(): await guest_ws.send(json.dumps({"type": "toggle_ready"})) host_state = await get_latest_message(host_ws) await get_latest_message(guest_ws) - assert host_state["data"]["host_ready"] and host_state["data"]["guest_ready"] + assert ( + host_state["data"]["host_ready"] + and host_state["data"]["guest_ready"] + ) # Test: Start game without being host await guest_ws.send(json.dumps({"type": "start_game"})) error_msg = await get_latest_message(guest_ws) assert error_msg["type"] == "error" - assert "Only the host can start the game" in error_msg["data"]["message"] + assert ( + "Only the host can start the game" in error_msg["data"]["message"] + ) # Test: Start game as host await host_ws.send(json.dumps({"type": "start_game"})) @@ -344,16 +404,19 @@ async def test6(): # Test: Create room while in game room_data2 = await create_room(auth_headers1, session) - assert "detail" in room_data2 and room_data2["detail"] == "Already in a room" + assert ( + "detail" in room_data2 + and room_data2["detail"] == "Already in a room" + ) # Both players connect to game async with websockets.connect( f"{WS_BASE_URL}/game/play/{game_id}", - subprotocols=[f"access_token|{extract_token(auth_headers1)}"] + subprotocols=[f"access_token|{extract_token(auth_headers1)}"], ) as p1: async with websockets.connect( f"{WS_BASE_URL}/game/play/{game_id}", - subprotocols=[f"access_token|{extract_token(auth_headers2)}"] + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], ): await send_forfeit(p1) @@ -365,8 +428,12 @@ async def test6(): print("Running test 7: Room Chat and Game Integration Tests", end=" ", flush=True) async def test7(): - auth_headers1 = await make_user("rtest13", "rtest13@email.com", "password", "RTester 13") - auth_headers2 = await make_user("rtest14", "rtest14@email.com", "password", "RTester 14") + auth_headers1 = await make_user( + "rtest13", "rtest13@email.com", "password", "RTester 13" + ) + auth_headers2 = await make_user( + "rtest14", "rtest14@email.com", "password", "RTester 14" + ) session = requests.Session() settings = { @@ -388,18 +455,23 @@ async def test7(): room_data = await create_room(auth_headers1, session, settings=settings) room_code = room_data["room_code"] - async with websockets.connect(f"{WS_BASE_URL}/rooms/{room_code}", subprotocols=[f"access_token|{extract_token(auth_headers1)}"]) as host_ws: - async with websockets.connect(f"{WS_BASE_URL}/rooms/{room_code}", subprotocols=[f"access_token|{extract_token(auth_headers2)}"]) as guest_ws: + async with websockets.connect( + f"{WS_BASE_URL}/rooms/{room_code}", + subprotocols=[f"access_token|{extract_token(auth_headers1)}"], + ) as host_ws: + async with websockets.connect( + f"{WS_BASE_URL}/rooms/{room_code}", + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ) as guest_ws: # Clear initial messages await get_latest_message(host_ws) await get_latest_message(guest_ws) # Test: Chat functionality chat_message = "Hello, this is a test message!" - await host_ws.send(json.dumps({ - "type": "chat", - "data": {"message": chat_message} - })) + await host_ws.send( + json.dumps({"type": "chat", "data": {"message": chat_message}}) + ) host_chat = await get_latest_message(host_ws) guest_chat = await get_latest_message(guest_ws) @@ -421,8 +493,14 @@ async def test7(): game_id = game_start_host["data"]["game_id"] # Connect to game and verify settings - async with websockets.connect(f"{WS_BASE_URL}/game/play/{game_id}", subprotocols=[f"access_token|{extract_token(auth_headers1)}"]) as p1: - async with websockets.connect(f"{WS_BASE_URL}/game/play/{game_id}", subprotocols=[f"access_token|{extract_token(auth_headers2)}"]): + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{game_id}", + subprotocols=[f"access_token|{extract_token(auth_headers1)}"], + ) as p1: + async with websockets.connect( + f"{WS_BASE_URL}/game/play/{game_id}", + subprotocols=[f"access_token|{extract_token(auth_headers2)}"], + ): game_state = await get_until(p1, "game_state") # Test if started game has correct settings @@ -476,9 +554,13 @@ async def test7(): await use_ability(p1, "deletio") game_state = await get_latest_message(p1) - assert game_state["data"]["your_hp"] == 560 # HP should stay the same + assert ( + game_state["data"]["your_hp"] == 560 + ) # HP should stay the same assert game_state["data"]["skill_points"] == 180 - assert game_state["data"]["mana_points"] == 200 - 15 + 50 * 4 - 5 + assert ( + game_state["data"]["mana_points"] == 200 - 15 + 50 * 4 - 5 + ) await send_code(p1, ALL_SOLUTION) await asyncio.sleep(3) diff --git a/app/tests/unit/code_execution_test.py b/app/tests/unit/code_execution_test.py index 1adf9cf..eadcfb0 100644 --- a/app/tests/unit/code_execution_test.py +++ b/app/tests/unit/code_execution_test.py @@ -10,6 +10,7 @@ from services.execution.service import CodeExecutionService # fmt: on + class TestPython: @pytest.fixture def executor(self): @@ -74,10 +75,14 @@ async def test_successful_execution(self, executor, valid_solution): method_name="add", test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], expected_results=["3", "0", "0"], - sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_test_cases=[ + "--arg1=1 --arg2=2", + "--arg1=0 --arg2=0", + "--arg1=-1 --arg2=1", + ], sample_expected_results=["3", "0", "0"], difficulty="easy", - compare_func="return result == int(expected)" + compare_func="return result == int(expected)", ) assert result.success @@ -91,10 +96,14 @@ async def test_failed_test_cases(self, executor, valid_solution): method_name="add", test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0"], expected_results=["4", "1"], - sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_test_cases=[ + "--arg1=1 --arg2=2", + "--arg1=0 --arg2=0", + "--arg1=-1 --arg2=1", + ], sample_expected_results=["3", "0", "0"], difficulty="easy", - compare_func="return result == int(expected)" + compare_func="return result == int(expected)", ) assert result.success @@ -109,10 +118,14 @@ async def test_syntax_error(self, executor, invalid_syntax_solution): method_name="add", test_cases=["--arg1=1 --arg2=2"], expected_results=["3"], - sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_test_cases=[ + "--arg1=1 --arg2=2", + "--arg1=0 --arg2=0", + "--arg1=-1 --arg2=1", + ], sample_expected_results=["3", "0", "0"], difficulty="easy", - compare_func="return result == int(expected)" + compare_func="return result == int(expected)", ) assert not result.success @@ -125,10 +138,14 @@ async def test_undefined_error(self, executor, undefined_variable_solution): method_name="add", test_cases=["--arg1=1 --arg2=2", "--arg1=2 --arg2=2"], expected_results=["3", "4"], - sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_test_cases=[ + "--arg1=1 --arg2=2", + "--arg1=0 --arg2=0", + "--arg1=-1 --arg2=1", + ], sample_expected_results=["3", "0", "0"], difficulty="easy", - compare_func="return result == int(expected)" + compare_func="return result == int(expected)", ) assert result.success @@ -143,10 +160,14 @@ async def test_timeout(self, executor, infinite_loop_solution): method_name="add", test_cases=["--arg1=1 --arg2=2"], expected_results=["3"], - sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_test_cases=[ + "--arg1=1 --arg2=2", + "--arg1=0 --arg2=0", + "--arg1=-1 --arg2=1", + ], sample_expected_results=["3", "0", "0"], difficulty="easy", - compare_func="return result == int(expected)" + compare_func="return result == int(expected)", ) assert not result.success @@ -159,10 +180,14 @@ async def test_memory_limit(self, executor, memory_heavy_solution): method_name="add", test_cases=["--arg1=1 --arg2=2"], expected_results=["3"], - sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_test_cases=[ + "--arg1=1 --arg2=2", + "--arg1=0 --arg2=0", + "--arg1=-1 --arg2=1", + ], sample_expected_results=["3", "0", "0"], difficulty="easy", - compare_func="return result == int(expected)" + compare_func="return result == int(expected)", ) assert not result.success @@ -176,25 +201,17 @@ async def test_complex_problem(self, executor, valid_solution): test_cases=[ "--arg1=[2,7,11,15] --arg2=9", "--arg1=[3,2,4] --arg2=6", - "--arg1=[3,3] --arg2=6" - ], - expected_results=[ - "[0,1]", - "[1,2]", - "[0,1]" + "--arg1=[3,3] --arg2=6", ], + expected_results=["[0,1]", "[1,2]", "[0,1]"], sample_test_cases=[ "--arg1=[2,7,11,15] --arg2=9", "--arg1=[3,2,4] --arg2=6", - "--arg1=[3,3] --arg2=6" - ], - sample_expected_results=[ - "[0,1]", - "[1,2]", - "[0,1]" + "--arg1=[3,3] --arg2=6", ], + sample_expected_results=["[0,1]", "[1,2]", "[0,1]"], difficulty="easy", - compare_func="return sorted(result) == sorted(eval(expected))" + compare_func="return sorted(result) == sorted(eval(expected))", ) assert result.success @@ -214,7 +231,7 @@ async def test_concurrent_executions(self, executor, valid_solution): sample_test_cases=["--arg1=1 --arg2=2"], sample_expected_results=["3"], difficulty="hard", - compare_func="return result == int(expected)" + compare_func="return result == int(expected)", ) ) @@ -223,9 +240,12 @@ async def test_concurrent_executions(self, executor, valid_solution): assert len(results) == 20 def test_different_difficulty_semaphores(self, executor): - assert executor._execution_semaphores["easy"]._value > \ - executor._execution_semaphores["medium"]._value > \ - executor._execution_semaphores["hard"]._value + assert ( + executor._execution_semaphores["easy"]._value + > executor._execution_semaphores["medium"]._value + > executor._execution_semaphores["hard"]._value + ) + class TestJava: @pytest.fixture @@ -304,11 +324,15 @@ async def test_successful_execution(self, executor, valid_solution): method_name="add", test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], expected_results=["3", "0", "0"], - sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_test_cases=[ + "--arg1=1 --arg2=2", + "--arg1=0 --arg2=0", + "--arg1=-1 --arg2=1", + ], sample_expected_results=["3", "0", "0"], difficulty="easy", compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", - lang="java" + lang="java", ) assert result.success @@ -326,7 +350,7 @@ async def test_failed_test_cases(self, executor, valid_solution): sample_expected_results=["3", "0"], difficulty="easy", compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", - lang="java" + lang="java", ) assert result.success @@ -345,7 +369,7 @@ async def test_syntax_error(self, executor, invalid_syntax_solution): sample_expected_results=["3"], difficulty="easy", compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", - lang="java" + lang="java", ) assert not result.success @@ -362,7 +386,7 @@ async def test_undefined_error(self, executor, undefined_variable_solution): sample_expected_results=["3"], difficulty="easy", compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", - lang="java" + lang="java", ) assert not result.success @@ -379,7 +403,7 @@ async def test_timeout(self, executor, infinite_loop_solution): sample_expected_results=["3"], difficulty="easy", compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", - lang="java" + lang="java", ) assert not result.success @@ -396,7 +420,7 @@ async def test_memory_limit(self, executor, memory_heavy_solution): sample_expected_results=["3"], difficulty="easy", compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", - lang="java" + lang="java", ) assert all("error" in test for test in result.test_results) @@ -409,26 +433,18 @@ async def test_complex_problem(self, executor, valid_solution): test_cases=[ "--arg1=[2,7,11,15] --arg2=9", "--arg1=[3,2,4] --arg2=6", - "--arg1=[3,3] --arg2=6" - ], - expected_results=[ - "[0,1]", - "[1,2]", - "[0,1]" + "--arg1=[3,3] --arg2=6", ], + expected_results=["[0,1]", "[1,2]", "[0,1]"], sample_test_cases=[ "--arg1=[2,7,11,15] --arg2=9", "--arg1=[3,2,4] --arg2=6", - "--arg1=[3,3] --arg2=6" - ], - sample_expected_results=[ - "[0,1]", - "[1,2]", - "[0,1]" + "--arg1=[3,3] --arg2=6", ], + sample_expected_results=["[0,1]", "[1,2]", "[0,1]"], difficulty="easy", compare_func="return Arrays.equals((int[]) result, (int[]) expected);", - lang="java" + lang="java", ) assert result.success @@ -449,18 +465,21 @@ async def test_concurrent_executions(self, executor, valid_solution): sample_expected_results=["3"], difficulty="hard", compare_func="return ((Integer)result).intValue() == ((Integer)expected).intValue();", - lang="java" + lang="java", ) ) results = await asyncio.gather(*tasks) assert all(r.success for r in results) assert len(results) == 20 - + def test_different_difficulty_semaphores(self, executor): - assert executor._execution_semaphores["easy"]._value > \ - executor._execution_semaphores["medium"]._value > \ - executor._execution_semaphores["hard"]._value + assert ( + executor._execution_semaphores["easy"]._value + > executor._execution_semaphores["medium"]._value + > executor._execution_semaphores["hard"]._value + ) + class TestCpp: @pytest.fixture @@ -549,11 +568,15 @@ async def test_successful_execution(self, executor, valid_solution): method_name="add", test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], expected_results=["3", "0", "0"], - sample_test_cases=["--arg1=1 --arg2=2", "--arg1=0 --arg2=0", "--arg1=-1 --arg2=1"], + sample_test_cases=[ + "--arg1=1 --arg2=2", + "--arg1=0 --arg2=0", + "--arg1=-1 --arg2=1", + ], sample_expected_results=["3", "0", "0"], difficulty="easy", compare_func="return result == expected;", - lang="cpp" + lang="cpp", ) assert result.success assert len(result.test_results) == 3 @@ -570,13 +593,12 @@ async def test_failed_test_cases(self, executor, valid_solution): sample_expected_results=["3", "0"], difficulty="easy", compare_func="return result == expected;", - lang="cpp" + lang="cpp", ) assert result.success assert len(result.test_results) == 2 assert not any(test["passed"] for test in result.test_results) - @pytest.mark.asyncio async def test_syntax_error(self, executor, invalid_syntax_solution): result = await executor.execute_code( @@ -588,7 +610,7 @@ async def test_syntax_error(self, executor, invalid_syntax_solution): sample_expected_results=["3"], difficulty="easy", compare_func="return result == expected;", - lang="cpp" + lang="cpp", ) assert not result.success @@ -603,7 +625,7 @@ async def test_undefined_error(self, executor, undefined_variable_solution): sample_expected_results=["3"], difficulty="easy", compare_func="return result == expected;", - lang="cpp" + lang="cpp", ) assert not result.success @@ -618,7 +640,7 @@ async def test_type_error(self, executor, valid_solution): sample_expected_results=["3"], difficulty="easy", compare_func="return result == expected;", - lang="cpp" + lang="cpp", ) assert result.success assert not all(test["passed"] for test in result.test_results) @@ -634,7 +656,7 @@ async def test_timeout(self, executor, infinite_loop_solution): sample_expected_results=["3"], difficulty="easy", compare_func="return result == expected;", - lang="cpp" + lang="cpp", ) assert not result.success assert "Time Limit Exceeded" in result.message @@ -650,7 +672,7 @@ async def test_memory_limit(self, executor, memory_heavy_solution): sample_expected_results=["3"], difficulty="easy", compare_func="return result == expected;", - lang="cpp" + lang="cpp", ) assert not result.success assert "Memory Limit Exceeded" in result.message @@ -663,26 +685,18 @@ async def test_complex_problem(self, executor, valid_solution): test_cases=[ "--arg1=[2,7,11,15] --arg2=9", "--arg1=[3,2,4] --arg2=6", - "--arg1=[3,3] --arg2=6" - ], - expected_results=[ - "[0,1]", - "[1,2]", - "[0,1]" + "--arg1=[3,3] --arg2=6", ], + expected_results=["[0,1]", "[1,2]", "[0,1]"], sample_test_cases=[ "--arg1=[2,7,11,15] --arg2=9", "--arg1=[3,2,4] --arg2=6", - "--arg1=[3,3] --arg2=6" - ], - sample_expected_results=[ - "[0,1]", - "[1,2]", - "[0,1]" + "--arg1=[3,3] --arg2=6", ], + sample_expected_results=["[0,1]", "[1,2]", "[0,1]"], difficulty="easy", compare_func="return result == expected;", - lang="cpp" + lang="cpp", ) assert result.success assert len(result.test_results) == 3 @@ -702,7 +716,7 @@ async def test_concurrent_executions(self, executor, valid_solution): sample_expected_results=["3"], difficulty="hard", compare_func="return result == expected;", - lang="cpp" + lang="cpp", ) ) results = await asyncio.gather(*tasks) @@ -710,9 +724,12 @@ async def test_concurrent_executions(self, executor, valid_solution): assert len(results) == 20 def test_different_difficulty_semaphores(self, executor): - assert executor._execution_semaphores["easy"]._value > \ - executor._execution_semaphores["medium"]._value > \ - executor._execution_semaphores["hard"]._value + assert ( + executor._execution_semaphores["easy"]._value + > executor._execution_semaphores["medium"]._value + > executor._execution_semaphores["hard"]._value + ) + if __name__ == "__main__": pytest.main([__file__, "-v"]) diff --git a/app/tests/unit/problem_test.py b/app/tests/unit/problem_test.py index 5ea73f2..4ebd561 100644 --- a/app/tests/unit/problem_test.py +++ b/app/tests/unit/problem_test.py @@ -119,5 +119,6 @@ async def test_get_problems_by_distribution_empty_distribution(db: Session): result = await ProblemManager.get_problems_by_distribution(db, distribution) assert len(result) == 0 + if __name__ == "__main__": pytest.main([__file__, "-v"]) diff --git a/app/tests/unit/test_generation_test.py b/app/tests/unit/test_generation_test.py index 4334549..bf8335d 100644 --- a/app/tests/unit/test_generation_test.py +++ b/app/tests/unit/test_generation_test.py @@ -6,7 +6,7 @@ from openai import AsyncOpenAI from pydantic import BaseModel, Field -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from core.config import settings from db.models.problem import Problem from services.execution.service import CodeExecutionService @@ -16,32 +16,45 @@ engine = create_engine(sync_db_url) SessionLocal = sessionmaker(bind=engine) + class CodeGenerationResponse(BaseModel): python: str = Field(..., description="Solution in Python") java: str = Field(..., description="Solution in Java") cpp: str = Field(..., description="Solution in C++") + class CodeGenerationService: def __init__(self, api_key: str): - self.client = AsyncOpenAI(api_key=api_key) if api_key != 'your_api_key_here' else None + self.client = ( + AsyncOpenAI(api_key=api_key) if api_key != "your_api_key_here" else None + ) - async def generate_code(self, title: str, description: str, boilerplate: str) -> CodeGenerationResponse: + async def generate_code( + self, title: str, description: str, boilerplate: str + ) -> CodeGenerationResponse: if not self.client: return CodeGenerationResponse() try: completion = await self.client.beta.chat.completions.parse( model="gpt-4o-mini", messages=[ - {"role": "system", "content": "You are a code generation assistant. Generate correct solutions in python, java, and c++."}, - {"role": "user", "content": f"Title: {title}\nProblem description:\n{description}\nBoilerplates:\n{boilerplate.python}\n{boilerplate.java}\n{boilerplate.cpp}\nReturn only JSON with python, java, and cpp fields."} + { + "role": "system", + "content": "You are a code generation assistant. Generate correct solutions in python, java, and c++.", + }, + { + "role": "user", + "content": f"Title: {title}\nProblem description:\n{description}\nBoilerplates:\n{boilerplate.python}\n{boilerplate.java}\n{boilerplate.cpp}\nReturn only JSON with python, java, and cpp fields.", + }, ], response_format=CodeGenerationResponse, - temperature=0 + temperature=0, ) return completion.choices[0].message.parsed except: return CodeGenerationResponse() + def get_compare_func(problem: Problem, lang: str) -> str: if lang == "python": return problem.compare_func.python @@ -50,6 +63,7 @@ def get_compare_func(problem: Problem, lang: str) -> str: elif lang == "cpp": return problem.compare_func.cpp + @pytest.fixture def db(): session = SessionLocal() @@ -58,6 +72,7 @@ def db(): finally: session.close() + @pytest.mark.asyncio async def test_code_validation_all_problems(db: Session): print("Setting up...") @@ -67,16 +82,18 @@ async def test_code_validation_all_problems(db: Session): print(f"Validating {len(problems)} problems") for problem in problems: print(f"Validating problem: {problem.title}") - code_res = await code_generator.generate_code(problem.title, problem.description, problem.boilerplate) + code_res = await code_generator.generate_code( + problem.title, problem.description, problem.boilerplate + ) for lang, snippet in [ - ("python", code_res.python), - ("java", code_res.java), - ("cpp", code_res.cpp) + ("python", code_res.python), + ("java", code_res.java), + ("cpp", code_res.cpp), ]: print(f"Validating {lang} code") if snippet.strip(): result = await executor.execute_code( - code=snippet, + code=snippet, lang=lang, method_name=problem.method_name, test_cases=problem.hidden_test_cases, @@ -84,7 +101,7 @@ async def test_code_validation_all_problems(db: Session): sample_test_cases=problem.sample_test_cases, sample_expected_results=problem.sample_test_results, difficulty=problem.difficulty, - compare_func=get_compare_func(problem, lang) + compare_func=get_compare_func(problem, lang), ) if not result.success: print(snippet) @@ -94,4 +111,4 @@ async def test_code_validation_all_problems(db: Session): if "error" in tr: print(tr) assert "error" not in tr - print(f"{lang} code validation successful") \ No newline at end of file + print(f"{lang} code validation successful") From 212eb49dcf3929e6acd23ba5af13c444505cf59d Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Thu, 13 Feb 2025 12:56:43 -0500 Subject: [PATCH 19/24] chore: format code --- .githooks/pre-push | 3 --- 1 file changed, 3 deletions(-) diff --git a/.githooks/pre-push b/.githooks/pre-push index a9712a1..cc8b873 100644 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -5,6 +5,3 @@ black . # Amend the commit message git commit --amend -m "chore: format code" -u - -# Push the changes -git push \ No newline at end of file From 2bea052a1d06b6b30227966926d69d135c329aba Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Fri, 14 Feb 2025 15:11:02 -0500 Subject: [PATCH 20/24] chore: format code --- .env.example | 14 +++++++++++--- app/core/config.py | 19 +++++++++++++------ app/services/execution/docker.py | 26 ++++++++++++-------------- app/services/execution/templates.py | 6 +++++- 4 files changed, 41 insertions(+), 24 deletions(-) diff --git a/.env.example b/.env.example index 49c4cd9..d0e9d09 100644 --- a/.env.example +++ b/.env.example @@ -45,12 +45,20 @@ MAX_CONCURRENT="20, 10, 5" OPENAI_API_KEY="your_api_key_here" ### Docker Settings ### +DOCKER_IMAGE=python:3.11-alpine + DOCKER_IMAGE_PYTHON=beatcode-python:latest DOCKER_IMAGE_JAVA=beatcode-java:latest DOCKER_IMAGE_CPP=beatcode-cpp:latest -DOCKER_IMAGE=python:3.11-alpine -DOCKER_MEMORY_LIMIT="128, 256, 512" -DOCKER_TIME_LIMIT="2000, 3000, 5000" + +DOCKER_PYTHON_MEMORY_LIMIT="128, 256, 512" +DOCKER_JAVA_MEMORY_LIMIT="128, 256, 512" +DOCKER_CPP_MEMORY_LIMIT="128, 256, 512" + +DOCKER_PYTHON_TIME_LIMIT="2000, 3000, 5000" +DOCKER_JAVA_TIME_LIMIT="15000, 20000, 30000" +DOCKER_CPP_TIME_LIMIT="5000, 10000, 15000" + DOCKER_CPU_LIMIT=0.5 ### Game Settings ### diff --git a/app/core/config.py b/app/core/config.py index f9627a1..5509302 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -50,9 +50,9 @@ class Settings(BaseSettings): # JWT SECRET_KEY: str # Secret key for JWT - ALGORITHM: str # Encryption algorithm for JWT + ALGORITHM: str # Encryption algorithm for JWT ACCESS_TOKEN_EXPIRE_MINUTES: int # Time in minutes for the access token to expire - REFRESH_TOKEN_EXPIRE_DAYS: int # Time in days for the refresh token to expire + REFRESH_TOKEN_EXPIRE_DAYS: int # Time in days for the refresh token to expire # Code Execution MAX_CONCURRENT: str # Maximum number of problems that can be executed concurrently for each difficulty @@ -60,10 +60,17 @@ class Settings(BaseSettings): # Docker Settings DOCKER_IMAGE_PYTHON: str # Docker image for running Python code - DOCKER_IMAGE_JAVA: str # Docker image for running Java code - DOCKER_IMAGE_CPP: str # Docker image for running C++ code - DOCKER_MEMORY_LIMIT: str # Memory limit (mb) for problems - DOCKER_TIME_LIMIT: str # Time limit (ms) for problems + DOCKER_IMAGE_JAVA: str # Docker image for running Java code + DOCKER_IMAGE_CPP: str # Docker image for running C++ code + + DOCKER_PYTHON_MEMORY_LIMIT: str # Memory limit (mb) for running Python code + DOCKER_JAVA_MEMORY_LIMIT: str # Memory limit (mb) for running Java code + DOCKER_CPP_MEMORY_LIMIT: str # Memory limit (mb) for running C++ code + + DOCKER_PYTHON_TIME_LIMIT: str # Time limit (ms) for running Python code + DOCKER_JAVA_TIME_LIMIT: str # Time limit (ms) for running Java code + DOCKER_CPP_TIME_LIMIT: str # Time limit (ms) for running C++ code + DOCKER_CPU_LIMIT: float # CPU limit (0-1.0) for each container # Game Settings diff --git a/app/services/execution/docker.py b/app/services/execution/docker.py index 2b77624..95ac81f 100644 --- a/app/services/execution/docker.py +++ b/app/services/execution/docker.py @@ -14,23 +14,21 @@ class DockerRunner: def __init__(self, client: docker.DockerClient): self.client = client - self.docker_image_map = { + self.docker_image = { "python": settings.DOCKER_IMAGE_PYTHON, "java": settings.DOCKER_IMAGE_JAVA, "cpp": settings.DOCKER_IMAGE_CPP, } self.docker_cpu_limit = settings.DOCKER_CPU_LIMIT - easy_mem, medium_mem, hard_mem = [ - int(x) for x in settings.DOCKER_MEMORY_LIMIT.split(",") - ] - easy_time, medium_time, hard_time = [ - int(x) for x in settings.DOCKER_TIME_LIMIT.split(",") - ] - self._docker_settings = { - "easy": [easy_mem, easy_time], - "medium": [medium_mem, medium_time], - "hard": [hard_mem, hard_time], - } + self._docker_settings = {} + for lang in self.docker_image.keys(): + mem_limits = [int(x) for x in getattr(settings, f"DOCKER_{lang.upper()}_MEMORY_LIMIT").split(",")] + time_limits = [int(x) for x in getattr(settings, f"DOCKER_{lang.upper()}_TIME_LIMIT").split(",")] + self._docker_settings[lang] = { + "easy": (mem_limits[0], time_limits[0]), + "medium": (mem_limits[1], time_limits[1]), + "hard": (mem_limits[2], time_limits[2]), + } self.last_logs = "" self.last_stderr = "" self.last_status_code = 0 @@ -77,7 +75,7 @@ def run_container( :return: The result of the execution. """ # Get the memory and time limits for the difficulty level. - memory_limit, time_limit = self._docker_settings[difficulty.lower()] + memory_limit, time_limit = self._docker_settings[lang][difficulty.lower()] dir_path = os.path.dirname(file_path) if not dir_path: dir_path = "." @@ -85,7 +83,7 @@ def run_container( try: # Run the container with the specified constraints container = self.client.containers.run( - self.docker_image_map[lang], + self.docker_image[lang], self.get_run_commands(lang, file_path), volumes={ dir_path: { diff --git a/app/services/execution/templates.py b/app/services/execution/templates.py index fc63852..9019adb 100644 --- a/app/services/execution/templates.py +++ b/app/services/execution/templates.py @@ -158,7 +158,11 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): result.addProperty("output", gson.toJson(output)); result.addProperty("expected", test.get("expected").getAsString()); }} catch (Exception e) {{ - result.addProperty("error", e.toString()); + Throwable cause = e; + if (e instanceof InvocationTargetException && e.getCause() != null) {{ + cause = e.getCause(); + }} + result.addProperty("error", cause.toString()); result.addProperty("passed", false); }} results.add(result); From 51fe8a872ea08e25766c726daf0ce2f723f27f96 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Fri, 14 Feb 2025 15:29:43 -0500 Subject: [PATCH 21/24] Updated git pre-hook --- .githooks/pre-push | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.githooks/pre-push b/.githooks/pre-push index cc8b873..52dd566 100644 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -1,7 +1,10 @@ #!/bin/sh -# Run black to format all Python code +# Exit and block git push if there's any error black . -# Amend the commit message -git commit --amend -m "chore: format code" -u +echo "Staging formatted files..." +git add -u + +echo "Committing staged changes..." +git commit -m "chore: format code before push" From 4764f4c47264590e8276af1953162475fb999b17 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Fri, 14 Feb 2025 15:29:49 -0500 Subject: [PATCH 22/24] chore: format code before push --- app/core/config.py | 16 ++++++++-------- app/services/execution/docker.py | 20 +++++++++++++++----- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 5509302..99a1878 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -50,9 +50,9 @@ class Settings(BaseSettings): # JWT SECRET_KEY: str # Secret key for JWT - ALGORITHM: str # Encryption algorithm for JWT + ALGORITHM: str # Encryption algorithm for JWT ACCESS_TOKEN_EXPIRE_MINUTES: int # Time in minutes for the access token to expire - REFRESH_TOKEN_EXPIRE_DAYS: int # Time in days for the refresh token to expire + REFRESH_TOKEN_EXPIRE_DAYS: int # Time in days for the refresh token to expire # Code Execution MAX_CONCURRENT: str # Maximum number of problems that can be executed concurrently for each difficulty @@ -60,16 +60,16 @@ class Settings(BaseSettings): # Docker Settings DOCKER_IMAGE_PYTHON: str # Docker image for running Python code - DOCKER_IMAGE_JAVA: str # Docker image for running Java code - DOCKER_IMAGE_CPP: str # Docker image for running C++ code + DOCKER_IMAGE_JAVA: str # Docker image for running Java code + DOCKER_IMAGE_CPP: str # Docker image for running C++ code DOCKER_PYTHON_MEMORY_LIMIT: str # Memory limit (mb) for running Python code - DOCKER_JAVA_MEMORY_LIMIT: str # Memory limit (mb) for running Java code - DOCKER_CPP_MEMORY_LIMIT: str # Memory limit (mb) for running C++ code + DOCKER_JAVA_MEMORY_LIMIT: str # Memory limit (mb) for running Java code + DOCKER_CPP_MEMORY_LIMIT: str # Memory limit (mb) for running C++ code DOCKER_PYTHON_TIME_LIMIT: str # Time limit (ms) for running Python code - DOCKER_JAVA_TIME_LIMIT: str # Time limit (ms) for running Java code - DOCKER_CPP_TIME_LIMIT: str # Time limit (ms) for running C++ code + DOCKER_JAVA_TIME_LIMIT: str # Time limit (ms) for running Java code + DOCKER_CPP_TIME_LIMIT: str # Time limit (ms) for running C++ code DOCKER_CPU_LIMIT: float # CPU limit (0-1.0) for each container diff --git a/app/services/execution/docker.py b/app/services/execution/docker.py index 95ac81f..8b9ad57 100644 --- a/app/services/execution/docker.py +++ b/app/services/execution/docker.py @@ -22,12 +22,22 @@ def __init__(self, client: docker.DockerClient): self.docker_cpu_limit = settings.DOCKER_CPU_LIMIT self._docker_settings = {} for lang in self.docker_image.keys(): - mem_limits = [int(x) for x in getattr(settings, f"DOCKER_{lang.upper()}_MEMORY_LIMIT").split(",")] - time_limits = [int(x) for x in getattr(settings, f"DOCKER_{lang.upper()}_TIME_LIMIT").split(",")] + mem_limits = [ + int(x) + for x in getattr(settings, f"DOCKER_{lang.upper()}_MEMORY_LIMIT").split( + "," + ) + ] + time_limits = [ + int(x) + for x in getattr(settings, f"DOCKER_{lang.upper()}_TIME_LIMIT").split( + "," + ) + ] self._docker_settings[lang] = { - "easy": (mem_limits[0], time_limits[0]), - "medium": (mem_limits[1], time_limits[1]), - "hard": (mem_limits[2], time_limits[2]), + "easy": (mem_limits[0], time_limits[0]), + "medium": (mem_limits[1], time_limits[1]), + "hard": (mem_limits[2], time_limits[2]), } self.last_logs = "" self.last_stderr = "" From eeb9bf4e8533ac8921c10a67da448e1f6f70dbdf Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Mon, 17 Feb 2025 23:42:31 -0500 Subject: [PATCH 23/24] Fixed input display --- .env.example | 2 +- app/services/execution/templates.py | 29 +++++++++++++++++------------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.env.example b/.env.example index d0e9d09..fbe218e 100644 --- a/.env.example +++ b/.env.example @@ -57,7 +57,7 @@ DOCKER_CPP_MEMORY_LIMIT="128, 256, 512" DOCKER_PYTHON_TIME_LIMIT="2000, 3000, 5000" DOCKER_JAVA_TIME_LIMIT="15000, 20000, 30000" -DOCKER_CPP_TIME_LIMIT="5000, 10000, 15000" +DOCKER_CPP_TIME_LIMIT="15000, 20000, 30000" DOCKER_CPU_LIMIT=0.5 diff --git a/app/services/execution/templates.py b/app/services/execution/templates.py index 9019adb..671528d 100644 --- a/app/services/execution/templates.py +++ b/app/services/execution/templates.py @@ -11,13 +11,13 @@ def __init__( passed: bool, output: Any = None, error: str = None, - input_data: str = None, + input: str = None, ): self.expected = expected self.output = str(output) if output is not None else None self.passed = passed self.error = error - self.input_data = input_data + self.input = input def to_dict(self, include_input: bool = True): result = {{ @@ -27,7 +27,7 @@ def to_dict(self, include_input: bool = True): "error": self.error, }} if include_input: - result["input_data"] = self.input_data + result["input"] = self.input return result def compare_results(result: Any, expected: str) -> bool: @@ -54,14 +54,14 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): expected=test['expected'], output=result, passed=passed, - input_data=test['input'], + input=test['input'], ).to_dict(include_input=is_sample)) except Exception as e: results.append(TestResult( expected=test['expected'], passed=False, error=traceback.format_exc(), - input_data=test['input'], + input=test['input'], ).to_dict(include_input=is_sample)) return {{ @@ -119,7 +119,7 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): {compare_func} }} - public static JsonArray runTests(Solution solution, JsonArray testData) {{ + public static JsonArray runTests(Solution solution, JsonArray testData, boolean showInput) {{ JsonArray results = new JsonArray(); Gson gson = new Gson(); @@ -157,6 +157,9 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): result.addProperty("passed", passed); result.addProperty("output", gson.toJson(output)); result.addProperty("expected", test.get("expected").getAsString()); + if (showInput) {{ + result.addProperty("input", inputStr); + }} }} catch (Exception e) {{ Throwable cause = e; if (e instanceof InvocationTargetException && e.getCause() != null) {{ @@ -428,8 +431,8 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): JsonArray sampleData = gson.fromJson(sampleStr, JsonArray.class); JsonObject results = new JsonObject(); - results.add("hidden_results", createResultObject(runTests(solution, testData))); - results.add("sample_results", createResultObject(runTests(solution, sampleData))); + results.add("hidden_results", createResultObject(runTests(solution, testData, false))); + results.add("sample_results", createResultObject(runTests(solution, sampleData, true))); java.io.FileWriter file = new java.io.FileWriter("{file_name}-results.txt"); file.write(results.toString()); @@ -582,7 +585,7 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): {compare_func} }} -Json::Value runTests(Solution& solution, const Json::Value& testData) {{ +Json::Value runTests(Solution& solution, const Json::Value& testData, bool showInput) {{ Json::Value results(Json::arrayValue); Json::CharReaderBuilder builder; Json::CharReader* reader = builder.newCharReader(); @@ -612,7 +615,9 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): writer["indentation"] = ""; testResult["output"] = Json::writeString(writer, output_json); testResult["expected"] = Json::writeString(writer, expected); - + if (showInput) {{ + testResult["input"] = test["input"]; + }} }} catch (const exception &e) {{ testResult["error"] = e.what(); testResult["passed"] = false; @@ -655,8 +660,8 @@ def run_tests(solution, method_name, test_data, is_sample: bool = False): delete reader; Json::Value results; - results["hidden_results"] = formatResults(runTests(solution, test_data)); - results["sample_results"] = formatResults(runTests(solution, sample_data)); + results["hidden_results"] = formatResults(runTests(solution, test_data, false)); + results["sample_results"] = formatResults(runTests(solution, sample_data, true)); ofstream output_file("{file_name}-results.txt"); output_file << results.toStyledString() << endl; From c6d12dc8b3d5c8276a6ffccc54f07a6b865fb981 Mon Sep 17 00:00:00 2001 From: Bao Dang Date: Mon, 17 Feb 2025 23:46:19 -0500 Subject: [PATCH 24/24] Updated git pre-hook --- .githooks/pre-push | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.githooks/pre-push b/.githooks/pre-push index 52dd566..3097812 100644 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -1,10 +1,4 @@ #!/bin/sh -# Exit and block git push if there's any error -black . - -echo "Staging formatted files..." -git add -u - -echo "Committing staged changes..." -git commit -m "chore: format code before push" +echo "Format check... (Please run `black .` before pushing)" +black . --check