A C++ library that can take input just like leetcode testcase, and structure from leetcode, to allow local coding and debugging for leetcode to become very simple.
You can use you FAVOURITE IDE editors on LEETCODE.
Issues for new structure to be support are welcomed
Simply clone this repo and #include "leetcode.hpp"
, you may take reference on template.cpp
- multi-dimentional vector input output(bool,int,char)
- Basic support for TreeNode structure for graph questions
- cin and cout support for TreeNode
- cin and cout support for ListNode
- cin and cout support for Node(NodeChildren, the Node class which use children)
- basic auto complete for Node(NodeLeftRightNext, the Node class with left right next pointers)
Look at the template.cpp gives a simple template.
You can simpily copy and paste the method to the template to start code and debug locally.
multi-dimensional vector are support(bool,int,char)
[[0,0,1],[1,2,3]]
[[true,false],[false,true]]
[["h","e","l","l","o"],["w","o","r","l","d"]]
vector<vector<int>> v;
cin >> v;
vector<vector<int>> v{{0,0,1},{1,2,3};
cout << v;
[[0,0,1],[1,2,3]]
Support for struct TreeNode,ListNode,Node
- All contruction methods(also allow auto-completion to work)
- Input and output with cin,cout
[1,7,9,2,6,null,9,null,null,5,11,5,null]
[1,2,3,4,5]
[1,null,3,2,4,null,5,6]
//code for input
//work similar for ListNode*,Node* too
TreeNode * root;
cin >> root;
//code for output
TreeNode outnode = *root;//cannot use TreeNode* to output as all pointer will output the address directly
cout << outnode;
- More kind of vector support
- Support more kind of leetcode like input