News for hackers. Stuff that matters.
Re:Algorithms playground for common questions solved in Ruby... by trynumber9 on Sunday December 21, 2014 @01:25PM (#8780441)
Here's another similar repository.

https://github.com/kennyledet/Algorithm-Implementations

A fellow by handle of Yonaba implemented many of them in Lua. And Lua looks basically like a (Pascal-ish?) pseudo code.

Re:Algorithms playground for common questions solved in Ruby... by billforsternz on Sunday December 21, 2014 @06:24PM (#8781330)
From "Longest Common Substring" > p LCSLength('waaaa', 'bbbbasfaaewra') #returns 4

Visual inspection suggests the longest common substring is 'aa' which has length 2. What am I missing here?

Re:Algorithms playground for common questions solved in Ruby... by mkinitcpio on Sunday December 21, 2014 @06:31PM (#8781348)
LCS stands for "Longest Common Subsequence". I don't know why their docs say "substring". Maybe they just made a mistake?

https://en.wikipedia.org/wiki/Longest_common_subsequence_pro...

Re:Algorithms playground for common questions solved in Ruby... by billforsternz on Sunday December 21, 2014 @07:13PM (#8781419)
That explains it, thanks. Amusingly the wikipedia "longest common subsequence" page emphasises that this is different to and commonly confused with the "longest common substring". Illustrating this confusion neatly, the OP's repository implements subsequence, but is not only called substring but documented by a wikipedia link to substring!
Re:Algorithms playground for common questions solved in Ruby... by sagivo on Sunday December 21, 2014 @07:15PM (#8781423)
already updated. thanks for pointing it out
Re:Algorithms playground for common questions solved in Ruby... by lbarrow on Sunday December 21, 2014 @05:26PM (#8781188)
Does anyone actually ask this sort of thing in an interview anymore? (I don't mean this as a knock on the repository, which looks very nice aside from the lack of tests.)
Re:Algorithms playground for common questions solved in Ruby... by timtas on Friday December 26, 2014 @12:56PM (#8799495)
I recently interviewed with an SF consulting company (a sort of network/placement firm), which purports to offer only the most senior devs to the hottest companies. The process includes a timed puzzle-solving test.

Ironically, fresh CS grads are more likely to do better on such a test because senior devs have filled their minds with ways of solving real problems and building complex living systems that actual humans use. They know that the once or twice a year they need to solve such a problem, they will likely find it well-solved in a library or site like this one. If not, they know that the boss will not be holding a stop watch over them -- she measures productivity in person-months, not person-minutes.

Even more ironically, this particular test also rewards premature optimization by stress testing your solutions for micro-optimization.

Re:Algorithms playground for common questions solved in Ruby... by arielweisberg on Monday December 22, 2014 @09:46AM (#8783195)
Yup. I just did an interview that was hours of this at one of the larger California companies.

The only way to ace is to memorize the implementations otherwise there was no way to get it done on a whiteboard in 20 minutes.

There were a lot of added weird constraints as well like implementing sorts with singly linked lists in constant space (not lg(n)) preventing the use of recursion or a stack in order to make a simple implementation.

I would say that the entire interview was basically a test of your knowledge of the companies published information as well as the algorithms linked to in the prep email sent by the recruiter.

Pretty much zero interest in the knowledge and skills you do have. Only one interviewer out of six asked questions about the resume and even then only briefly.

Re:Algorithms playground for common questions solved in Ruby... by sagivo on Monday December 22, 2014 @01:00PM (#8784180)
i had the same experience with linkedin, facebook and google
Re:Algorithms playground for common questions solved in Ruby... by timtas on Friday December 26, 2014 @01:04PM (#8799519)
I guess it's hard to change, even after it becomes clear the old way doesn't work.

http://qz.com/96206/google-admits-those-infamous-brainteaser...

Re:Algorithms playground for common questions solved in Ruby... by msoad on Sunday December 21, 2014 @05:32PM (#8781207)
Yup! This is still the case. If you want to pass the interview you have to memorize a bunch of common algorithms and data structure implementation.
Re:Algorithms playground for common questions solved in Ruby... by whistlerbrk on Sunday December 21, 2014 @01:28PM (#8780450)
Great! I'm generally a Rubyist and am doing these same sort of fundamental exercises, except in JavaScript here: https://github.com/whistlerbrk/exercises

I want to knock off knapsack next

Re:Algorithms playground for common questions solved in Ruby... by sagivo on Sunday December 21, 2014 @02:05PM (#8780552)
thanks for liking it guys. i did it while i was preparing for my interviews with Google and Facebook. hope it will help you too.
Re:Algorithms playground for common questions solved in Ruby... by chaoxu on Sunday December 21, 2014 @05:16PM (#8781154)
I want to see something like this but with Haskell. So I get to see if Haskell is nice for expressing algorithms.
Re:Algorithms playground for common questions solved in Ruby... by Yadi on Sunday December 21, 2014 @01:31PM (#8780458)
Dang I have an interview coming up and this really helps :)!
Re:Algorithms playground for common questions solved in Ruby... by whistlerbrk on Sunday December 21, 2014 @01:53PM (#8780530)
Might I humbly suggest that you check out some videos of the algo you're trying to implement on YouTube first and then try implementing it w/o looking at (pseudo)code. I gave up my first 2 times and peeked at code, but after those I got the hang of it. Also tuples.
Re:Algorithms playground for common questions solved in Ruby... by Yadi on Sunday December 21, 2014 @03:21PM (#8780809)
Ah! Good suggestion actually! Thanks a bunch.
Re:Algorithms playground for common questions solved in Ruby... by gargarplex on Monday December 22, 2014 @01:12AM (#8782215)
Could be cool if it included Big O notation in comments
Re:Algorithms playground for common questions solved in Ruby... by bl4ckdu5t on Sunday December 21, 2014 @03:33PM (#8780847)
really cool stuff. I was searching around for resources like this about a month ago. I still find it really useful though. Thanks!!!