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.
For what It's worth I solved this using javascript first and then tested with python3. It timedout in python3 but it did work just fine using pypy3. After creating a trie I iteratively searched starting at the back of the string and only if the number is 2, 4, 6, or 8. I haven't seen any comments suggesting such an efficient algorithm.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Two Two
You are viewing a single comment's thread. Return to all comments →
For what It's worth I solved this using javascript first and then tested with python3. It timedout in python3 but it did work just fine using pypy3. After creating a trie I iteratively searched starting at the back of the string and only if the number is 2, 4, 6, or 8. I haven't seen any comments suggesting such an efficient algorithm.