Skip to main content

๐Ÿงช 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โ€‹

ArgumentTypeDescription
<FILE>pathPath to the local solution file (e.g. two_sum.rs, two_sum.py)

Workflowโ€‹

  1. Parses the metadata header comment inside <FILE> to extract problem ID, slug, and language.
  2. Sends a test-run payload to LeetCode's judging API.
  3. Polls judging status asynchronously until complete.
  4. 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โ€‹

ArgumentTypeDescription
<FILE>pathPath 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, or Runtime Error.
  • Test cases passed: e.g., 57 / 57 testcases passed.
  • Runtime Performance: e.g., 0 ms (Beats 100.00% of Rust submissions).
  • Memory Usage: e.g., 2.1 MB (Beats 98.50% of Rust submissions).

Exampleโ€‹

leetrs submit two_sum.rs