Skip to content

Instantly share code, notes, and snippets.

View kyle-pena-nlp's full-sized avatar

Kyle Pena kyle-pena-nlp

View GitHub Profile
@kyle-pena-nlp
kyle-pena-nlp / gist:b6d1c5fe71d6279900d9d2962e011877
Created December 17, 2025 17:32
Find quotient without multiplication or division
function findQuotientRec(dividend, factors, offset, indices) {
i = 0;
while (factors[i] > dividend) {
i += 1;
}
if (i < factors.length) {
dividend -= factors[i];
indices.push(offset + i);
findQuotientRec(dividend, factors.slice(i), offset + i, indices);
}