Difficulty: Medium
Category: Code Analysis
Practice quant interview questions from top firms including Jane Street, Citadel, Two Sigma, DE Shaw, and other leading quantitative finance companies.
Topics: python, recursion, optimization, tail-call
You are reviewing a Python script designed to efficiently calculate factorials for large numbers. The script utilizes a recursive function written in tail-call form. The goal is to understand whether Python's interpreter optimizes tail-recursive calls to prevent stack overflow errors when dealing with extremely large inputs. Consider the following scenario: The factorial function is defined recursively such that factorial(n) calls factorial(n-1) in the last operation of the function. This is con
Practice this medium trader interview question on MyntBit - the all-in-one quant learning platform with 200+ quant interview questions for Jane Street, Citadel, Two Sigma, and other top quantitative finance firms.