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.
Is it just me, or is the limitation on resources forcing the solutions to be overly hacky/ugly?
Obviously if you aren't using tries then you're not going to make it, but my best implementation had a few test cases fail due to segmentation faults. I suspected this might have to do with my heavy use of dictionaries (Python 2) to store the children in a children[char] = trie_node() fashion, so I turned it into a list... I no longer got segmentation faults but now it times out even though I have a lookup array so that I don't have to iterate through the children like crazy.
After reading through some discussion posts that passed, it seems most/all of them had to use some method which goes against coding best practices in the name of simply getting it to work.
I hope I'm wrong - perhaps I'm just not seeing the right optimization opportunity. Anyone else struggling with this aspect of the problem?
Tries: Contacts
You are viewing a single comment's thread. Return to all comments →
Is it just me, or is the limitation on resources forcing the solutions to be overly hacky/ugly?
Obviously if you aren't using tries then you're not going to make it, but my best implementation had a few test cases fail due to segmentation faults. I suspected this might have to do with my heavy use of dictionaries (Python 2) to store the children in a children[char] = trie_node() fashion, so I turned it into a list... I no longer got segmentation faults but now it times out even though I have a lookup array so that I don't have to iterate through the children like crazy.
After reading through some discussion posts that passed, it seems most/all of them had to use some method which goes against coding best practices in the name of simply getting it to work.
I hope I'm wrong - perhaps I'm just not seeing the right optimization opportunity. Anyone else struggling with this aspect of the problem?