Question: Below are two different implementations of a factorial function. Which statement is true of the second version, but not of the first? Lagen 1 fun

Below are two different implementations of a factorial function. Which statement is true of the second version, but not of the first? Lagen 1 fun factorial(n: Int): Long { 2 return if (n -- 1) 1 else n. factorialin - 1) 3) 5 tallrec fun factorial(n: Int, r: Long - 1L): Long 6 return if (n -- 1) r else factorial(n - 1. r*n) 7) Select the correct answer: It may result in Integer overflow The compiler optimizes it to prevent stackoverflows It only supports positive integers It is recursive I don't now
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
