Can you solve it? The Greplin programming challenge
91–100 of 167 posts
Re: Can you solve it? The Greplin programming challenge
#92Earlier 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).
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
#93Earlier 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
I wish I had discovered HN back then.
Re: Can you solve it? The Greplin programming challenge
#94Anybody 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.
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
#95Do I get bonus marks for solving this without writing any code?
Re: Can you solve it? The Greplin programming challenge
#96So 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.
Re: Can you solve it? The Greplin programming challenge
#97Took < 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.
Re: Can you solve it? The Greplin programming challenge
#98Wow 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.
Re: Can you solve it? The Greplin programming challenge
#99Re: Can you solve it? The Greplin programming challenge
#100Do 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…
while ($string =~ /((\w+)\w?(??{reverse $2}))/g) { print "$1\n"; }