Skip to content

Commit 0c0ab2e

Browse files
committed
[REFACTOR] [Hacker Rank] Interview Preparation Kit: Search: Swap Nodes [Algo].
* Adjusted the interface to match what hackerrank expects.
1 parent c74960a commit 0c0ab2e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/hackerrank/interview_preparation_kit/search/swap_nodes_algo.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/**
2-
* @link Problem export functioninition [[docs/hackerrank/interview_preparation_kit/search/swap-nodes-algo.md]]
2+
* @link Problem definition [[docs/hackerrank/interview_preparation_kit/search/swap-nodes-algo.md]]
33
*/
44

55
import { Node } from '../../lib/Node.js';
66

77
// CONSTANTS
8-
export const __INITIAL_LEVEL__ = 1;
9-
export const __ROOT_VALUE__ = 1;
10-
export const __LEAF_VALUE__ = -1;
8+
const __INITIAL_LEVEL__ = 1;
9+
const __ROOT_VALUE__ = 1;
10+
const __LEAF_VALUE__ = -1;
1111
const __RADIX__ = 10;
1212

13-
export class Tree {
13+
class Tree {
1414
root;
1515

1616
nodeCollector;
@@ -97,7 +97,7 @@ export class Tree {
9797
}
9898
}
9999

100-
export function swapNodes(indexes, queries) {
100+
function swapNodes(indexes, queries) {
101101
const tree = new Tree(indexes);
102102
let nodeCollector = tree.getCollector();
103103
const output = [];
@@ -126,4 +126,5 @@ export function swapNodes(indexes, queries) {
126126
return output;
127127
}
128128

129-
export default { swapNodes, __INITIAL_LEVEL__ };
129+
export default { swapNodes, Tree, __INITIAL_LEVEL__ };
130+
export { swapNodes, Tree, __INITIAL_LEVEL__ };

0 commit comments

Comments
 (0)