Preventing endless recursions in the case of circular references can be a bit trickier, specially if you want to reconstruct those same circular structures in the copy of the object. Definitely a good follow-up question, but not something I'd normally expect to be answered flawlessly during an interview, more of a "how'd you go about this?" sort of question.
EDIT: Definitely something I'd expect someone to notice, either in the process of coming up with a simple solution (aka. asking whether loops need to be considered), or at least when asked to find possible flaws in their solution.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Watch out for circular references in your recursion.
Preventing endless recursions in the case of circular references can be a bit trickier, specially if you want to reconstruct those same circular structures in the copy of the object. Definitely a good follow-up question, but not something I'd normally expect to be answered flawlessly during an interview, more of a "how'd you go about this?" sort of question.
EDIT: Definitely something I'd expect someone to notice, either in the process of coming up with a simple solution (aka. asking whether loops need to be considered), or at least when asked to find possible flaws in their solution.