Interview Query

Sort Strings

1
Have you seen this question before?

Given a list of strings, write a function, sorting from scratch to sort the list in ascending alphabetical order.

Notes: - Do NOT use the built-in sorted function - Return the new sorted list, rather than modifying the list in-place

Bonus: Have your solution be O(nlog(n))O(n log(n)).

Example:

Input:

array = ["apple", "cat", "banana", "zoo", "football"]

Output:

def sorting(array) -> ["apple", "banana", "cat", "football", "zoo"]
Next question: Strictly Decreasing PDF
.....
Python 3.9.6
Loading editor
Use Shift + Enter to run code