From 8a0e6df5e4abc6bc0ba2b37ab719139a632a0ee2 Mon Sep 17 00:00:00 2001 From: WazedKhan Date: Mon, 17 Feb 2025 10:30:00 +0600 Subject: [PATCH] upt: bruth force solution --- LeetCode/medium/bad_paris_counts_2364.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 LeetCode/medium/bad_paris_counts_2364.py diff --git a/LeetCode/medium/bad_paris_counts_2364.py b/LeetCode/medium/bad_paris_counts_2364.py new file mode 100644 index 0000000..e64069c --- /dev/null +++ b/LeetCode/medium/bad_paris_counts_2364.py @@ -0,0 +1,18 @@ +from typing import List + + +class Solution: + def countBadPairs(self, nums: List[int]) -> int: + counter = 0 + num_len = len(nums) + for i in range(num_len): + for j in range(i, num_len): + if nums[i] - i != nums[j] - j: + counter += 1 + + return counter + + +nums = [1, 2, 3, 4, 5] +result = Solution().countBadPairs(nums) +print(f"Result: {result}")