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.
'looks like you solved it'
The result of
int
+int
is of typeint
.Check the braces and think about the case when the smallest number is encountered multiple times.
I just tried it, there are no issues.
It's a wrong assumption that
long
is always 32 bits.long
is not less thanint
and not less than 32 bits. In 64-bit Linux it's 64 bits.You are probably converting to
unsigned long
when it's too late and the result is already truncated (at best; or even more likely undefined).I tried to change the function to unsigned long but I get the same error.
This comment is hidden because it contains spoiler information about the solution