Skip to content

Commit 15e9262

Browse files
author
Gonzalo Diaz
committed
[REFACTOR] [Hacker Rank] Interview Preparation Kit: Search: Swap Nodes [Algo].
1 parent 650457b commit 15e9262

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/hackerrank/interview_preparation_kit/search/swap_nodes_algo.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ describe('swap_nodes_algo', () => {
5555
expect(t_result).toStrictEqual(expected);
5656
});
5757

58-
it('build_tree and plain test cases', () => {
58+
it('build tree and flattened tree test cases', () => {
5959
expect.assertions(4);
6060

6161
TEST_CASES.forEach((test) => {
6262
const t_to_test = build_tree(test.nodes);
6363
const t_result = flat_tree(t_to_test);
6464

65-
expect(t_result).toStrictEqual(test.plain);
65+
expect(t_result).toStrictEqual(test.flattened);
6666
});
6767
});
6868

src/hackerrank/interview_preparation_kit/search/swap_nodes_algo.testcases.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
{
33
"title": "Sample 0",
44
"nodes": [[2, 3], [-1, -1], [-1, -1]],
5-
"plain": [2, 1, 3],
5+
"flattened": [2, 1, 3],
66
"queries": [1, 1],
77
"expected": [[3, 1, 2], [2, 1, 3]]
88
},
99
{
1010
"title": "Sample 1",
1111
"nodes": [[2, 3], [-1, 4], [-1, 5], [-1, -1], [-1, -1]],
12-
"plain": [2, 4, 1, 3, 5],
12+
"flattened": [2, 4, 1, 3, 5],
1313
"queries": [2],
1414
"expected": [[4, 2, 1, 5, 3]]
1515
},
1616
{
1717
"title": "Sample 2",
1818
"nodes": [[2, 3], [4, -1], [5, -1], [6, -1], [7, 8], [-1, 9],
1919
[-1, -1], [10, 11], [-1, -1], [-1, -1], [-1, -1]],
20-
"plain": [6, 9, 4, 2, 1, 7, 5, 10, 8, 11, 3],
20+
"flattened": [6, 9, 4, 2, 1, 7, 5, 10, 8, 11, 3],
2121
"queries": [2, 4],
2222
"expected": [[2, 9, 6, 4, 1, 3, 7, 5, 11, 8, 10],
2323
[2, 6, 9, 4, 1, 3, 7, 5, 10, 8, 11]]
@@ -27,7 +27,7 @@
2727
"nodes": [[2, 3], [4, 5], [6, -1], [-1, 7], [8, 9], [10, 11], [12, 13],
2828
[-1, 14], [-1, -1], [15, -1], [16, 17], [-1, -1], [-1, -1],
2929
[-1, -1], [-1, -1], [-1, -1], [-1, -1]],
30-
"plain": [4, 12, 7, 13, 2, 8, 14, 5, 9, 1, 15, 10, 6, 16, 11, 17, 3],
30+
"flattened": [4, 12, 7, 13, 2, 8, 14, 5, 9, 1, 15, 10, 6, 16, 11, 17, 3],
3131
"queries": [2, 3],
3232
"expected": [[14, 8, 5, 9, 2, 4, 13, 7, 12, 1, 3, 10, 15, 6, 17, 11, 16],
3333
[9, 5, 14, 8, 2, 13, 7, 12, 4, 1, 3, 17, 11, 16, 6, 10, 15]]

0 commit comments

Comments
 (0)