News for hackers. Stuff that matters.
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers by kmax12 on Friday January 06, 2012 @01:31AM (#3432277)
I think for internships and early programming jobs, these such questions are are great idea. They show if you've learned anything in your CS degree.

My implementation in 15 min using javascript. BTW I'm a freshmen CS major.

function row(len){

    if (len==1){
        return [1]
    }else{
        var p = row(len-1),
            arr = [];
        for (var i=0; i<len; i++){
            if (i==0){
                arr.push(p[0]);
            } else if (i == len-1){
                arr.push(p[i-1]);                
            } else {
                arr.push(p[i]+p[i-1]);                
            }
        }  
        return arr;
    }        
}

There are no comments on this comment yet.