Skip to content

Commit c53646a

Browse files
committed
add sorted functions
1 parent 9ddcebb commit c53646a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

sorted_functions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from sortedcontainers import SortedList
2+
3+
def sorted_order(x):
4+
s = SortedList(x)
5+
return list(s)

test_sorted_functions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from sorted_functions import *
2+
3+
4+
def test_sorted_order():
5+
x = ['e', 'a', 'c', 'd', 'b']
6+
y = sorted_order(x)
7+
assert y == sorted(x) == ['a', 'b', 'c', 'd', 'e']

0 commit comments

Comments
 (0)