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 solved it by,
Sorting the array,
Finding toys whose weights are between min and min+4,
Consider them as a unit,
Loop till the end of sorted array
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 solved it by, Sorting the array, Finding toys whose weights are between min and min+4, Consider them as a unit, Loop till the end of sorted array