Nutanix interview question

Basic recursive algorithm.