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'm completely stumped by exit code 139, presumably a segfault, running the sample tests in the web interface. I can't reproduce locally and valgrind/ubsan/asan don't see anything wrong in my code. My code does no heap allocations and the vector indexing in the sample tests dont overrun the vector. So haven't a clue. I'm using g++ 7.3 and clang++ 6.0.
Not posting the solution code here (yet), but here's the steps I'm taking locally:
Here's a rust translation...
Added rust version. Looks like OP not been active for some time. What happens next?
To say there's a C++ version of this Kata is stretching things somewhat. The challenge's "interface" is identical to the C version. Instead of this:
what about this?
and you could get rid of the block struct and those macros, which while tolerated in C, are considered bad practice in C++ (even more so lower case ones). It also doesn't force the caller to manage the memory of the returned pointers (the sample tests as they stand leak memory).
I'm trying to learn to code in rust. There are a lot of Katas like this one where the real effort is in reducing the problem to a simple mathematical statement then implementing a one-liner solution.
Don't get me wrong I do enjoy puzzles like this, but they aren't helping me learn what I came here to learn.