def sum_eq(lst,k): total = sum(lst) if total == k or k==0:return 1 elif total def sum_all_eq(lst): total = 0 for k in range(1,len(lst)): total += sum_eq(lst[0:k],lst[k]) return total
Can you solve it? The Greplin programming challenge
141–150 of 167 posts
Re: Can you solve it? The Greplin programming challenge
#142So 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.
None of my solutions were particularly elegant :-)
Re: Can you solve it? The Greplin programming challenge
#143Re: Can you solve it? The Greplin programming challenge
#144So 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.
And for part 3 I used prolog. About ~6 lines or so.
Re: Can you solve it? The Greplin programming challenge
#145I didn't see the point in doing this in anything but C. I tried it without cheating, and to make it as interesting to myself as possible. Also did it after a week of writing briefs, so that was a nice way to unwind from that! Pretty Fun.
Anyway, if I'm applying for a job (which I wasn't), the last thing I'm going to do is send in a bunch of one-liners.
Re: Can you solve it? The Greplin programming challenge
#146Of all of the jobs-page challenges, thesixyone's is probably the most practical and I've seen:
Re: Can you solve it? The Greplin programming challenge
#147So 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.
Perl. From the look of this thread, I guess everyone else has moved on?
Re: Can you solve it? The Greplin programming challenge
#148How terrible is it?
Re: Can you solve it? The Greplin programming challenge
#149I got the impression that this particular test was not a good one for finding apt programmers. The questions and the solutions were just so very "off".
Re: Can you solve it? The Greplin programming challenge
#150"Even if you're not looking for a job, we'd love to hear what you thought about the challenge." I would be curious how many people did you lose because of phonecall requirement (before you changed it). Also CSV for just a list of 22 numbers wasn't really necessary. If you do web puzzle, the best is to keep everything self-contained, no downloads, no using external channels, just copy and paste. FYI another Python che…
I don't think trivializing the combinations with Python's builtins, looking up the fib primes with OEIS, or computing factors with Alpha is cheating. I hope, in fact, it's the whole point of the exercise: choose the right tools for the job. If you're writing code to test primeness or generate Fibonacci numbers, I sure as hell don't want to hire you.