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.
dont use
strcat()
on uninitialized memory (e.g. that returned bymalloc()
)My bad code, Although
A x B == B x A
, so I'm not sure that it matters all that much.Remember to mark as spoiler next time.
Но ведь js поддерживает индексацию с конца.
arr = [3, 2, 3]
arr[-1] === arr[0] // 3 = 3
sometimes it return error or not?
This comment is hidden because it contains spoiler information about the solution
It does, but javascript will return "undefined" for out-of-bounds errors instead of crashing, so it works anyway.
Production code is boring.
You can check out my 2 and 1 Kyu C translations though. I made about 50% of all of them.
This comment is hidden because it contains spoiler information about the solution
Yes, it is a good way to learn new things by studying other user solutions.
fmax
andsmax
have typeint
. therefore, the expressionfmax - smax
has typeint
also.In general, a signed integer type
T
cannot handle the difference betweenT_MAX
andT_MIN
. (e.g.2 ** 31 - 1 - -(2 ** 31) == 2 ** 32 - 1
which does not fit in anint
(it is equal toUINT_MAX
)).You seem to have understood that since you use
diff
with typeunsigned
; but it is too late because when the assignment is performed, the integer overflow has already taken place in the expression. You need to use larger types at the time you compute the difference.@yar83: Consider we receive an array of
int
, but we have to return along
, and there's a reason for that ;)it sounds like you're not handling
int
overflow properly, but without seeing your code it's hard to tell. if you post your code (with markdown and a spoiler flag) i can help you find the problemIn this case it lowercases the letter.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...