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.
To initialize them to some number to prevent comparisons between a number and NaN. Typically we use zero for that, but that would mess up the comparisons. So this uses the highest possible int so comparisons will still work ok.
If the input array is reverse sorted, I think this solution would fail.
If the input array were
{ 1000, 999, 998, 997 }
, onlylowone
would ever be assigned.(Unless I'm missing something?)
Is there a benefit to doing this?
Oh nevermind - because you get overflow when trying to add two really big ints together...just got it :)
Why doesn't this work if you make the longone and longtwo variables ints instead of long?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
According to problem text, cannot happen
negative numbers as input?
array1->[2 2 9]
array2->[4 9 9]