Domanda di colloquio di Yelp

Last 15 mins- coding question: Given 6 integers and 1 target value, write a function to get the target value using 6 integers with any on these operations +,*,-,/

Risposte di colloquio

Anonimo

24 mag 2013

You would have to check for all 4^(6-1) combinations, since there are 4 possible operators and 6-1 positions at which operators can be plugged in! Is there any way to optimize this?

Anonimo

15 ago 2013

suppose Xi are the 6 int. and v the target value the function is F(X) = Sum(k=1..N){ v * (Prod(i=1..6 , i!=k) {(X-Xi)} /(Prod(i=1..6 , i!=k) {(Xk-Xi)}}

Anonimo

30 mar 2013

what could be the answer?

Anonimo

30 mar 2013

what could be the answer?