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 do not think this should work.say you find a case where the prices happen to only increase, then ths would mean that there would not be a solution since the result must be a loss, but your algorithm would still find the solution due to its use of sorting. i am also not sure if i am making sense
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Loss
You are viewing a single comment's thread. Return to all comments →
i do not think this should work.say you find a case where the prices happen to only increase, then ths would mean that there would not be a solution since the result must be a loss, but your algorithm would still find the solution due to its use of sorting. i am also not sure if i am making sense