Skip to content

Commit 02b2ae8

Browse files
committed
[REFACTOR] [Hacker Rank] Interview Preparation Kit: Greedy Algorithms: Max Min.
* Adjusted the interface to match what hackerrank expects.
1 parent 2e967ef commit 02b2ae8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/hackerrank/interview_preparation_kit/greedy_algorithms/angry_children.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @link Problem definition [[docs/hackerrank/interview_preparation_kit/greedy_algorithms/angry-children.md]]
33
*/
44

5-
export function maxMin(k, arr) {
5+
function maxMin(k, arr) {
66
const sortedlist = arr.map((x) => x).sort((a, b) => a - b);
77

88
let result = sortedlist[sortedlist.length - 1] - sortedlist[0];

src/hackerrank/interview_preparation_kit/greedy_algorithms/angry_children.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from '@jest/globals';
22
import { logger as console } from '../../../logger.js';
33

4-
import { maxMin } from './angry_children.js';
4+
import angryChildren from './angry_children.js';
55

66
import TEST_CASES from './angry_children.testcases.json';
77

@@ -10,7 +10,7 @@ describe('angry_children', () => {
1010
expect.assertions(4);
1111

1212
TEST_CASES.forEach((test) => {
13-
const answer = maxMin(test.k, test.arr);
13+
const answer = angryChildren.maxMin(test.k, test.arr);
1414

1515
console.debug(`maxMin(${test.k}, ${test.arr}) solution found: ${answer}`);
1616

0 commit comments

Comments
 (0)