You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The motivation behind this project is to be able to practice LeetCode problems on a plane without requiring an internet connection (until Starlink ramps up). It is by no means intended to replace or replicate leetcode.com.
6
-
7
-
## Table of Contents
8
-
9
-
1.[Windows Terminal](#windows-terminal)
10
-
1.[Build](#build)
11
-
2.[Run](#run)
12
-
1.[Windows Terminal](#windows-terminal-1)
13
-
2.[Unix](#unix)
14
-
2.[How To Use](#how-to-use)
15
-
3.[List of LeetCode Problems](#list-of-leetcode-problems)
16
-
4.[Usage](#usage)
17
-
5.[Note](#note)
18
-
6.[Requirements](#requirements)
19
-
7.[Contributing](#contributing)
20
-
21
-
## Windows Terminal
22
-
23
-
### Build
5
+
The motivation behind this project is to be able to practice LeetCode problems on a plane without requiring an internet connection (until Starlink ramps up). This project is not intended to replace or replicate leetcode.com.
6
+
7
+
## Table of Content
8
+
-[OpenLeetCode - An open source version of LeetCode](#openleetcode---an-open-source-version-of-leetcode)
9
+
-[Table of Content](#table-of-content)
10
+
-[Screenshot](#screenshot)
11
+
-[Build](#build)
12
+
- [Building without UI](#building-without-ui)
13
+
- [Building with UI](#building-with-ui)
14
+
-[Run](#run)
15
+
- [CLI - Windows Terminal](#cli---windows-terminal)
16
+
- [CLI - Unix](#cli---unix)
17
+
- [UI - Windows Terminal](#ui---windows-terminal)
18
+
- [UI - Unix](#ui---unix)
19
+
-[How To Use](#how-to-use)
20
+
-[List of LeetCode Problems](#list-of-leetcode-problems)
21
+
-[Usage](#usage)
22
+
-[Note](#note)
23
+
-[Requirements](#requirements)
24
+
- [Additional Requirements for the UI](#additional-requirements-for-the-ui)
The above example runs **TwoSum** problem using **C++**.
41
-
After the build succeeds the following directory structure will be generated in the folder specified by ``--problem_builds_dir`` flag. In this example it's a folder called ``problem_builds`` as follows:.
64
+
After the build succeeds, the following directory structure will be generated:
42
65
43
-
- problem_builds
44
-
- problems
45
-
- TwoSum
46
-
- cpp
47
-
- solution.cpp
48
-
- ...
49
-
- testcases
50
-
- TestCase1.test
51
-
- TestCase2.test
52
-
- ...
53
-
- description.md
54
-
- launguage
55
-
- cpp
66
+
- problems
67
+
- NumberOfIslands
68
+
- cpp
69
+
- solution.cpp
70
+
- ...
71
+
- testcases
72
+
- TestCase1.test
73
+
- TestCase2.test
74
+
- ...
75
+
- description.md
76
+
- TwoSum
77
+
- ..
78
+
- launguage
79
+
- cpp
56
80
57
-
Just like for LeetCode you have one file where you solve the problem. For example, for the problem called TwoSum there is **problem_builds/problems/TwoSum/cpp/solution.cpp**. To add new test cases you can create a file in **problem_builds/problems/TwoSum/testcases/** directory with the extension **.test** and your solution will be automatically tested against it.
81
+
Just like for LeetCode, you have one file where you solve the problem. For example, the problem called TwoSum has **problems/TwoSum/cpp/solution.cpp**. To add new test cases, you can create a file in the **problems/TwoSum/testcases/** directory with the file extension **.test**, and the solution will automatically be tested against it.
58
82
59
-
The problem is a LeetCode problem description in the ***description.md*** file location in the directory for each problem. For example ***problem_builds/problems/TwoSum/description.md***.
83
+
Each problem is described in the ***description.md*** file location in the problem's directory. For example ***problems/TwoSum/description.md***.
60
84
61
-
The format of the .test files are as follows
85
+
The format of the .test files are as follows:
62
86
63
87
```text
64
-
arg1
65
-
arg2
66
-
expected results
88
+
<arg1>
89
+
<arg2>
90
+
<expected results>
67
91
```
68
92
69
-
Each line is either an integral type (1, 4.6 etc.), or an array of integral types. For example:
93
+
Each line is either an integral type, a string, or an array. For example:
70
94
71
95
```text
72
-
[1, 2, 4]
96
+
["1", "2", "4"]
73
97
8.0
74
98
[0, 0]
75
99
```
76
100
77
-
For C++ the supported types are: integral types, strings, vector of integral types.
78
-
79
101
## List of LeetCode Problems
80
102
* TwoSum
81
103
* LongestSubstringWithoutRepeatingCharacters
82
104
* NumberOfIslands
83
105
84
-
The problem names are automatically extracted from the folder names inside **data/problems/**.
106
+
The problem names are automatically extracted from the **problems** folder.
OpenLeetCode problem builder. This script builds and tests a leetcode like problems locally. Currently, it only supports C++ language but it can be extended to support other languages.
113
+
OpenLeetCode problem builder. This script builds and tests LeetCode-like problems locally. Currently, it only supports the C++ language, but it can be extended to support other languages.
92
114
93
115
options:
94
116
-h, --help show this help message and exit
@@ -99,14 +121,16 @@ options:
99
121
--problem problem_name, -p problem_name
100
122
Name of the problem to build and test. Default: TwoSum. Use --list-problems to list all problems.
101
123
--problem_builds_dir dir, -d dir
102
-
Path to a directory with the problems. Usually ./problem_builds/ directory. Default: problem_builds.
124
+
Specifies the directory with the problems. Typically, this is './problem_builds'. If not provided, the script defaults to './problem_builds' in the same directory as the executable.
125
+
--run-expected-tests, -r
126
+
Run the expected solution. Default: False.
103
127
--testcase testcase_name, -t testcase_name
104
128
Name of the testcase to run. '--testcase All' will run all testcases. Default: All.
105
129
--verbose, -v Print verbose output
106
130
```
107
131
108
132
## Note
109
-
Curently only C++ is supported but the framework is setup such that other languages can be added. Also, the question description and the solution is yet to be worked on.
133
+
Curently only C++ is supported but the framework is setup such that other languages can be added.
110
134
111
135
## Requirements
112
136
This project requires the following to run:
@@ -115,6 +139,9 @@ This project requires the following to run:
115
139
- CMake 3.12
116
140
- Git
117
141
142
+
#### Additional Requirements for the UI
143
+
- npm
144
+
118
145
## Contributing
119
146
Feel free to contribute with code, test cases, or even code reviews.
0 commit comments