An open API service indexing awesome lists of open source software.

https://github.com/diraneyya/leetcode-romantoint-tests

Offer feedback to leetcode's romanToInt (from Mastodon)
https://github.com/diraneyya/leetcode-romantoint-tests

Last synced: 10 months ago
JSON representation

Offer feedback to leetcode's romanToInt (from Mastodon)

Awesome Lists containing this project

README

          

# leetcode-romantoint

To install dependencies:

```bash
bun install
```

To run the tests:

```bash
bun test
```

The project uses `clang` after installing (`llvm` and `lld` need to be installed) to compile a C function to WASM and then run a few tests on it using _bun_ (with a [syntax](./main.test.ts) similar to **Jest**)

## Test Cases

Please inspect the test cases in the [main.test.ts](./main.test.ts) file, located in this repository.

## Discussion

(I used an LLM to try to summarize my thoughts and be more concise)

The challenge becomes either:

- A trivial summation exercise (ignoring validity), or
- A parser-design problem with rigid validation rules.

True difficulty arises only when combining validity checks, large-input handling, and overflow detection. A scope maybe beyond this LeetCode question. To make it compelling, one must:

- Explicitly define validity rules (e.g., canonical forms only),
- Enforce strict left-to-right monotonicity,
- Handle extreme values (e.g., 32-bit/64-bit boundaries),
- Address additive/subtractive edge cases systematically.

Without these constraints, the problem remains an introductory string-to-value conversion task.