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.
The worst case memory complexity of this solution is O(c^L) where c is the number of possible character (in our case 26) and L is the max length of the querry (in our case 21). I agree that O(26^21) is O(1) as these are constants but this means that the worst case memory complexity is 26^21 * 8 bytes ~= 10^28 TeraBytes. I'm not sure what you mean by "size isn't an issue in python" but I'm pretty sure that you can' keep that in memory ! And this in this case they were nice enough to tell us that there are only lower case english caracters. Bottom line : you don't want to show that in an interview
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 →
The worst case memory complexity of this solution is O(c^L) where c is the number of possible character (in our case 26) and L is the max length of the querry (in our case 21). I agree that O(26^21) is O(1) as these are constants but this means that the worst case memory complexity is 26^21 * 8 bytes ~= 10^28 TeraBytes. I'm not sure what you mean by "size isn't an issue in python" but I'm pretty sure that you can' keep that in memory ! And this in this case they were nice enough to tell us that there are only lower case english caracters. Bottom line : you don't want to show that in an interview