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.
Can you solve it? The Greplin programming challenge
31–40 of 167 posts
Re: Can you solve it? The Greplin programming challenge
#32Re: Can you solve it? The Greplin programming challenge
#33Uh ... call a phone number? No thanks. Edit: Excellent! Back to hacking.
It seemed eminently likely (to me) that it would be an automated system, but, even if it wasn't, talking to someone isn't that big a deal to me. I certainly wasn't concerned about long-distance charges, but I suppose that might be a problem for some.
I thought it was a nice little twist in the problem set.
Re: Can you solve it? The Greplin programming challenge
#34Re: Can you solve it? The Greplin programming challenge
#35Uh ... call a phone number? No thanks. Edit: Excellent! Back to hacking.
I'm curious to know why calling a phone number was a deal-breaker. It seemed eminently likely (to me) that it would be an automated system, but, even if it wasn't, talking to someone isn't that big a deal to me. I certainly wasn't concerned about long-distance charges, but I suppose that might be a problem for some. I thought it was a nice little twist in the problem set.
A lot of people struggle with the phone. I certainly have, though I'm getting better at it. I've noticed many people become spookily compliant on the phone, endlessly listening to and being polite to even the most annoying callers instead of just hanging up.
Re: Can you solve it? The Greplin programming challenge
#36Anybody 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.
Re: Can you solve it? The Greplin programming challenge
#37Re: Can you solve it? The Greplin programming challenge
#38Do I get bonus marks for solving this without writing any code?
Re: Can you solve it? The Greplin programming challenge
#39Earlier quoted context omitted.
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.
Isn't brute force just O(n^3)? Loop over each character to start potential palindrome, loop from start character to end, reverse substring and compare. But yeah, the test input should be longer and/or smarter. Ditto on the third problem.
D'oh! My is_palindrome(word) just got a lot shorter, thanks :)