diff options
Diffstat (limited to 'progs/a154.py')
-rw-r--r-- | progs/a154.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/progs/a154.py b/progs/a154.py new file mode 100644 index 0000000..38780bc --- /dev/null +++ b/progs/a154.py @@ -0,0 +1,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]
\ No newline at end of file |