I was asked in an interview and my answer was similar to this, which is wrong due to the final loop. Answer What you are talking about — “sorting” two arrays that are each themselves already sorted — is called a merge. This is how you do that:
I was asked in an interview and my answer was similar to this, which is wrong due to the final loop. Answer What you are talking about — “sorting” two arrays that are each themselves already sorted — is called a merge. This is how you do that: