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)
- Host: GitHub
- URL: https://github.com/diraneyya/leetcode-romantoint-tests
- Owner: diraneyya
- Created: 2025-02-03T17:03:01.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-03T17:05:00.000Z (over 1 year ago)
- Last Synced: 2025-08-28T08:32:03.593Z (10 months ago)
- Language: TypeScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.