hackerrank.com

Practice>Python>Regex and Parsing>Validating Roman Numerals

건이두 2019. 4. 11. 12:47
728x90

hackerrank.com

Validating Roman Numerals

Problem Link : https://www.hackerrank.com/challenges/validate-a-roman-number/problem

Difficulty : Easy

 

Tip

  • Problem itself is simple
  • We should under stand what is roman number character
  • Here is regular expression, to capture roman number chracter
  • (^(?=[MDCLXVI])M*(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$)
  • This allows MMMM, so it lead the failure of test case 4
  • Please spend some time to read links below
  • Best answer for this problem
  • https://www.hackerrank.com/challenges/validate-a-roman-number/forum/comments/536680

 

Good explanation of Roman number character

Solution

728x90