3 ms·
Clojure here.
by nomurrcy 16y ago
Clojure here.
- djacobs 16y agoMind posting your solution as a Gist? I want to see how to do level 1 without explicit loops or variables.
- nomurrcy 16y agoSure, sorry about the delay. http://gist.github.com/621130 http://gist.github.com/621130 I can't take credit for the solution I posted though. I originally wrote a naive O(N^2) complexity solution (which was much shorter and was fine for the length of the input) I had this palindrome code in my 'toolbox' of code I've come across though, I'm afraid I don't know the orig author. I just tweaked it as this is more in line with the type of example you're looking for.
- djacobs 16y agoInteresting, I'll have to go over your code fairly carefully, as I'm not familiar with every technique you're using here for performance. I've since learned a good deal about Clojure and implemented an idiomatic (but probably less performant) version, for anyone interested in how short this can be: http://gist.github.com/635674 http://gist.github.com/635674