Description
Solutions
Submission
Romanizer

The table below contains some reference values for converting between integers (i.e., Arabic numberals) and Roman numerals:

Given an integer, convert it to its Roman numberal equivalent.

Function Description

Complete the function romanizer in the editor.

romanizer has the following parameter(s):

  • int[] numbers : an array of integers
  • Returns

  • String[n] an array of strings that represent the integers as their Roman numeral equivalents.
  • Example 1:

    Input:  numbers = [1, 49, 23]
    Output: ["I", "XLIX", "XXIII"]
    Explanation:
    Looking at the conversions above, 1 is represented as I (capital I), 49 is 40 + 9, so XLIX, and 23 is XXIII.The return array is ["I", "XLIX", "XXIII"].

    Example 2:

    Input:  numbers = [1, 2, 3, 4, 5]
    Output: ["I", "II", "III", "IV", "V"]
    Explanation:
    We perform the following n = 5 conversions on the array [1, 2, 3, 4, 5]: 0. numbers[0] = 1 corresponds to Roman numeral I. 1. numbers[1] = 2 corresponds to Roman numeral II. 2. numbers[2] = 3 corresponds to Roman numeral III. 3. numbers[3] = 4 corresponds to Roman numberal IV. 4. numbers[4] = 5 corresponds to Roman numeral V. Return the array ["I", "II", "III", "IV", "V"] as the answer.

    Example 3:

    Input:  numbers = [75, 80, 99, 100, 50]
    Output: ["LXXV", "LXXX", "XCIX", "C", "L"]
    Explanation:
    Perform the following n = 5 conversion on the array [75, 80, 99, 100, 50]. 0. numbers[0] = 75 corresponds to Roman numeral LXXV, L(50) + X(10) + X(10) + V(5). 1. numbers[1] = 80 corresponds to Roman numeral LXXX, L(50) + X(10) + x(10) + X(10). 2. numbers[2] = 99 corresponds to Roman numeral XCIX, XC(90) + IX(9). 3. numbers[3] = 100 corresponds to Roman numeral C. 4. numbers[4] = 50 corresponds to Roman numeral L. Return the array ["LXXV", "LXXX", "XCIX", "C", "L"] as the answer.
    Constraints:
    • 1 <= n <= 1000
    • 1 <= numbers[i] <= 1000
    Testcase

    Result
    Case 1

    input:

    output: