7 kyu

Integer Difference

1,284 of 3,099smepple

Description:

Write a function that accepts two arguments: an array/list of integers and another integer (n).

Determine the number of times where two integers in the array have a difference of n.

For example:

[1, 1, 5, 6, 9, 16, 27], n=4  -->  3  # (1,5), (1,5), (5,9)
[1, 1, 3, 3], n=2             -->  4  # (1,3), (1,3), (1,3), (1,3)
Fundamentals

More By Author:

Check out these other kata created by smepple

Stats:

CreatedJun 29, 2016
PublishedJun 29, 2016
Warriors Trained6065
Total Skips215
Total Code Submissions27614
Total Times Completed3099
JavaScript Completions1183
Ruby Completions187
CoffeeScript Completions14
Python Completions1284
C# Completions285
C Completions195
TypeScript Completions126
COBOL Completions5
Total Stars75
% of votes with a positive feedback rating87% of 567
Total "Very Satisfied" Votes451
Total "Somewhat Satisfied" Votes87
Total "Not Satisfied" Votes29
Ad
Contributors
  • smepple Avatar
  • gpont Avatar
  • suic Avatar
  • anter69 Avatar
  • user5036852 Avatar
  • rowcased Avatar
  • FArekkusu Avatar
  • hobovsky Avatar
  • ejini战神 Avatar
  • user1326445 Avatar
  • akar-0 Avatar
  • saudiGuy Avatar
Ad