I hereby claim:
- I am daubattu on github.
- I am daubattu (https://keybase.io/daubattu) on keybase.
- I have a public key ASBTpgg7GynCVrzIEtnznswkwvUA31GHj-Om_4ZCGZatrwo
To claim this, I am signing this object:
function bonAppetit(bill, k, b) { | |
const sum = bill.reduce((r, v) => r + v, 0); | |
const result = (sum - bill[k])/2; | |
if (b - result === 0) console.log('Bon Appetit'); | |
else console.log(b - result); | |
} |
function divisibleSumPairs(n, k, ar) { | |
let result = 0; | |
for(let i = 0; i < n - 1; i++) { | |
result += ar.slice(i + 1, n).filter((item, index) => { | |
if ((item + ar[i]) % k === 0) { | |
return item; | |
} | |
}).length; | |
} | |
return result; |
function birthday(s, d, m) { | |
let result = 0; | |
for(let i = 0; i < s.length - (m - 1); i++) { | |
if (s.slice(i, i + m).reduce((r, v) => r + v, 0) === d) { | |
result++; | |
} | |
} | |
return result; | |
} |
function breakingRecords(scores) { | |
let best = 0; | |
let worst = 0; | |
let bestScore = scores[0]; | |
let worstScore = scores[0]; | |
const lengthOfData = scores.length; | |
for(let i = 1; i < scores.length; i++) { | |
if (scores[i] > bestScore) { | |
bestScore = scores[i]; | |
best++; |
function getTotalX(a, b) { | |
// Write your code here | |
let result = 0; | |
let index = 1; | |
let cloneA = a.splice(1, a.length); // clone new array of a but not a[0] | |
while(a[0] * index <= b[0]) { | |
if( | |
cloneA.every(item => (a[0] * index) % item === 0) | |
&& | |
b.every(item => item % (a[0] * index) === 0) |
I hereby claim:
To claim this, I am signing this object: