vnaonlu / leetcode-daily Goto Github PK
View Code? Open in Web Editor NEWa project including my leetcode solutions with unittests, which are written in c++.
License: MIT License
a project including my leetcode solutions with unittests, which are written in c++.
License: MIT License
A merged message from devel/daily
to main
is need.
I am considering the following format:
adds the {count} solution(s) in week{week}.
add solutions details:
* {rev} adds q{id} with TC O({tc}) and SC O({sc}).
* {rev} adds q{id}.
* {rev} adds q{id} with TC O({tc}) and SC O({sc}) where {note}.
[4,-7,-3,null,null,-9,-3,9,-7,-4,null,6,null,-6,-6,null,null,0,6,5,null,9,null,null,-1,-4,null,null,null,-2]
// the return answer in the sample case 1 is
vector<vector<string>> exp = {{"bat"}, {"eat", "tea", "ate"}, {"tan", "nat"}};
// the expected answer generated by the tool is
vector<vector<string>> exp = {{"bat"}, {"nat", "tan"}, {"ate", "eat", "tea"}};
Such as Question #707
TEST(q17, sample_input02) {
l17::Solution solver;
// miss this-> string digits = "";
vector<string> exp = {};
// Try EXPECT_EQ_ANY_ORDER_RECURSIVE
// if the element is also matched in any order.
EXPECT_EQ_ANY_ORDER(solver.letterCombinations(digits), exp);
}
the generated template unittest:
vector<vector<char>> board = {{"X", "X", "X", "X"}, {"X", "O", "O", "X"}, {"X", "X", "O", "X"}, {"X", "O", "X", "X"}};
which can not initialize the char type by ".
TEST(q463, sample_input01) {
l463::Solution solver;
vector<vector<int>> grid = {};
//0 = 0
//1 = 1
//1 = 0
//0 = 1
//0 = 0
//1 = 1
//0 = 0
int exp = 16;
EXPECT_EQ(solver.islandPerimeter(grid), exp);
}
The answer to some questions such as #922 is accepted in multiple answers.
For example:
Input: nums = [4,2,5,7]
Output: [4,5,2,7]
Explanation: [4,7,2,5], [2,5,4,7], [2,7,4,5] would also have been accepted.
The unittest template does not generate any test case.
template generated by leetcode_add.py:
// since the solution function with void return type
void solve(vector<vector<char>>& board) {}
// then the pytool generates an ambiguous variable.
void exp = [["X","X","X","X"],["X","X","X","X"],["X","X","X","X"],["X","O","X","X"]];
The unittest template generates only one case.
// the first element is incorrect
vector<vector<int>> exp = {[], {1}, {2}, {1, 2}, {3}, {1, 3}, {2, 3}, {1, 2, 3}};
temporary solution
inline bool approximately_equal(double x, double y) noexcept {
return abs(y - x) < 1e-6;
}
//actual
vector<int> dungeon = {-2, -3, 3, -5, -10, 1, 10, 30, -5};
//expect
vector<vector<int>> dungeon = {{-2, -3, 3}, {-5, -10, 1}, {10, 30, -5}};
The current complexities information is incomplete.
This card ignores the complexity about Strcutured Solutions.
the tool generated only one sample example but Question #43 has two sample cases.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.