Skip to content

Commit

Permalink
2006
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Jan 12, 2022
1 parent c4b6569 commit 5c4a156
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions E_2006_CountNumberofPairsWithAbsoluteDifferenceK.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Solution:
def countKDifference(self, nums: List[int], k: int) -> int:
i=0
j=0
output=0
while i<len(nums):
j=i+1
while j<len(nums):
if abs(nums[i]-nums[j])==k:
output+=1
j+=1
i+=1
return output

0 comments on commit 5c4a156

Please sign in to comment.