News for hackers. Stuff that matters.
Re:Life, the Universe and Technical Interviews by tempestn on Saturday August 02, 2014 @07:39PM (#8126441)
That sounds about right. Initializing the variables to the first two elements in the array is something very few people think to do. Most people set them to 0, which obviously doesn't work if the array doesn't contain at least two positive values. Of course, Blackthorn is also right that it's language-dependent. Most languages give you negative infinity, or treat null or false as negative infinity in comparisons, which makes things simpler.

There are no comments on this comment yet.