Given a large set of strings and a function giving lexicographic order between two strings, suggest a data structure that sorts the set with least complexity. Asked in the Technical 1 stage.
Implement a function that returns the strings sorted according to the provided comparator. The comparator is available as compare(a, b), which returns -1 if a < b, 0 if equal, and 1 if a > b.
sort_strings(strings, compare)
strings: list of stringscompare: callable comparatorcompare.def sort_strings(strings, compare):