Confusingly, the max and min values are called "max" and "min" respectively.
The code is crazy for its use of so many variables,with such broad scope.
Confusingly, the max and min values are called "max" and "min" respectively.
The code is crazy for its use of so many variables,with such broad scope.
It's easy to fall into the trap of hitting the keyboard too soon and thinking you can hammer out working code.
Forget code for a while- what's your algorithm, your approach? How would you do it manually? Write that down....
You're walking down the street looking for the biggest house. How do you do that? You look at the first house, and remember the size. After that, if a house is bigger than the remembered house, it's your "new biggest house". At the end of the street, the biggest house you remembered is the biggest house.
Not rocket science.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.