# LeetCodeTools **Repository Path**: daili114514/leet-code-tools ## Basic Information - **Project Name**: LeetCodeTools - **Description**: 读取常见的力扣用例,打印常见的数据结构,例如链表,数组。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-11-09 - **Last Updated**: 2025-04-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # LeetCodeTools #### 介绍 读取常见的力扣用例,打印常见的数据结构,例如链表,数组。 #### 使用说明 通常只需要把 leetcode 的测试用例直接复制下来传到对应的函数即可构建对应的 cpp 对象。详见`parse.h` 还可以调用对应的函数进行打印,详见`print.h` 支持 list,tree,一维,二维数组(vector) 如果测试用例太长可以粘贴到`in.txt`中然后使用`readfile()`读取 具体使用,只要在根目录创建格式如下的`main.cpp`文件即可使用 **注:run.cmd 只是我觉得 vscode 运行时候输出一堆信息不好看写的,也可以不使用。如果要使用只需要控制台切换到根目录后运行`run.cmd`即可,另外需要手动添加一个target文件夹** ```c++ #include "alltools.h" using namespace std; const string infile = "./txt/in.txt"; const string outfile = "./txt/out.txt"; class Solution{ }; int main() { // 参数 auto vec_1 = getIntVec("[1,2,3,4,5,null,6,7,null,9]"); auto vec_2 = getIntVec("[9,4,9,8,4]"); auto vec2_1 = getIntVec2(""); auto vec2_2 = getIntVec2(""); auto int_1 = 2; auto int_2 = 3; auto int_3 = 1; auto int_4 = 1; auto str_1 = ""; auto str_2 = "456"; auto tree = getTreeFromVec(vec_1); auto list = getIntList("[9,4,9,8,4]"); printVec(vec_1); printTree(tree); Solution s; // auto res = s.countPairs(vec_1, int_1); // 输出 // printlist(res); // printVec(res); // printVec2(res); // printTree(res); // cout << res << endl; return 0; } ```