• + 0 comments

    Actually your answer is little bit wrong. You forgot the case that index 0 can be the largest number. test your code with following custom input; 5 4 1 1 500 2 4 100 3 5 200 2 5 100 you will see that output is 400 but it should be 500