avoidObstacles=n=>A(n);A=(n,i=1)=>n.every(m=>m%i!=0)?i:A(n,i+1)
////////10////////20////////30////////40////////50////////60////////70////////80////////90///////100
// [DAY 11] score: 63
/*
** javascriptmas golf rules:
** - the original test suite must pass and not be modified
** - the solution must generally work (edge cases aren't important unless stated in the problem)
** - each character in the code above counts as a stroke (including whitespace)
** - lowest score wins
*/
/**
* Test Suite
*/
describe('avoidObstacles()', () => {
it('returns minimal number of jumps in between numbers', () => {
// arrange
const nums = [5, 3, 6, 7, 9];
// act
const result = avoidObstacles(nums);
// log
console.log("result: ", result);
// assert
expect(result).toBe(4);
});
});
// describe('avoidObstacles()', () => {
// const tests = [
// [[5, 3, 6, 7, 9], 4],
// [[1, 5, 7, 9, 11, 13, 15, 17, 19, 21], 2],
// [[9, 10, 12, 14, 16], 11],
// [[5, 10], 3],
// [[20, 15, 2, 8], 6]
// ]
// tests.forEach(([array, solution]) => {
// it(array.toString(), () => {
// const result = avoidObstacles(array);
// console.log(`result: ${result}, expected: ${solution}, array: [${array}]`);
// expect(result).toBe(solution);
// })
// })
// })