Quick Overview

This question evaluates proficiency in algorithm design and implementation, specifically sorting algorithms, set intersection logic, input parsing, and analysis of time/space complexity and algorithm stability within the Coding & Algorithms domain.

Implement sorting and set intersection with input parsing

Company: BlackRock

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Take-home Project

Write two functions and explain your approach in under two minutes after coding: (A) Sorting: Implement sort_numbers(nums: List[int]) -> List[int] that returns nums in non-decreasing order without using built-in sort; use a standard algorithm and describe time/space complexity and stability. (B) Set Intersection: Implement intersect_sets(a: Iterable[int], b: Iterable[int]) -> List[int] that returns the unique elements present in both a and b in ascending order; describe time/space complexity and key edge cases (e.g., empty inputs, duplicates). Assume you must handle input parsing yourself (no helpers), and you will have two fixed test cases with a single allowed submission.

Quick Answer: This question evaluates proficiency in algorithm design and implementation, specifically sorting algorithms, set intersection logic, input parsing, and analysis of time/space complexity and algorithm stability within the Coding & Algorithms domain.

Sort Numbers Without Built-in Sort

Return the numbers in non-decreasing order using merge sort.

Constraints

  • Inputs are provided as Python literals matching the function signature.
  • Return a deterministic exact-match result.

Examples

Input: ([3,1,2,1],)

Expected Output: [1, 1, 2, 3]

Explanation: Duplicates.

Input: ([],)

Expected Output: []

Explanation: Empty input.

Hints

  1. Choose a representation that makes the core operation simple.
  2. Handle empty and boundary inputs before the main algorithm.

Sorted Set Intersection

Return unique elements present in both inputs in ascending order.

Constraints

  • Inputs are provided as Python literals matching the function signature.
  • Return a deterministic exact-match result.

Examples

Input: ([1,2,2,3], [2,2,4])

Expected Output: [2]

Explanation: Unique intersection.

Input: ([], [1])

Expected Output: []

Explanation: Empty input.

Hints

  1. Choose a representation that makes the core operation simple.
  2. Handle empty and boundary inputs before the main algorithm.

Loading coding console...