Loading...
Is this your company?
Tail recursive function for calculating factorial. (I did it in scheme)
Anonymous
(define fact (lambda (n k) (cond [(zero? n) (k 1)] [else (fact (sub1 n) (lambda (v) (k (* n v))))])))
int factAux (int x, int result) { if (x==0) return result; return factAux(x-1, result * x); } int tailRecursiveFact( int x) { return factAux (n, 1); } Source: www.cs.umbc.edu/courses/undergraduate/341/fall05/Lectures/Recursion/recursion2.ppt
Good One!
Check out your Company Bowl for anonymous work chats.
Get actionable career advice tailored to you by joining more bowls.
Stay ahead in opportunities and insider tips by following your dream companies.
Get personalized job recommendations and updates by starting your searches.