Goldman Sachs Interview Question
Software Engineer / DevelopersA->R
A-R->A // at this point A is zeroed out
B->R
A-R->A // A == -B
A->R // R == -B
A-R->A // A == 0
A-R->A // A == B
tat was a gud sol..But how did u come up with it ?? Did u use any logic..or was it trial and error ? if u used a definite logic can u share it with us ?
It took me half an hour to find the same solution. I was just thinking for 5 minutes then I want to sleep for 25 minutes. In the dream the solution popped up. So at the end of 30th minute I woke up and I found the solution.
No. Its right.
B -> R (R contains B)
A-R -> A (R contains B. A contains A-B)
A -> R (R contains A-B)
A-R -> A (A - [A-B] = A - A + B = B. So A contains B)
explanation is here
- Jack December 28, 2014campuscoke.blogspot.in/2014/12/add-two-numbers-without-using.html