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.
Your code fails to address this -->
There are no fractions of people. At the end of each year, the population count is an integer: 252.8 people round down to 252 persons.
Sorry for delay on answering.
You can think about that if you need to move 1 box to the second, then move 100 to first (
[1, 100]
). See what your code return, compare with the correct answer counting by yourself.This comment is hidden because it contains spoiler information about the solution
thank u bro
Carefully read the first example in the description.
If needed, perform your algorithm by hand and compare the results for each step.
This comment is hidden because it contains spoiler information about the solution
Hi @MichosDV - it seems that you have passed the kata, so just adding this comment so that other users don't think there is anything weird/problems with the kata.
FYI, your problem is/was probably due to the behaviour of
//
, for example:you can see above that multiplying by 6 then
//
6 just has the effect of rounding your answer; the specific value of6
is irrelevant - you could just as well use591227
as I did above.The "exact solution" - being made up of a sum of integers - shouldn't need to be rounded though at any point, so I'm not sure where your tiny mistake crept in.
The exact solution does not pass. Multiplied by 6, then //6, and all the tests passed.
i don't understand the task and "Euler transform"
which language?
You must use BigInt for all numbers in this kata. When you have an integer in variable
a
, you can wrap it asBigInt(a)
. When you have a value, let's say 10, you can make it a BigInt by appending 'n' to it10n
There are 500 random tests. You should try to optimize more
How many random tests are in the attempt? I get around 60 and I cannot complete them within 12 seconds.