I'm trying to solve a programming challenge for fun. The programming challenge is here(http://uva.onlinejudge.org/external/100/10029.htmlhere) and my solution for the same can be found here).
My solution can be found below:It currently it causes aan exceeded time limit exceeded.
Instead of calculating the edit distance between strings (using is_edit_distance_oneis_edit_distance_one
) im, I'm generating a map with all possible edit strings of a string and checking if previous strings are present in it (using the function "generate").
- Are there any implementation level mistakes that I'm making thatsthat's slowing it down?
- Any particular data structure I should/should not be using?
- Any other algorithm I could use to speed things up?