Skip to content

Add p0012: Integer to Roman#11

Merged
MNnazrul merged 1 commit intomainfrom
p0012-integer-to-roman
Apr 20, 2026
Merged

Add p0012: Integer to Roman#11
MNnazrul merged 1 commit intomainfrom
p0012-integer-to-roman

Conversation

@MNnazrul
Copy link
Copy Markdown
Owner

Problem

Changes

  • Solution file added in src/
  • Module registered in src/lib.rs
  • Tests included with LeetCode examples
  • Tutorial added in book/src/problems/
  • Entry added to book/src/SUMMARY.md
  • Row added to problems table in README.md

CI Checks

  • cargo fmt --check
  • cargo clippy
  • cargo test
  • mdbook build

Greedy reduction over 13 value/symbol pairs (7 base + 6 subtractive)
sorted descending. For each pair, emit the symbol `num / value` times
and take the remainder. The expanded table means greedy never gets
stuck producing invalid forms like IIII. O(1) time and space given
the 1..=3999 bound.

Tutorial covers the intuition behind the expanded table, why greedy
is correct, a dry run of 1994, and edge cases at 1, 4, 3749, 3999.
@MNnazrul MNnazrul merged commit bd06abb into main Apr 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant