InterviewSolution
Saved Bookmarks
| 1. |
What is the value of h(231,8) for the function below? def h(m,n): ans = 0 while (m >= n): (ans,m) = (ans+1,m-n) return(ans) |
|
Answer» "The answer to this question is 28. The white loop will run 28 times. In the first step, SINCE 231≥8. (u, 231)=(1,223) Then in the SECOND step, (1,223)=(2,215) This will run for 28 times when m will finally reach 7 or less than 8. the value of n at that point value of 7 is 28." |
|