Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Array Sorting Implementation

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Array Sorting Implementation. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Airbus Americas Customer Services processes numeric identifiers such as aircraft part references and maintenance event codes. Given an array of integers, return a new array containing the same values in nondecreasing order.

Implement the sorting algorithm yourself. Do not call Python's built-in sort() or sorted() functions. After implementing the function, explain why you selected the algorithm and state its time and space complexity.

Formal Specification

  • Input: nums, a list of integers. The list may be empty and may contain duplicate or negative values.
  • Output: A new list containing all values from nums in nondecreasing order.
  • The input list should not be modified.

Constraints

  • 0 <= len(nums) <= 10^4
  • -10^9 <= nums[i] <= 10^9
  • Duplicate values are allowed
  • The input list must remain unchanged

Function Signature

def sort_numbers(nums):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output