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.
I've just checked it, and according to this SO question starting from
C++ 11
string are immutable objects (as I thougt from the beginning).Trying using
int -> string
conversions and string concatenation instead.I totally agree with your logic, copying your example in its entirity and using the g++ compiler runs and produces the correct result without issue.
This is certainly an issue with how the code is compiled/run in the Kata environment, and not a product of the kata itself.
I will mark this as resolved for now, but please feel free to continue the discussion :)
You can add char and int because char is int (partially).
I'm not sure, but I have an insane theory that after mutating the string like you are doing, something really bad happens to it. Try using working with a string as if it was a string (and not a char array (duh)), and I think it may work then.
This is your issue:
out[8] = '0' + result % 10;
You are trying to add together a character and an integer.
Please let me know if your solution works and I will mark this as resolved.
Ps. The way that you are checking for the instruction is clever!
Could you share what you have? Mark it with a spoiler flag please thanks!
I've rewritten the solution again.
Note that the answer in your example is actually 22 : you forgot to count a 'v'.
I think you are still on the old reference solution, in which there was a typo. You may want to save your solution and reset the kata to get the new reference solution.
When you pose a question about your code don't post an issue - which makes the author lose honor - simply label your post with "Question".
Yes, they are indeed collinear. (1, 0, 4) cuts the line segment formed by (-7, 0, 0) and (5, 0, 6) in a 2:1 ratio:
(1 - -7):(5 - 1) === 8:4 === 2:1
y1 === y2 === y3 === 0
(4 - 0):(6 - 4) === 4:2 === 2:1