This is a entry test for semasio.
- Given an array of integers, find the maximum product between two numbers from the array, that is a multiple of 3.
- The result for the input {6,8,8,7,2,5} should be 48 = 68. Note that 88 is the greatest product (64) but 64 isn't divisible by 3.
- Given the input {1,9,2,4} the result should be 36 = 94, and not 81 (99) since you should't multiply a number by itself.
- Should has a O(n) time complexity instead of O(n^2);
Test completed successfully and does what has been requested. Tests cover of the application.
The API is here.
- Make sure you already have node.js installed;
- Install mocha and istanbul globally
npm install mocha istanbul -g
; - Clone the project in a folder (let's say "semasio-test");
- Open a command line and cd into the folder;
- Run the command
npm install
;
- Run tests:
mocha
; - Run tests with code coverage:
npm test
;