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.
Should I provide the code as well? I will provide the byte-by-byte comparison I did, just need to know if the code should be included.
There might be something wrong with the C++ translation. I wrote the C++ version and verified the output byte by byte to match the expected output and it did, but was rejected? I just basically converted my C++ solution into php and got a pass like that, but there might be something wrong with the C++. My solution passed all the tests but the very first hello world and the fibonacci tests, despite having the seemingly correct output.
O(1) solution. Awesome. Wish I would've figured it out. Very nice
Yes, that's logically equivalent
Amazing
(in its simplicity)
This is impressive
Don't know if this is relevant, but I have an O(n) solution in terms of the length of the source and it times out. Can't figure out how to process text any faster than this. Any optimization tips would be super appreciated.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Sure. Subtracting (char) '0' is a method to convert a char to it's integer value, assuming it represents a digit. For example, the character '7' has ASCII value 55, and the '0' character has ASCII value 48, so if you subtract '7' and '0', the result is integer 7.
So, I used it to convert each character in the string to a digit, character by character in the loop.
See my workaround below
It's a silly problem. I hope it gets fixed. Glad I could help out.
The parser's grammar is wrong; it produces errors for parentheses without subscripts following and 3-lettered atoms.
This comment is hidden because it contains spoiler information about the solution
In C++, to fix the assertion error you are all having, add ASCII 0 to the end of the returned string for every digit in the input. I detected this behavior when iterating through the characters in the input and found invalid null characters (equal to the number of digits) trailing.
For example: 2*5+7 contains 3 digits, so you need to add 0 0 0 to the end of your string input.
NB: that's not the digit 0, it's the ASCII 0/NUL character.
So instead of returning "257+", you should return "257+NULLNULLNULL"
Loading more items...