Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
No need to feel stupid, it was not an easy problem. Learn from it and keep going.
nice answer, really gave me some good ideas to try it again
This comment is hidden because it contains spoiler information about the solution
@123xylem if smaller number preceeds a larger one, both digits make up a number and so you need to skip the next itiration, otherwise you would double count the following digit. E.g. 4 = IV. If you didn't skip you'd count 4 + 5 (IV + V).
cause u add pairs of number in sum
This comment is hidden because it contains spoiler information about the solution
the "if" statement accounts for those values by subtracting a number from the sum if it is to the left of a larger number
for instance...
MCMXC = [1000, 100, 1000, 10, 100]
if(data[numbers[i]] < data[numbers[i+1])... this is triggered when data[numbers[1]] AKA 100 is less than data[numbers[1+1]] AKA 1000
so...sum += data[numbers[1+1]] - data[numbers[1]] AKA 1000 - 100
This fails the number 1990 (MCMXC) from the description.
You are missing CM, CD, XC, XL, IX, IV.
The solutions are correct because the description states "You don't need to validate the form of the Roman numeral."
However with this, the problem definitely doesn't feel like a level 4 kata
Most of the solutions I see there are not correct. For example your solution accepts "XXIC". You must check the correctness of order.The tests are way too weak.
Not an issue
So happy to see my solution on the top YEAHHH :D
it doesn't need to be converted.
because strings also have the attributes length and index.
feel so stupid for not thinking about this...
So that you may iterate through every object in the array, in this case every roman numeral.
Loading more items...