Skip to content

Commit 9f55264

Browse files
committed
[REFACTOR] [Hacker Rank] Interview Preparation Kit: Greedy Algorithms: Minimum Absolute Difference in an Array.
* Adjusted the interface to match what hackerrank expects.
1 parent 255c373 commit 9f55264

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/hackerrank/interview_preparation_kit/greedy_algorithms/minimum_absolute_difference_in_an_array.js

Lines changed: 2 additions & 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/minimum-absolute-difference-in-an-array.md]]
33
*/
44

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

88
let result = Math.abs(sortedNums[sortedNums.length - 1] - sortedNums[0]);
@@ -20,3 +20,4 @@ export function minimumAbsoluteDifference(arr) {
2020
}
2121

2222
export default { minimumAbsoluteDifference };
23+
export { minimumAbsoluteDifference };

0 commit comments

Comments
 (0)