Code Room
Code reviewMediumcr-g336
Subject LocaleLevel Mid–Senior~18 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Review this Python merge step that trusts each producer pre-sorted its display names, then validates before a sorted-merge join.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewpython
def merge_users(list_a, list_b):    # each list arrives 'sorted' from a separate upstream service    assert list_a == sorted(list_a), 'list_a not sorted'    assert list_b == sorted(list_b), 'list_b not sorted'     merged = []    i = j = 0    while i < len(list_a) and j < len(list_b):        if list_a[i] <= list_b[j]:            merged.append(list_a[i]); i += 1        else:            merged.append(list_b[j]); j += 1    merged.extend(list_a[i:]); merged.extend(list_b[j:])    return merged
Run or narrate your approach, then ask the coach.