From e70ec56060a9085a0847d3014c5aecdb0298830a Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Sat, 6 Sep 2025 20:58:35 -0600 Subject: 1304. find n unique integers sum up to zero --- find_n_unique_int_sum_0.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 find_n_unique_int_sum_0.py (limited to 'find_n_unique_int_sum_0.py') diff --git a/find_n_unique_int_sum_0.py b/find_n_unique_int_sum_0.py new file mode 100644 index 0000000..a4936ff --- /dev/null +++ b/find_n_unique_int_sum_0.py @@ -0,0 +1,22 @@ +# 1304. Find N Unique Integers Sum up to Zero + +""" +given an integer 'n', return any array containing 'n' unique integers such +that they add up to 0. +""" + + +class Solution(object): + def sumZero(self, n): + """ + :type n: int + :rtype: List[int] + """ + return range(1 - n, n, 2) + + +if __name__ == "__main__": + obj = Solution() + print(obj.sumZero(5)) + print(obj.sumZero(3)) + print(obj.sumZero(1)) -- cgit v1.2.3