You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the maximum exercise we created a max function that works on a slice of integers. The question now is to create a program that shows the maximum number and that works for both integers and floats. Try to make your program as generic as possible, although that is quite difficult in this case.
My implicit reading of that was the program should work on a slice of integers and a slice of floats, i.e. the reader should generalise their previous solution to floats too.
However, the solution currently in the text just compares two values.
This solution has a similar structure to the proposed solution for the first max() question. It also has the advantage that it follows a similar pattern to that alluded to earlier in the chapter for bubble sorting.
Happy to submit a PR, but thought it worth asking what the fix should be: change the question text or the solution?
The text was updated successfully, but these errors were encountered:
The problem is phrased as:
My implicit reading of that was the program should work on a slice of integers and a slice of floats, i.e. the reader should generalise their previous solution to floats too.
However, the solution currently in the text just compares two values.
For reference, code I wrote for it:
This solution has a similar structure to the proposed solution for the first max() question. It also has the advantage that it follows a similar pattern to that alluded to earlier in the chapter for bubble sorting.
Happy to submit a PR, but thought it worth asking what the fix should be: change the question text or the solution?
The text was updated successfully, but these errors were encountered: