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.
Python
simply checking if a matching space container is there for every type of ball, worked out quite well, but I'm not sure about the complexities.
This one doesn't require that much space so if anyone can tell me if and where I can improve heavily on time complexity:
deforganizingContainers(container):# Write your code hereballs_in_container=sorted([sum(container[i])foriinrange(len(container))])# count no of each type of balln=len(container)freq_types={x:0forxinrange(n)}foriinrange(n):forjinrange(n):freq_types[j]+=container[i][j]balls_types=sorted([freq_types[i]foriinrange(n)])ifballs_types==balls_in_container:return'Possible'else:return'Impossible'
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Join us
Create a HackerRank account
Be part of a 26 million-strong community of developers
Please signup or login in order to view this challenge
Organizing Containers of Balls
You are viewing a single comment's thread. Return to all comments →
Python simply checking if a matching space container is there for every type of ball, worked out quite well, but I'm not sure about the complexities.
This one doesn't require that much space so if anyone can tell me if and where I can improve heavily on time complexity: