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.
Loop through the array. For each element, check if (m-cost) is present in rest of the array (arr index i+1 to end). If it is present then just find the index of (m-cost) in rest of the array. You need to add (i+2) to get the real index of (m-cost) in the array arr.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
Little cyrptic code in Python2 ;)
Loop through the array. For each element, check if (m-cost) is present in rest of the array (arr index i+1 to end). If it is present then just find the index of (m-cost) in rest of the array. You need to add (i+2) to get the real index of (m-cost) in the array arr.