# A colleague's note

This is an entry for the 16th Fortnightly Challenge.

I found this note on my colleague's desk:

I am pretty sure he was solving a puzzle. Can anyone help me figure out what the puzzle was? I am pretty sure he mentioned something about an interview question - maybe this is relevant?

• Just to be clear, you do not know what the puzzle was? And maybe you have some more background information for us? :) Sep 30, 2016 at 7:26
• Alrighty, let's have some fun then :D Sep 30, 2016 at 7:30
• Was he trying to remember what letter comes after A and B? :) Sep 30, 2016 at 9:56
• (The usual notation for logical operations would make AB mean "A and B".) Sep 30, 2016 at 10:54
• @Maria Deleva Nice question..
– KSR
Sep 30, 2016 at 13:18

I think your colleague is trying to solve the following:

There are three boxes, one containing only Apples (A), one only Bananas (B), and one containing both Apples and Bananas (AB). They are labelled 'A','AB' and 'B', but it is known that none of the boxes are labelled correctly. Opening just one box, and without looking in the box, you take out one piece of fruit. By looking at the fruit, how can you immediately label all of the boxes correctly?

In that case,

the first row denotes the order of given labellings. He picks up a fruit from the box labelled 'AB' (as indicated by the second row) and mentally assumes it's a banana WLOG. Then the third row is the only possible ordering of the actual contents of the boxes.

• Well, from the solution, you can see what the colleague assumed. And it is the other one. Sep 30, 2016 at 11:40

There is a question sometimes used in programming interviews: how to

swap the numbers in two variables (or machine registers) without using a temporary variable/register

to which there are various answers along the lines of

a=a+b; b=a-b; a=a-b -- there are variants that begin with a subtraction or an exclusive-or.

These notes seem somewhat reminiscent of that, using AB to signify

whatever combination of A and B we start with and then use to compute each of A,B from the other.

I can't say I'm terribly convinced, though.

• No equations are involved. Otherwise there would have been signs to justify that (+/-/=, etc.). Sep 30, 2016 at 10:43
• Fair enough. (If I were scribbling notes to remind myself of the solution to the puzzle described in my answer, or to help explain it to someone else, they might look like "a b (new line) ab b (new line) ab a (new line) b a". But I'll take your word for it about your imaginary colleague :-).) Sep 30, 2016 at 10:45
• But what you just wrote still looks different, though. You have 2 entries per line and 4 lines. Here you have 3 on the first, 1 on the second, 3 on the third and a check mark on the fourth. Sep 30, 2016 at 10:51
• That's why I said I didn't find it terribly convincing :-). But you never know what peculiar things people will write down while solving a problem. Sep 30, 2016 at 10:52
• (My point about what I might write was merely to explain why I hadn't been troubled by the absence of +, -, etc.) Sep 30, 2016 at 10:52

A=1   B=-1

A  X  AB  =  B  i.e..,   1  X  -1   =  -1  which is equal to B

A  X  AB  =  AB  i.e..,  1  X  -1  =  -1  which is equal to AB

AB  X  B  =  A  i.e..,  -1  X  -1  = 1  which is equal to A


Diagrammatically,

• No equations are involved. Otherwise there would have been signs to justify that (+/-/=, etc.). Sep 30, 2016 at 10:44
• ok..i will try for other.
– KSR
Sep 30, 2016 at 10:44