"Imagine that you will have to implement a function that find the maximum value from an array. That's easy! The simplest way to do it is to iterate through the entire array, compare the elements and store the maximum value. Here's the twist! That variable where you store the maximum value should be initialized with a very, very small value, the smallest." - no, you initialize the maximum with the first element (ofc, if it exists).
In this phrase I tried to describe the approach used in some classes with beginners (in high school for example) where the focus is that the student understands the big picture.
The "simplest way to do it" part should get you thinking about that, but maybe I should have been more clearer that is not a best practice.
Thanks for the intervention!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
"Imagine that you will have to implement a function that find the maximum value from an array. That's easy! The simplest way to do it is to iterate through the entire array, compare the elements and store the maximum value. Here's the twist! That variable where you store the maximum value should be initialized with a very, very small value, the smallest." - no, you initialize the maximum with the first element (ofc, if it exists).
Yes, you are right.
In this phrase I tried to describe the approach used in some classes with beginners (in high school for example) where the focus is that the student understands the big picture.
The "simplest way to do it" part should get you thinking about that, but maybe I should have been more clearer that is not a best practice.
Thanks for the intervention!