From 3dd9eb16fd957b11c7bc1ede1a20fa2dc6bd6b86 Mon Sep 17 00:00:00 2001 From: Deven <63876261+devenperez@users.noreply.github.com> Date: Tue, 17 Jan 2023 23:41:26 -0500 Subject: [PATCH] Time: 27 ms (97.27%), Space: 13.8 MB (52.11%) - LeetHub --- 1512-number-of-good-pairs/1512-number-of-good-pairs.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 1512-number-of-good-pairs/1512-number-of-good-pairs.py diff --git a/1512-number-of-good-pairs/1512-number-of-good-pairs.py b/1512-number-of-good-pairs/1512-number-of-good-pairs.py new file mode 100644 index 0000000..2bc84df --- /dev/null +++ b/1512-number-of-good-pairs/1512-number-of-good-pairs.py @@ -0,0 +1,10 @@ +class Solution: + def numIdenticalPairs(self, nums: List[int]) -> int: + count = 0 + + for i in range(len(nums)): + for j in range(i + 1, len(nums)): + if nums[i] == nums[j]: + count += 1 + + return count \ No newline at end of file