Hacker News new | past | comments | ask | show | jobs | submit login
The Six Most Common Species Of Code (willa.me)
22 points by peterkchen on Nov 12, 2013 | hide | past | favorite | 6 comments

False. Math phd would probably write O(log n) based on either multiplying [[1,0], [1,1]] matrix or compute it directly for smaller numbers and return the rounded power of golden ratio for higher numbers.

Notice that for big enough numbers psi becomes insignificant enough, so that we can only use phi.

Everybody (except the Math PhD) writes the naive O(2^n) solution? Fat chance...

That is preposterous! At a hackathon they would probably just return 10 or something.

    int fib(int val) { return 10; } // todo: implement me

Certainly the version they gave is too much typing! Maybe something more like

   fn f(i: int)->int{[1,1,2,3,5,8,13,21][i]};
Need more values? copypaste from the online encyclopedia of integer sequences.

my code is the cat code

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact