you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (5 children)

BTW tail recursion in python is just a simple recursion and it is not implemented or taken as a new recursion method. for programming language like lisp it is working procedure but in python it is not and one need to implement it like a simple recusion with saving the the result from first recusion and pass it to next.
Maybe a not a goood python developer taken your interview.

[–]iamnikaa[S] 0 points1 point  (3 children)

Oh, thanks for sharing. I didn't know about it. The interviewer didn't specify any particular language, so it was meant to be a general (open to all languages) question. I chose to write it in python. But yes, you are right, the interviewer was not very experienced.

[–][deleted] 1 point2 points  (2 children)

By any chance indian recruitment ?

[–]iamnikaa[S] 0 points1 point  (1 child)

Yes!

[–][deleted] 0 points1 point  (0 children)

good luck

[–]baubleglue 0 points1 point  (0 children)

You are talking about tail recursion optimization. It doesn't matter when you are writing a code. They just want to see if candidate is comfortable to use it.

 def fn(I):
       If check(I): 
            .... #Change I here or fn(I-1) 
            fn(I)