We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all 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