I don't see how this could be considered "Best Practice" or "Clever". It needs O(n*logn) in time to do something that could be done in O(n)
O(n*logn)
O(n)
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
This comment is hidden because it contains spoiler information about the solution
Here C. 3rd test expects 80 but result is 81.
Loading collection data...
I don't see how this could be considered "Best Practice" or "Clever".
It needs
O(n*logn)
in time to do something that could be done inO(n)
I don't see how this could be considered "Best Practice" or "Clever".
It needs
O(n*logn)
in time to do something that could be done inO(n)
It's a broken solution!
MCDXLIII
is1443
but yoursolution("MCDXLIII")
is1663
because while reducing,
(1000+100)>500
while you thought that100<500
This comment is hidden because it contains spoiler information about the solution
Here C.
3rd test expects 80 but result is 81.