FastPrepRoman to Integer
Problems/Roman to Integer

Roman to Integer

Kotak Mahindra Bank logoKotak Mahindra Bank● EasyFULLTIMEPHONE SCREENONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The reported task identifies this algorithmic exercise. The callable interface, bounds, deterministic rules, and examples are the documented practice contract.

Given the canonical uppercase Roman-numeral representation of an integer from 1 through 3999, return its integer value.

The subtractive pairs are IV, IX, XL, XC, CD, and CM.

Function

romanToInteger(roman: String) → int

Examples

Example 1

roman = "III"return = 3

The signed local contribution of each symbol reproduces canonical additive and subtractive notation.

Example 2

roman = "IV"return = 4

The signed local contribution of each symbol reproduces canonical additive and subtractive notation.

Example 3

roman = "IX"return = 9

The signed local contribution of each symbol reproduces canonical additive and subtractive notation.

Constraints

  • 1 <= roman.length <= 15.
  • roman is the canonical uppercase representation of a value from 1 through 3999.

Source note: Author-written prompt excerpt retained for source fidelity.

More Kotak Mahindra Bank problems

  • Best Time to Buy and Sell StockONSITE INTERVIEW · Seen Nov 2026
  • Best Time to Buy and Sell Stock IIONSITE INTERVIEW · Seen Nov 2026
  • Maximum Non-Adjacent Coins in Two RowsONSITE INTERVIEW · Seen Oct 2026
All Kotak Mahindra Bank interview questionsSee Kotak Mahindra Bank hiring insights
Saved
class Solution {
    public int romanToInteger(String roman) {
        // Write your code here.
    }

}
Checking account…