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.
Not to nit-pick here, but your math is a little off. In Python a string takes up 40 bytes to begin with and since our parameters are that 1 =< N =< 10^5 and 1 =< name =< 21, that means that a string with a maximum possible length of 21 only takes up ~46 bytes in memory:
importsyssys.getsizeof('abcdefghijklmnopqrstu')
If you multiply this by the maxium possible entries, not including find operations, it comes out to ~4.6 MBs.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Tries: Contacts
You are viewing a single comment's thread. Return to all comments →
Not to nit-pick here, but your math is a little off. In Python a string takes up 40 bytes to begin with and since our parameters are that 1 =< N =< 10^5 and 1 =< name =< 21, that means that a string with a maximum possible length of 21 only takes up ~46 bytes in memory:
If you multiply this by the maxium possible entries, not including find operations, it comes out to ~4.6 MBs.