Question d’entretien chez Microsoft

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

Réponses aux questions d'entretien

Utilisateur anonyme

31 oct. 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)

Utilisateur anonyme

16 janv. 2022

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

Utilisateur anonyme

29 nov. 2016

Bit manipulation