From 49357616859faaf9e53468ce71d6cd99bda4fb4a Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Thu, 27 Jun 2024 22:41:06 +0200 Subject: Restore progs folder --- progs/test.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 progs/test.py (limited to 'progs/test.py') diff --git a/progs/test.py b/progs/test.py new file mode 100644 index 0000000..718885d --- /dev/null +++ b/progs/test.py @@ -0,0 +1,17 @@ +import math +from re import f4, r3 + +from abs import * + + +def find_first_duplicate(nums, x): + num_set = set() + no_duplicate = -1 + + for i in range(len(nums)): + if nums[i] in num_set: + return nums[i] + else: + num_set.add(nums[i]) + + return no_duplicate -- cgit v1.2.3-18-g5258