-
Notifications
You must be signed in to change notification settings - Fork 928
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (25 loc) · 703 Bytes
/
index.js
File metadata and controls
34 lines (25 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function hasTargetSum(array, target) {
// Write your algorithm here
}
/*
Write the Big O time complexity of your function here
*/
/*
Add your pseudocode here
*/
/*
Add written explanation of your solution here
*/
// You can run `node index.js` to view these console logs
if (require.main === module) {
// add your own custom tests in here
console.log("Expecting: true");
console.log("=>", hasTargetSum([3, 8, 12, 4, 11, 7], 10));
console.log("");
console.log("Expecting: true");
console.log("=>", hasTargetSum([22, 19, 4, 6, 30], 25));
console.log("");
console.log("Expecting: false");
console.log("=>", hasTargetSum([1, 2, 5], 4));
}
module.exports = hasTargetSum;