You are viewing a single comment's thread. Return to all comments →
Even faster than using a dict is to use a "count list" with index ord (char) - 65. So this list starts with ord ("A") - 65 = 0. O (1) instead of O (log n) for access to count of char. Here my solution: https://www.hackerrank.com/challenges/happy-ladybugs/submissions/code/109012363
Seems like cookies are disabled on this browser, please enable them to open this website
Happy Ladybugs
You are viewing a single comment's thread. Return to all comments →
Even faster than using a dict is to use a "count list" with index ord (char) - 65. So this list starts with ord ("A") - 65 = 0. O (1) instead of O (log n) for access to count of char. Here my solution: https://www.hackerrank.com/challenges/happy-ladybugs/submissions/code/109012363