4 ms·
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 impleme
by kmax12 15y ago
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;
}
}