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.
No, it would only throw an exception if the number or compliment are not in the list or in the case where there are two costs the same, it finds the first and than starts in the list directly after that to find the second.
Basically, as long as you give it a legal number and compliment, it will never error because the indices will always be there.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Hash Tables: Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
No, it would only throw an exception if the number or compliment are not in the list or in the case where there are two costs the same, it finds the first and than starts in the list directly after that to find the second.
Basically, as long as you give it a legal number and compliment, it will never error because the indices will always be there.