The general version of this problem can be termed "the minimum dissection of a rectilinear region" and can be solved optimally using a sweep-line and computing the maximal independent set in a bipartite graph as described in section 7.1 of .
 Hiroshi Imai, Takao Asano: Efficient algorithms for geometric graph search problems (1986)
(Offtopic rant) Guess, I'm not really suited for programming. When I read I remembered I've heard about an algorithm for such tasks, Googled the details up to freshen my memory, and things instantly became boring. :(
If you can integrate haste or fay and let people play in Haskell that would be indeed be epic, and I would definitely use it (as haskell is my learning project at the moment)
I don't know Haskell, but I would have considered learning it if it was offered. ;)
There are at least three of them already - UHC's JS backend, Haste and Fay.
Could be fun.
Basically, it just fills the spaces with rectangles, expanding horizontally. Then I look for "stacks" of vertical adjacent rectangles and combine them.
(EDIT: Goes to show that you can get pretty good though non-optimal results by taking the low hanging fruit and optimizing a bit.)
For me, its like saying someone who is poor at physics makes a poor accountant.
While a fun exercise, I feel that it doesn't actually test for actual programming ability as it actually requires the programmer to be familiar with this particular subset of algorithms first (something that isn't entirely fundamental imho). I do not believe many jobs require the skillset that this problem tests for.
For example, I had very little idea how to approach this problem in an optimal way. But once I read the comment above I figured out a pretty brute force method. You can get 34 by just joining contiguous segments in each column with segments in their neighbouring columns if they have the same row and height. With some trimming I managed to get 30... not really sure if 29 is actually possible actually, I can't find where I can cut down on 1 more.
Edit: found it. Very tricky edge case with my algorithm. Happy with 30.
I don't think you are required to know this particular subset of algorithms first -- I certainly did not, and it took me about half an hour of searching around the net until I found the right terms to use.
Perhaps max cardinality bipartite matching is something I know from my first year at CS, but I didn't know its application to this problem before I had read through several different answers on StackExchange.
Beat this level, and we'll send your resume to some companies that are hiring. And those companies will pay us a hefty commission.
One weakness is that we don't have a good way of measuring how much software development (as opposed to core programming skill) you have. In this sense, we don't yet have an advantage over traditional recruiters.
Traditional recruiters do have better connections, for now, but we are going really high-hustle for this initial batch of players, so it's not like we're just sending off resumes.
And it makes perfect sense to me, the former is more likely to be actually useful in the day-to-day of a software engineering position, and the latter might only come in handy once in a blue-moon, or for more mathematics heavy domain-specific positions that require less code ejaculation and more optimization anyway.
Worst case you can have fun with the levels and just not worry about the job bits.
(Otherwise pretty neat)
We haven't improved it much because we are going to make an awesome timeless debugger, where you just hover over the variables to see their values at any point in time as well as scrubbing forward and backward through your entire program's execution (like jsdares does), all without any breakpoints, but haven't quite got it yet.
p.s. 29 ha ha
Also, we're sorry that we left you without good debugging tools: https://news.ycombinator.com/item?id=6976883 -- this is the #1 problem uncovered today. We will retreat in tearful shame to our code lairs until we can blow your minds with our timeless debugger.
You are amazing players--so many good solutions here. Thanks for playing! To those who sent in solutions and are looking for dev opportunities, we'll be in touch this weekend to see what we can do and learn about what you're looking for.
I just thought that was part of the challenge. (See if you can get by with scientific method and printf debugging.) The biggest problem I had was that the environment kept freezing. However, copy-pasting into the window from emacs worked fine.
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.73.11 (KHTML, like Gecko) Version/7.0.1 Safari/537.73.11
There aren't enough good programmers to meet the demand for low paid programmers.
-O(N) worst-case complexity
-Under 200 lines
I'm not trying to be a cynic - I really hope this works and solves a real problem. This is honest feedback from someone has and will continue to evaluate talent for technical teams - proof of algorithmic ability is only one tick mark of the dozens needed.
We'll be interested to hear what others think about this too!
This second requirement is much simpler. One only needs to merge a single two rects into one rect to fulfil it. I assume this is a bug?
Edit: Sorry I didn't read the original post well enough the first time. It gives the more practical goal of 40 rects or less.
this.addRect(0, 0, 200, 200);
Also, any chances of expanding beyond California?
We could try doing placements outside of California later, but for now we don't have much of a network outside of the SF Bay Area. (We're quite young as a startup.)
I could really use help as my resume is mostly Flash/Actionscript related work, which is not in demand, and it's difficult to convince the "filtering" HR reps that my skills are applicable to other languages. So if this proves that I can code, then I should be able to get a job?
But it should only take one screenshot every 30 seconds, and only when something changes, so this is a bug! I will fix. Thanks so much!
The bug is in my reporting tool I just realized. Yes, it reports only each time the screen change. Sorry about that. About multiplayer, understood, make sense.