A simple and crappy LeetCode problems debugger.
- Copy the LeetCode problem's input and paste it into
s1
inmain.cpp
- Specify the input type and the output type (
inType
andoutType
) - Code your Solution in
Solution.h
- Call your Solution class in
main.cpp
, the program will automatically output the result.
- int (e.g. Problem 7)
- vector<int> (e.g. Problem 1)
- vector<vector<int>> (e.g. Problem 54)
- vector<string> (e.g. Problem 539)
- ListNode* (e.g. Problem 2)
- Doubly Linked List (Node*) (OUTPUT SUPPORT ONLY e.g. haven't found yet)
- string (e.g. Problem 6)
- Binary Tree (TreeNode*) (e.g. Problem Offer 32)
- Binary Tree (TreeNode*) (An alternative way: Manually set the input tree's pre-order traversal as
s1
and in-order traversal ass2
)
Problem 1 (link)
inType = "vector<int>", outType = "vector<int>";
s1 = "[2,7,11,15]";
vecOut = sol->twoSum(vecIn, 9);
Output:
[0,1]
inType = "vector<string>", outType = "vector<string>"
s1 = R"(["abcde","12345"])"; // use R to avoid using '\'
vecStrOut = vecStrIn;
Output:
["abcde","12345"]
To create a binary tree as shown below:
inType = "TreeNode*", outType = "TreeNode*";
s1 = "[5,3,1,0,2,4,6,8,7]";
s2 = "[0,1,2,3,4,5,6,7,8]";
treeOut = treeIn;
Output:
5
3,6
1,4,null,8
0,2,null,null,7,null
null,null,null,null,null,null