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 have also done it with a usual O(N*log(N)) sorting mehtod. The solution in the editorial may be interpreted as a counting sort based algorithm, which is O(N). If the weights were arbitrary, then that may not have been possible. So conceptually both the solutions are the same.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Priyanka and Toys
You are viewing a single comment's thread. Return to all comments →
I have also done it with a usual O(N*log(N)) sorting mehtod. The solution in the editorial may be interpreted as a counting sort based algorithm, which is O(N). If the weights were arbitrary, then that may not have been possible. So conceptually both the solutions are the same.