9
$\begingroup$

This is an entry for the 16th Fortnightly Challenge.


I found this note on my colleague's desk:

note

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?

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

4 Answers 4

9
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Well, from the solution, you can see what the colleague assumed. And it is the other one. $\endgroup$ Commented Sep 30, 2016 at 11:40
3
$\begingroup$

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.

$\endgroup$
5
  • $\begingroup$ No equations are involved. Otherwise there would have been signs to justify that (+/-/=, etc.). $\endgroup$ Commented Sep 30, 2016 at 10:43
  • $\begingroup$ 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 :-).) $\endgroup$
    – Gareth McCaughan
    Commented Sep 30, 2016 at 10:45
  • $\begingroup$ 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. $\endgroup$ Commented Sep 30, 2016 at 10:51
  • $\begingroup$ 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. $\endgroup$
    – Gareth McCaughan
    Commented Sep 30, 2016 at 10:52
  • $\begingroup$ (My point about what I might write was merely to explain why I hadn't been troubled by the absence of +, -, etc.) $\endgroup$
    – Gareth McCaughan
    Commented Sep 30, 2016 at 10:52
2
$\begingroup$

The answer is:

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,

enter image description here

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

ok, my answer

One of those river-crossing puzzles- perhaps the grain, the goat and the tiger puzzle First A goes over, then AB(the 3rd object), B. Farmer returns with the object, then takes them to the other shore again in the manner..

I would say I am not too sure about this because I can't make out which is A and which is B...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.