Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 19130b5

Browse files
committed
Update README.md with new build instructions.
1 parent 209af30 commit 19130b5

File tree

2 files changed

+58
-37
lines changed

2 files changed

+58
-37
lines changed

‎README.md

Lines changed: 56 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ OpenLeetCode - An open source version of LeetCode
22
--------------------------------------------------------
33
Welcome to the OpenLeetCode Project!
44

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). It is by no means intended to replace or replicate leetcode.com.
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.
66

77
## Table of Contents
88

@@ -21,67 +21,83 @@ The motivation behind this project is to be able to practice LeetCode problems o
2121
## Windows Terminal
2222

2323
### Build
24+
#### Building without UI
2425
```cmd
25-
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DPROBLEM_BUILDS_NAME=problem_builds
26+
cmake -B build -DCMAKE_INSTALL_PREFIX=install
2627
cmake --build build
27-
cmake --install build --config Debug
28+
cmake --install build --prefix=install
29+
```
30+
#### Building with UI
31+
```cmd
32+
cmake -B build -DCMAKE_INSTALL_PREFIX=install -DBUILD_UI=ON
33+
cmake --build build
34+
cmake --install build --prefix=install
2835
```
2936
### Run
30-
#### Windows Terminal
37+
#### CLI - Windows Terminal
3138
```cmd
32-
./problem_builds/openleetcode --problem_builds_dir ./problem_builds --language cpp --problem TwoSum
39+
./problem_builds/openleetcode --language cpp --problem TwoSum
3340
```
34-
#### Unix
41+
#### CLI - Unix
3542
```bash
36-
./problem_builds/openleetcode.sh --problem_builds_dir ./problem_builds --language cpp --problem TwoSum
43+
./problem_builds/openleetcode.sh --language cpp --problem TwoSum
3744
```
45+
#### UI - Windows Terminal
46+
```cmd
47+
./problem_builds/openleetcodeui
48+
```
49+
#### UI - Unix
50+
```bash
51+
./problem_builds/openleetcodeui.sh
52+
```
53+
NOTE: UI for unix is yet to be tested.
54+
55+
3856

3957
## How To Use
40-
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:.
58+
After the build succeeds, the following directory structure will be generated:
4259

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
60+
- problems
61+
- NumberOfIslands
62+
- cpp
63+
- solution.cpp
64+
- ...
65+
- testcases
66+
- TestCase1.test
67+
- TestCase2.test
68+
- ...
69+
- description.md
70+
- TwoSum
71+
- ..
72+
- launguage
73+
- cpp
5674

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.
75+
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 a new test cases you can create a file in **problems/TwoSum/testcases/** directory with file extension **.test** and the solution will automatically be tested against it.
5876

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***.
77+
Each problem is described in the ***description.md*** file location in the problem's directory. For example ***problems/TwoSum/description.md***.
6078

61-
The format of the .test files are as follows
79+
The format of the .test files are as follows:
6280

6381
```text
64-
arg1
65-
arg2
66-
expected results
82+
<arg1>
83+
<arg2>
84+
<expected results>
6785
```
6886

69-
Each line is either an integral type (1, 4.6 etc.), or an array of integral types. For example:
87+
Each line is either an integral type, a string, or an array. For example:
7088

7189
```text
72-
[1, 2, 4]
90+
["1", "2", "4"]
7391
8.0
7492
[0, 0]
7593
```
7694

77-
For C++ the supported types are: integral types, strings, vector of integral types.
78-
7995
## List of LeetCode Problems
8096
* TwoSum
8197
* LongestSubstringWithoutRepeatingCharacters
8298
* NumberOfIslands
8399

84-
The problem names are automatically extracted from the folder names inside **data/problems/**.
100+
The problem names are automatically extracted from the **problems** folder.
85101

86102
## Usage
87103
```text
@@ -99,14 +115,16 @@ options:
99115
--problem problem_name, -p problem_name
100116
Name of the problem to build and test. Default: TwoSum. Use --list-problems to list all problems.
101117
--problem_builds_dir dir, -d dir
102-
Path to a directory with the problems. Usually ./problem_builds/ directory. Default: problem_builds.
118+
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.
119+
--run-expected-tests, -r
120+
Run the expected solution. Default: False.
103121
--testcase testcase_name, -t testcase_name
104122
Name of the testcase to run. '--testcase All' will run all testcases. Default: All.
105123
--verbose, -v Print verbose output
106124
```
107125

108126
## 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.
127+
Curently only C++ is supported but the framework is setup such that other languages can be added.
110128

111129
## Requirements
112130
This project requires the following to run:
@@ -115,6 +133,9 @@ This project requires the following to run:
115133
- CMake 3.12
116134
- Git
117135

136+
#### Additional Requirements for the UI
137+
- npm
138+
118139
## Contributing
119140
Feel free to contribute with code, test cases, or even code reviews.
120141

‎src/app/openleetcode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def getExeExtension():
4242
def main():
4343
parser = argparse.ArgumentParser(
4444
description="OpenLeetCode problem builder. This script builds and "
45-
"tests a leetcode like problems locally. Currently, it "
46-
"only supports C++ language but it can be extended to "
45+
"tests a LeetCode-like problems locally. Currently, it "
46+
"only supports C++ language, but it can be extended to "
4747
"support other languages.")
4848
parser.add_argument(
4949
"--language", "-l",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /