3 Commits

Author SHA1 Message Date
6aa3314b93 fix: fixed error in the MaxProductOfThree algorithm (#1295)
* fix: fixed error in the MaxProductOfThree algorithm

Fixed the error in the MaxProductOfThree by initializing the max and min
variables to null instead of -1. The checks were then altered to check
for null instead of -1.

Also wrote more tests, which randomly generated small arrays and
compared the output of the maxProductOfThree-algorithm to the output of
a slower, but complete, function which calculates all posible
triple-products of the values of the array.

Fixes: #1294

* fix: Added newlines at the end of the files
2023-02-19 01:05:07 +05:30
67ec915d97 added throwing an error when array with <3 items is passed 2021-10-15 21:49:29 +05:30
41ddee7074 Added Maximum product of 3 numbers in an array 2021-10-14 21:10:34 +05:30