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.
thank( you );
Another great kata from you. Thanks, DM!
Haha! You know it is possible, but your cached bitset works better. Bravo!
👍
C-style cast makes it 98% close. XD
Your idea with ranges sounds great.
No, using xor does not make the function redundant.
The trick with implicit conversion (boolean to integer):
👍 Very interesting kata. Thanks!
Why? Test several sequences and find a pattern.
This comment is hidden because it contains spoiler information about the solution
UPD:
next( &c )
is a valid address for dereference. There will be a data character or a null-terminator.basic_string
is implemented as:[ size_t __cap_ ][ size_t __size_ ][ char* __data_ (ends with \0) ]
UPD: After some research and tests, I've noticed, that Clang 8 implements strings with a null-terminator in the memory layout. Technically, I dereference not
std::string::end
(which would be UB), but the address in memory, where\0
is located.thank( you );
NB: if the sizes are different,
at()
throws an exception.NOTE
Hash map is more efficient, string is more concise.It's up to you which one to use in such a small problem.
Happy coding, fellow warriors!
Loading more items...