Pergunta de entrevista da empresa Meta

Write a function in Javascript that takes Roman numerals (in String form) and convert it to decimal form. Assume the string is well-formed.

Respostas da entrevista

Sigiloso

17 de ago. de 2010

I kind of stumbled to get to this solution. It's much easier to code alone than having someone on the other side, so keep that in mind when you interview.

1

Sigiloso

27 de fev. de 2012

var romanToDecimal = function (n) { var table = { I : 1, V : 5, X : 10, L : 50, C : 100, D : 500, M : 1000 }, value = 0, current, next, i, j; for (i = 0, j = n.length; i current ? -1 : 1); } return value; }