Sollicitatievraag bij Microsoft

Given 2 integer, return their multiplication without using the multiplication operator

Antwoorden op sollicitatievragen

Anoniem

31 okt 2017

Recursion. Manipulate only one of the two integers, let’s say y. If y is 0 then return 0. If y is greater than 0, call the same function with y-1 and return the sum of its result and x. Do not forget the case where y is negative (call the function with -y, and return the opposite)

Anoniem

16 jan 2022

function(a,b) { return (a << floor(log2(b))) + b%2==0?0:b; }

Anoniem

29 nov 2016

Bit manipulation