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.
The hidden tests do not always test for numbers like "7000" or "400". Code, that does not handle those numbers, can pass the hidden tests if the user is lucky. I suggest to hardcode a number like "7000" or "400" into the hidden test.
unsigned long long
would be even better since the input is never negative. it also avoids the problem thatlong
is 32-bit in Windows world and 64-bit in Linux world, making code less portable for no reason (long long
is 64-bit in both)bool
(from<stdbool.h>
)unsigned
0
,10
,1000
,1001
,2001
static
, otherwise the user might call themOkay I think I've fixed it, could you check if it works for you now?
Are you sure your solution is still correct after making changes below?
For random input:
735027429
smallest:
202345779
largest:
977543220
actual result:
0
expected result:
1
oh okay, I'll try to fix it
No, don't use floating point numbers (float, single, double, half, quad, extended, ...) to solve integer problems.
No, I changed it to long
Okay ty, I changed it to double
Reference solution fails when
num
>$2^{23}$
.Never use floats unless strictly necessary.
Is there any reason why the input is
int
and notlong
?long
would be more appropriate for this kata.Thanks for the suggestions, I've added that now
I see a viable kata here, but the tests should be tougher. Currently there are only three difficult inputs, all hard-coded. I suggest:
No, that does become a decimal number; since 1034456789 (the lowest, can't start with 0) + 9876544310 = 10911001099 which ends in 9 so is a decimal point when devided by 2. I also added that numbers can't start with 0 to the description since it was unclear before
Edit: wait nevermind I was just wrong it's fixed now though cuz it has random numbers
Ty I fixed it
Loading more items...