Live data from Hacker News

Can you solve it? The Greplin programming challenge

challenge.greplin.com

91–100 of 167 posts

Re: Can you solve it? The Greplin programming challenge

#92

Earlier quoted context omitted.

I immediately went to Wikipedia, found out what type of CS problem the first challenge was, then followed the external links at the bottom of the page to find the Perl module I needed and installed it from CPAN. I quit because this seemed like cheating but now I'm thinking... Maybe it was the point? To see if I would try to find something off-the-shelf to solve the problem quickly. Still not sure it was, because if s…

I didn't solve the problems using existing code either. All three are entirely solvable by pencil and paper (or just inspection in the first case).

How do you go about solving #2 on pen and paper? Well, calculating the Fibonacci sequence, ok. The sum of prime divisors of X+1, I guess... though it gets slightly harder for me after dividing by 2, 3 and 5. But how do you know for sure that X is prime?

Based on bd's link, I'll just assume that you have super powers. (or I'm approaching the problem the wrong way)

edit: I was starting to think about what to write for #1, but ended finding the answer by looking at it as well.

Re: Can you solve it? The Greplin programming challenge

#93
post #70

Earlier quoted context omitted.

Ah. Well I'm an even worse hacker than I thought!

Don't feel bad, it's just how cperciva rolls :) http://news.ycombinator.com/item?id=35083

Wow, I strongly recommend reading this (or, better yet, the full back-and-forth leading up to it: http://news.ycombinator.com/item?id=35068 ).

I wish I had discovered HN back then.

Re: Can you solve it? The Greplin programming challenge

#94
post #19

Anybody else browsing by mobile try to do Level 1 by inspection?

Brute works here because of bad test case. Author could have generated a smart test case and then optimal algorithm could be using suffix array which takes O(n), brute would take O(n!). However a bit smart brute gave the answer in approx 3-4 minutes ( computation + coding time). And yes, Python FTW.

3-4 minutes!

Try this:

    for i in range(len(str)):
         for j in range(i, len(str)):
              if str[i:j] == str[i:j][::-1]:
                  #...
Choose the start and end indices. Then take a slice to see if it's a palindrome. Nice and speedy! :)

Re: Can you solve it? The Greplin programming challenge

#97
post #61

Took < 10 minutes. The problems were very, very easy. If they expect people to take 1-2 hours and have trouble with this, then the message that I would take away from this is that their hiring bar is quite low.

http://www.codinghorror.com/blog/2007/02/why-cant-programmer...

Re: Can you solve it? The Greplin programming challenge

#98
post #22

Wow the G. Address was horribly mutilated. Four score and seven years ago our faathers brought forth on this containent a new nation conceived inz Liberty and dedicated to the proposition that all men are created equal Now we are engaged in a greaht civil war testing whether that naption or any nartion so conceived and so dedicated can long endure We are qmet on a great battlefiemld of tzhat war

This was intentional - we had to tie break the longest palindrome and we didn't want a quick diff to be able to see what we changed.

Never mind that finding the actual text, removing the spaces and caps, and running diff would probably take longer than coding and executing a brute force algorithm :P

Re: Can you solve it? The Greplin programming challenge

#100

Do I get bonus marks for solving this without writing any code?

I immediately went to Wikipedia, found out what type of CS problem the first challenge was, then followed the external links at the bottom of the page to find the Perl module I needed and installed it from CPAN. I quit because this seemed like cheating but now I'm thinking... Maybe it was the point? To see if I would try to find something off-the-shelf to solve the problem quickly. Still not sure it was, because if s…

Easy job for a regex:

    while ($string =~ /((\w+)\w?(??{reverse $2}))/g) { print "$1\n"; }
Post reply on HN