Save my solutions to leecode problems
Visit public repository of local leetcode for more information!!!
EVERYTHING BELOW IS OUTDATED!!!
EVERYTHING BELOW IS OUTDATED!!!
EVERYTHING BELOW IS OUTDATED!!!
MAJOR UPDATE!!
Support problems where the input is pair of method name and arguments' string!
Try
void main() {
UFUNCX(
CTOR(...)
&cls::method1,
&cls::method2,
...
);
}
, where CTOR()
wraps up the input types of constructor.
See problem 295 for example!
For inputs, use ','
to separate methods and arguments, NOT ';'
(first step to dispose ';'
)
By this update, the library now supports 99% of problems on leetcode to run AUTOMATICALLY on local machine.
The shell script to further simplify manual work will be released recently (maybe python script?)
For more information, plz check the source.
P.S.
UFUNC
inutils2
remains the same.- The complete disposal of
';'
is not done yet. - Still dependent on many classes and functions in
utils2
.
-
Cleaner
-
etc.
-
past features ignored..
-
Read/Parse inputs from files.
Tree
,vector<T>
,LinkedList
currently supported... -
Able to print datatypes (
Tree
,vector<T>
,LinkedList
) withoutoperator<<
defined... -
Add ./addinputs.sh for convenience... e.g.
./addinputs.sh xxx_xxxx.cpp
-
Add
readlines
macro for cpp, further simplifying reading parameters from files. -
Add
vector<ListNode*>
andvector<TreeNode*>
specialization -
Handle
string
properly- Support parsing
string
with spaces - Print
string
along side with quotes"
.
- Support parsing
-
Allocate linear memory for
ListNode*
andTreeNode*
efficiently. -
Handle memory properly by using
input_parameter
class as smart pointer forListNode*
andTreeNode*
.
For majority of questions in leetcode, now can be run by simply by
void main() {
UFUNC(Solution::method_name);
}
-
RUN
is deprecated now. please ALWAYS useUFUNC
instead. -
UFUNC
will callRUN
internally if cpp is older thanc++14
for downward compatibility. -
./addinputs.sh will not check back to cpp or java file after input txt file is created.
-
Able to record execution time inside of
UFUNC
. ( not applied for downward compatibleRUN
). -
./addpairs.sh reads clipboard to create well-formatted cpp file as well as input file. Try it.
-
Cleaner input. Instead of using
';'
to split parameters, the new version plans to split parameters in a smarter way. That is, even when the parameters are split by','
, the parser is able to distinguish between','
s in parameters and as delimiters based on input parameters' types. (Easier than expected, only need to distinguish btw scalar and array-like types) -
Support problems where there are multiple methods called multiple times. There are two big challenges
-
cpp does not support pointer to constructors. This means it's impossible to obtain the types of parameters for the constructor. One potential solution is to use a helper function, while this might require some tricks on shell script to automate the process. (Class Factory)
-
How to choose from multiple member function pointers by
string
. May need an organic combination of MACRO and shell script (Polymorphic) -
Minor challenge: parser for the input. This one is directly linked to cleaner input since there is no way one can replace delimiters by
';'
manually if the input contains thousands of characters. (Parse from left to right, using mechanism similar to calling stack to match parentheses)
-