4 ms·
easy to click Greplin Programming Challenge: http://challenge.greplin.com/ http://challenge.greplin.com/ Anyone managed to pass level 1? I am stuck at level 1.
by iworkforthem 16y ago
easy to click Greplin Programming Challenge: http://challenge.greplin.com/ http://challenge.greplin.com/
Anyone managed to pass level 1? I am stuck at level 1. Please share the logic.
- erwanb 16y agohere is a naive but working way to do it in ruby : https://gist.github.com/849625 https://gist.github.com/849625
- iworkforthem 16y agoThank you. 0.upto(string.length - password_length) do |index| that's the line of logic I didn't it get correct.
- ntoshev 16y agoPython: max((s[start:end] for start in xrange(len(s)) for end in xrange(start, len(s)) if s[start:end]==s[start:end][::-1]), key=len)
- RiderOfGiraffes 16y agoWhat a crock - the second challenge requires calling a USA phone number. Color me unimpressed.
- Natsu 16y agoThe last time it was posted, they had an alternative. I don't know if it's still up, though. I'd check the previous story, though.
- lysium 16y agoThere's an alternative, just click the provided link: http://challenge.greplin.com/static/nophone.html http://challenge.greplin.com/static/nophone.html
- RiderOfGiraffes 16y agoThanks - I might get back to it in a few hours. Currently busy now - I did have 20 minutes to spare earlier and thought a small challenge could be fun.
- nandemo 16y agoWell, do you want to work there? It's a challenge used for hiring. They might as well restrict it to people living in the US.
- parfe 16y agoIf you finish you're prompted to submit your code along with your resume for employment consideration. Keep that in mind as you move on to each next step. Had to piece together one of my solutions into a single solution. https://www.greplin.com/jobs https://www.greplin.com/jobs Here is the source of the challenge link which gives you a heads up it's for a job contest.
- ashish_0x90 16y agoI did manage to solve all three problems and I really liked the way the problems were put up on the website. Anyway, I would still suggest trying for some more time before looking at the solution that that I have provided here - https://gist.github.com/849813 https://gist.github.com/849813 . The first problem itself took me most of the time. All this time I was trying to come up with a optimal approach (and was stuck in some boundary condition in implementation for Approach 1) until I realized that even a brute force solution will work in this case because of the smaller text input.
- Natsu 16y agoIt was posted to HN ages ago. Several people, myself included, passed it. Brute force is sufficient; you don't really need any clever algorithms. Just spend a few minutes thinking about what you know about palindromes and what they look like and it shouldn't be too hard to code.
- blhack 16y agoHoly crap this is fun. I'm stuck on level 3 right now. The way I'm doing it is probably very very stupid, but I think it will work :) (I'm trying to brute force it. I may look back at this as very very stupid, but we'll see). This could get filed under: "Ways to denial-of-service Ryan". Love it. Thanks to whoever set up the challenge.
- silverlake 16y agoI solved all of them in 30 min. using Python. Since it's brute force it's not that hard.
- brich 16y agoI think this would work (but I haven't tested it): Convert the string to an array of integers called FORWARD. Copy and flip the array into REVERSE. Subtract the values of REVERSE, offset by (0..length), pairwise from FORWARD. Then, just keep track of the longest block of zeros (index in FORWARD and length) corpus: ilikeracecarstoo FORWARD: (8,11,8,10,4,17,0,2,4,2,0,17,19,14,14) REVERSE: (14,14,19,17,0,2,4,2,0,17,4,10,8,11,8) In this case, the password appears at an offset of 2 REVERSE(2): (0,0,14,14,19,17,0,2,4,2,0,17,4,10,8) SUBTRACTED: (-8,-11,6,4,15,0,0,0,0,0,0,0,-15,-4,-6) The longest zero block occurs at FORWARD[5] and ends at FORWARD[11]... in other words, racecar. Should be quicker than brute force.