Skip to content

Commit 2e967ef

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

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/hackerrank/interview_preparation_kit/greedy_algorithms/greedy_florist.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @see Solution Notes: [[docs/hackerrank/interview_preparation_kit/greedy_algorithms/greedy-florist-solution-notes.md]]
44
*/
55

6-
export function getMinimumCost(k, c) {
6+
function getMinimumCost(k, c) {
77
const flowers = c.map((x) => x).sort((a, b) => b - a);
88

99
let total = 0;

src/hackerrank/interview_preparation_kit/greedy_algorithms/greedy_florist.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 { getMinimumCost } from './greedy_florist.js';
4+
import greedyFlorist from './greedy_florist.js';
55

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

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

1212
TEST_CASES.forEach((test) => {
13-
const answer = getMinimumCost(test.k, test.contests);
13+
const answer = greedyFlorist.getMinimumCost(test.k, test.contests);
1414

1515
console.debug(
1616
`getMinimumCost(${test.k}, ${test.contests}) solution found: ${answer}`

0 commit comments

Comments
 (0)