blob: 38780bc042a323c9691ff937f141b0be439d527a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
def second_smallest(numbers):
if (len(numbers)<2):
return
if ((len(numbers)==2) and (numbers[0] == numbers[1]) ):
return
dup_items = set()
uniq_items = []
for x in numbers:
if x not in dup_items:
uniq_items.append(x)
dup_items.add(x)
uniq_items.sort()
return uniq_items[1]
|