Skip to content

Commit c918e2e

Browse files
author
Rubinder25
committed
test.json added
1 parent 288fbd1 commit c918e2e

File tree

7 files changed

+84
-15
lines changed

7 files changed

+84
-15
lines changed

hard/largest_sum_adjacent_numbers/largest_sum_adjacent_numbers.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ function largestSumOfNonAdjacentNumbers(arr) {
1313
return Math.max(inc, exc);
1414
}
1515

16-
/* Test */
17-
console.log(largestSumOfNonAdjacentNumbers([1, 4, 10, 50, 80, 38])); // 92
18-
console.log(largestSumOfNonAdjacentNumbers([1, 2])); // 2
19-
console.log(largestSumOfNonAdjacentNumbers([2, 1])); // 2
16+
module.exports = largestSumOfNonAdjacentNumbers;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"title": "largest_sum_adjacent_numbers",
3+
"tests": [
4+
{
5+
"desc": 1,
6+
"args": [[1, 4, 10, 50, 80, 38]],
7+
"exp": 92
8+
},
9+
{
10+
"desc": 2,
11+
"args": [[1, 2]],
12+
"exp": 2
13+
},
14+
{
15+
"desc": 3,
16+
"args": [[2, 1]],
17+
"exp": 2
18+
}
19+
]
20+
}

hard/longest_increasing_subsequence/tests.json renamed to hard/longest_increasing_subsequence/test.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"title": "longest_increasing_subsequence",
23
"tests": [
34
{
45
"desc": 1,

hard/longest_substring_k_distinct_characters/longest_Substring_with_k_distinct_characters.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,4 @@ function longestSubstringWithKDistinctChars(s, k) {
5151
return currS.length >= lastS.length ? currS : lastS;
5252
}
5353

54-
/* Test */
55-
console.log(longestSubstringWithKDistinctChars('abcba', 2)); // bcb
56-
console.log(longestSubstringWithKDistinctChars('aaabcba', 2)); // aaab
57-
console.log(longestSubstringWithKDistinctChars('aaabcba', 3)); // aaabcba
58-
console.log(longestSubstringWithKDistinctChars('bbbbzaaabcba', 3)); // bbbbzaaab
59-
console.log(longestSubstringWithKDistinctChars('ab', 3)); // ab
60-
console.log(longestSubstringWithKDistinctChars('ab', 1)); // b
54+
module.exports = longestSubstringWithKDistinctChars;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"title": "longest_substring_k_distinct_characters",
3+
"tests": [
4+
{
5+
"desc": 1,
6+
"args": ["abcba", 2],
7+
"exp": "bcb"
8+
},
9+
{
10+
"desc": 2,
11+
"args": ["aaabcba", 2],
12+
"exp": "aaab"
13+
},
14+
{
15+
"desc": 3,
16+
"args": ["aaabcba", 3],
17+
"exp": "aaabcba"
18+
},
19+
{
20+
"desc": 4,
21+
"args": ["bbbbzaaabcba", 3],
22+
"exp": "bbbbzaaab"
23+
},
24+
{
25+
"desc": 5,
26+
"args": ["ab", 3],
27+
"exp": "ab"
28+
},
29+
{
30+
"desc": 6,
31+
"args": ["ab", 2],
32+
"exp": "ab"
33+
},
34+
{
35+
"desc": 6,
36+
"args": ["ab", 1],
37+
"exp": "b"
38+
}
39+
]
40+
}

hard/trapping_rain_water/test.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"title": "trapping_rain_water",
3+
"tests": [
4+
{
5+
"desc": 1,
6+
"args": [[0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1]],
7+
"exp": 6
8+
},
9+
{
10+
"desc": 2,
11+
"args": [[2, 0, 2]],
12+
"exp": 2
13+
},
14+
{
15+
"desc": 3,
16+
"args": [[2]],
17+
"exp": 0
18+
}
19+
]
20+
}

hard/trapping_rain_water/trapping_rain_water.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,4 @@ function trapping_rain_water(bars) {
2424
return water;
2525
}
2626

27-
/* Test */
28-
console.log(trapping_rain_water([0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1])); // 6
29-
console.log(trapping_rain_water([2, 0, 2])); // 2
30-
console.log(trapping_rain_water([2])); // 0
27+
module.exports = trapping_rain_water;

0 commit comments

Comments
 (0)