10 ms·
So what languages did everyone use? I decided to try a different one on each level, so I used Python, bash (letting GNU coreutils 'factor' do the hard work), a
by 1amzave 16y ago
So what languages did everyone use?
I decided to try a different one on each level, so I used Python, bash (letting GNU coreutils 'factor' do the hard work), and Haskell, respectively.
- nene 16y agoRuby was my main choice + some command line tools to do bits of extra work, like 'sort' to find the largest palindrome and 'wc' to count the results in last exercise, and even Python command line to just manually sum the primes in second exercise.
- djacobs 16y agoRuby has Array#sort, no command line required.
- nomurrcy 16y agoClojure 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
- callahad 16y agoPython, Scheme, Python. Mainly because I had nice functions in Scheme for level 2 sitting around from when I was trying to work through SICP...
- Twisol 16y agoI used Lua, myself. I briefly considered using a more featureful language like Ruby, but I'm happy to say that Lua did the job just fine. I made good use of coroutines for the second and third problems.
- sisk 16y agoJavaScript. I had my browser open ... it seemed like the logical place. :)
- p01nd3xt3r 16y agoc / python
- ismarc 16y agoI used Haskell for the first one (was my first actual Haskell program, everything before was just xmonad config), C for the second one (already had the needed code for generating fibonacci sequences and a prime number sieve from when I went through the euler problems using only ANSI C) and Perl for the last one. I initially used Data::PowerSet for the Perl code, but decided to write my own after it took several minutes to build the combinations and I discovered that I had the wrong answer because I improperly read the problem. I should note that I used the existing C code I had because I had no idea where they would intersect and didn't feel like writing Yet Another Arbitrarily Large Integer Handler.
- lisper 16y agoCommon Lisp of course :-)
- grigory 16y agoPython here - very quick to code in if you have terminal handy.
- leif 16y agoI'm wonderfully amazed that coreutils has factor.
- Natsu 16y agoPerl. From the look of this thread, I guess everyone else has moved on?
- colomon 16y agoI solved all three in Perl 6... ;)
- sendos 16y agoMatlab for all three parts. Quick and dirty solutions here: http://gist.github.com/618006 http://gist.github.com/618006
- aristidb 16y agoHaskell for all. Perfect fit.
- afshin 16y agok, javascript, javascript None of my solutions were particularly elegant :-)
- tef_ 16y agoPython for 1,2 with a little bit of manual pasting into wolfram alpha And for part 3 I used prolog. About ~6 lines or so.
- whimsy 16y agoNo Erlang?!
- cygwin98 16y agoI know I'm late to the party, :) I used Ruby 1.9.2. It's funny that it's the first time I used the combination generation method built in Ruby Array. The whole three questions took me about a bit more than 20 minutes, a bit longer than I thought tho.