This comment is hidden because it contains spoiler information about the solution
I thought this was really cool, down to two lines, but it doesn't work for cases where single numerals need to be treated as such. For example, XIX returns 21 with this solution instead of 19 like it's supposed to.
Wrong solution, should not compare the element with the accumulator, but the previous element
I too submitted a solution that didn't work for irregular subtractive expressions (such as "MCDXLIII").
Thanks for finding this issue! I used #reduce incorrectly
It's a broken solution! MCDXLIII is 1443 but your solution("MCDXLIII") is 1663 because while reducing, (1000+100)>500 while you thought that 100<500
MCDXLIII
1443
solution("MCDXLIII")
1663
(1000+100)>500
100<500
Loading collection data...
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I thought this was really cool, down to two lines, but it doesn't work for cases where single numerals need to be treated as such. For example, XIX returns 21 with this solution instead of 19 like it's supposed to.
Wrong solution, should not compare the element with the accumulator, but the previous element
I too submitted a solution that didn't work for irregular subtractive expressions (such as "MCDXLIII").
Thanks for finding this issue! I used #reduce incorrectly
It's a broken solution!
MCDXLIII
is1443
but yoursolution("MCDXLIII")
is1663
because while reducing,
(1000+100)>500
while you thought that100<500