Diffk II

Given an array A of integers and another non negative integer k, find if there exists 2 indices i and j such that A[i] - A[j] = k, i != j.

Example :

Input :

A : [1 5 3]
k : 2

Output :


as 3 - 1 = 2

  • Return 0 / 1 for this problem.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Diffk II on Interview Code Editor
Sign Up
to access hints and editorial solutions for Diffk II
5360 successful submissions.
Asked In:
  • Facebook
Click here to start solving coding interview questions