News for hackers. Stuff that matters.
Re:The ReadyForZero Programming Challenge by apaprocki on Tuesday June 14, 2011 @05:08PM (#2654754)
> #pip install python-levenshtein > from Levenshtein import distance

That doesn't seem in the spirit of the challenge.

Re:The ReadyForZero Programming Challenge by llimllib on Tuesday June 14, 2011 @06:56PM (#2655165)
Why? It's not hard to write a quick and dirty levenshtein function, but when google gets it for me in 1 minute, why do it?

edit: just for fun, as a one-liner:

    def levenshtein(a,b): return sum(x!=y for x,y in zip(a, b))
edit 2: and just to clarify, I know this fails if the lengths of the input strings differ, they were guaranteed to be equal in my code.
Re:The ReadyForZero Programming Challenge by ithayer on Tuesday June 14, 2011 @05:20PM (#2654809)
Can you do it in linear time in the length of the input?
Re:The ReadyForZero Programming Challenge by kilburn on Friday June 17, 2011 @10:10AM (#2665539)
Find an actual (amortized) linear time implementation for this question in the following gist:

https://gist.github.com/1026638

Re:The ReadyForZero Programming Challenge by drdo on Tuesday June 14, 2011 @05:35PM (#2654870)
It's not hard to prove that that's impossible
Re:The ReadyForZero Programming Challenge by amalcon on Tuesday June 14, 2011 @06:38PM (#2655100)
It's possible if RAM isn't a constraint, using a bitset of all possible five-letter strings. The bitset would take up 4G of RAM (128G for extended ASCII, more for unicode).

In practice, that would actually be slower on this input, because of the cost of initializing the bitset. But that is not dependent on the input, so computational complexity is unaffected.

edit: Removed description. Yes, you're right, you can't even look at the whole input in constant time.

Re:The ReadyForZero Programming Challenge by drdo on Tuesday June 14, 2011 @07:21PM (#2655257)
This is a misunderstanding, you must have answered to my reply after ithayer edited his comment, the initial comment said "constant time".
Re:The ReadyForZero Programming Challenge by drdo on Tuesday June 14, 2011 @06:49PM (#2655144)
Didn't understand what you meant, care to elaborate?
Re:The ReadyForZero Programming Challenge by ithayer on Tuesday June 14, 2011 @05:36PM (#2654871)
:) I meant linear, but I'd review a proof :)