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.
I think that you should have:
"for(int j = n-1; j > 1; j--)"
as your "for" loop, as if you have j == 1, you cannot get a[j-2], as that would return an index of -1, which would throw an error.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Maximum Perimeter Triangle
You are viewing a single comment's thread. Return to all comments →
I think that you should have: "for(int j = n-1; j > 1; j--)" as your "for" loop, as if you have j == 1, you cannot get a[j-2], as that would return an index of -1, which would throw an error.