Skip to content

Commit

Permalink
Assignment 6.5 completed
Browse files Browse the repository at this point in the history
  • Loading branch information
bhushanhr26 committed Aug 23, 2022
1 parent d4ec4f6 commit 52fd9ed
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Week-6/Assignment-6.5/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function arrDifference(arr, B) {
for (i = 0; i < arr.length - 1; i++) {
for (j = i + 1; j < arr.length; j++) {
if (arr[j] - arr[i] == B) {
return 1;
}
}
}
return 0;
}
console.log(arrDifference([5, 10, 3, 2, 50, 80], 78));
console.log(arrDifference([-10,20], 30));

0 comments on commit 52fd9ed

Please sign in to comment.