๐งช leetrs test & leetrs submit
Commands for executing code against sample test cases and submitting solutions to LeetCode judging servers.
๐งช leetrs testโ
Executes your local solution file against sample test cases without recording an official submission on LeetCode.
Usageโ
leetrs test <FILE>
Argumentsโ
| Argument | Type | Description |
|---|---|---|
<FILE> | path | Path to the local solution file (e.g. two_sum.rs, two_sum.py) |
Workflowโ
- Parses the metadata header comment inside
<FILE>to extract problem ID, slug, and language. - Sends a
test-runpayload to LeetCode's judging API. - Polls judging status asynchronously until complete.
- Renders colored test results: passed test cases, runtime, output vs expected output, and compiler errors.
Exampleโ
leetrs test two_sum.rs
๐ leetrs submitโ
Submits your local solution file to LeetCode for official judging and profile score updating.
Usageโ
leetrs submit <FILE>
Argumentsโ
| Argument | Type | Description |
|---|---|---|
<FILE> | path | Path to the local solution file (e.g. two_sum.rs, two_sum.py) |
Output Metricsโ
Upon completion, leetrs submit displays:
- Judge Status:
Accepted,Wrong Answer,Time Limit Exceeded,Compile Error, orRuntime Error. - Test cases passed: e.g.,
57 / 57 testcases passed. - Runtime Performance: e.g.,
0 ms(Beats100.00%of Rust submissions). - Memory Usage: e.g.,
2.1 MB(Beats98.50%of Rust submissions).
Exampleโ
leetrs submit two_sum.rs