There were 25 kids in a class and each kid had some best friends. To simplify the problem, let's call each kid by their initial name. Here is a list of each kid's best friends:

a: [l, h]
b: [k, m, i]
c: [f, l, n, j]
d: [g, m, o]
e: [h, n]
f: [c, m, q]
g: [d, n, r, p]
h: [a, k, q, s, o, e]
i: [b, l, r, t]
j: [c, m, s]
k: [u, r, h, b]
l: [u, w, s, i, c, a]
m: [f, b, d, j, t, x, p, v]
n: [y, w, q, g, c, e]
o: [x, r, h, d]
p: [w, m, g]
q: [x, n, h, f]
r: [u, k, g, i, o, y]
s: [v, l, h, j]
t: [w, m, i]
u: [l, r]
v: [k, m, s]
w: [p, l, n, t]
x: [q, m, o]
y: [r, n]

One day all the kids were outside the class room except a. Then his teacher asked a to call one of his best friends into room. a called l. Then the teacher asked l to call one of his best friends outside to enter the room, and so on.

After all the call chain, there were no more kids outside, and s was the last kid called.

Determine the call chain!

  • 1
    $\begingroup$ v has k as a best friend, but k does not have v. Is this intentional? $\endgroup$ – Mike Earnest Aug 16 '16 at 16:28
  • 1
    $\begingroup$ @MikeEarnest Unrequited love, what a sad affair. $\endgroup$ – dcfyj Aug 16 '16 at 16:31
  • 1
    $\begingroup$ @mike you are very conscientious, yes it is intentional, to make the answer unique. as dcfyj said Unrequited love haha $\endgroup$ – Jamal Senjaya Aug 16 '16 at 16:48
  • 2
    $\begingroup$ Made a graph of the number of items left in a breadth-first search, just for fun. Looks neat. $\endgroup$ – user20 Aug 16 '16 at 17:33
  • 1
    $\begingroup$ @Emrakul - my idea of fun is soooo different... :P $\endgroup$ – Beastly Gerbil Aug 16 '16 at 18:33

I think I found it:

a, l, u, r, y, n, e, h, k, b, i, t, w, p, g, d, o, x, q, f, c, j, m, v, s


Since this puzzle is tagged with , I wrote a program that just brute-forces every possibility with recursion. If the last kid has the name "s", it prints out the sequence above. Here's a pseudo code of the recursion method I used:

void foo(Kid kid, List<Kid> history) {
    if (history.size() == 25) {
        if (kid.getName().equals("s")) {
            for (Kid child : history) {
                print(child.getName() + " ");
    } else {
        for (Kid friend : kid.getFriends()) {
            if (!history.contains(friend)) {
                foo(friend, history);
  • 2
    $\begingroup$ Sadly you beat me to it, but then again, that's what I get for doing a computerpuzzle by hand. $\endgroup$ – dcfyj Aug 16 '16 at 16:59
  • $\begingroup$ @dcfyj But you'll probably get more upvotes since doing it by hand is presumably much harder. :D $\endgroup$ – user14478 Aug 16 '16 at 17:01
  • $\begingroup$ @LukasRotter wasn't necessarily hard, just slow. $\endgroup$ – dcfyj Aug 16 '16 at 17:03
  • $\begingroup$ Is there only one solution? $\endgroup$ – Beastly Gerbil Aug 16 '16 at 18:32
  • $\begingroup$ @BeastlyGerbil With the requirement that the last kid must be "s", yes. If that requirement doesn't exist, there are of course "a few" more :P. $\endgroup$ – user14478 Aug 16 '16 at 18:36

The calling order is:

Calling order

For an easier read here's the order written out:

a, l, u, r, y, n, e, h, k, b, i, t, w, p, g, d, o, x, q, f, c, j, m, v, s

I got this order by slowly but surely ruling out the possibilities. For the most part this was a straight up logic puzzle (the grid kind, think Einstein's puzzle) but towards the end I had to make a guess in order to complete the sequence.

  • $\begingroup$ Could you maybe use more neutral colors? (and preferably also a color combination that is accessible for colorblind folk) $\endgroup$ – Will Aug 16 '16 at 17:01
  • $\begingroup$ @will right, sorry I tend to not think of that issue when doing these. I'll fix it. $\endgroup$ – dcfyj Aug 16 '16 at 17:02
  • $\begingroup$ @will Does this work better? $\endgroup$ – dcfyj Aug 16 '16 at 17:07
  • 4
    $\begingroup$ Just out of interest I work with someone who is colorblind and tend to use colororacle to check images before I send them on. You can basically put a filter over your screen (still image only) to check how it would look to someone who has different forms of colourblindness. (Note I've never actually asked anyone that's colourblind how well it works, the screen shouldn't change when filter is applied for them, but I've never had complaints since I started using it). $\endgroup$ – gtwebb Aug 16 '16 at 17:19
  • $\begingroup$ @gtwebb nifty, I'll start using that too. $\endgroup$ – dcfyj Aug 16 '16 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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