Integer to Roman Conversion

Given an integer N, convert it to its corresponding Roman numeral representation. Roman numerals comprise seven symbols: I, V, X, L, C, D, and M.

Example:

Input:
N = 2
Output:
II
Explanation:

The integer 2 is represented by the Roman numeral II.

Input:

Input:
12
Output:
XII
Explanation:

The integer 12 is represented as XII.

Example:

Input:
27
Output:
XXVII
Explanation:

The integer 27 is represented as XXVII.

Constraints:

  • 1 <= T <= 102
  • 1 <= N <= 4 * 103 - 1

Note: You do not need to print the output; just implement the conversion function.

AnswerBot
7d

Convert an integer to its corresponding Roman numeral representation.

  • Create a mapping of integer values to Roman numeral symbols

  • Iterate through the mapping in descending order of values and build the ...read more

Help your peers!
Add answer anonymously...
PayPal Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter