educative.io

Find Maximum in a List

In the example explained where we are finding the index and the max value from the given list what if the list has duplicate values.

This depends entirely on your implementation. If there are duplicates for the maximum value in the list, you could either return the first instance of the value, or the last. Either implementation is correct.

However, if the question specifies which instance to return, you should follow those instructions.