Maximum Product of Three Numbers
In this lab, you are required to complete a function that finds the maximum product of three numbers in a given array of integers. The function,
maximumProduct, accepts an array of integers called
nums and returns the maximum product of any three numbers in the array. Here, you have to use ESM import/export for handling your code.
Input: nums = [1,2,3] Output: 6
Input: nums = [1,2,3,4] Output: 24
Input: nums = [-1,-2,-3] Output: -6
Notice how the array can contain both positive and negative integers, and the maximum product is not limited to the product of the largest three numbers in the array.
After implementing the function, work on the following challenges that will be used to test the correctness of your implementation:
- Challenge 1 - The function is successfully returning the maximum possible product.
- Challenge 2 - The function handles edge cases and provides the correct output for different input arrays.
To ensure an accurate and efficient evaluation of your code, pay close attention to the evaluation script. Make sure to completely write it without leaving anything incomplete or making any mistakes. Finally, keep in mind that the final length of the
testlog array should match the number of challenges, and the order of the evaluation script should be in line with the order of the challenges presented.
Good luck! Feel free to reach out for any further clarification or assistance.
Make sure you're default exporting the function