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.
C translation
Thanks! Updated the description.
Error in table description
but integer is assumed
Thanks, fixed.
It can be easily done without exceeding BigInt size. I don't think randomising the length increases the complexity in any way - it's still just one check.
I have added an explicit max length of input data(64 bits) to simplify things. Sadly, I don't see any way to easily get the max value of
BigInt
so this will have to do.JS: it doesn't make much sense to have a single fixed test where calculations may exceed the maximum BigInt size. Easy to hardcode (see my solution). Either make random tests generate such occurences, but that would make the kata significatively harder compared with other languages, or just remove it.
Javascript:
export
in initial code makes the program crash.Thanks for the comment, I've updated the tests.
I've left
full length
andpartial length
as they were. 'partial length' means some bits may be trimmed from most significant bit's side, 'full length' means no bits trimmed.Decimal offsets are more readable than hexadecimal ones.
[Python]
In python "full length" and "partial length" don't make sense, "offet with sign bit set" is simply
4026531840
(without sign bit).Tests import
solution
but useextract_bit
. Use eitherimport solution
/solution.extract_bits
orfrom solution import extract_bits
/extract_bits
.No random tests.
This comment is hidden because it contains spoiler information about the solution
I solved this kata, but can anyone tell me what theorems from mathematics or algorithms will help to solve this problem more efficiently?
++
Helper method makes debugging much nicer. Great kata!
Thanks, I've updated the description.
Loading more items...