11

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!

Jamal Senjaya
  • 17,864
  • 2
  • 41
  • 147

2 Answers2

11

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

Explanation:

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) {
    history.add(kid);
    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);
            }
        }
    }
}
10

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.

dcfyj
  • 7,756
  • 23
  • 64
  • Could you maybe use more neutral colors? (and preferably also a color combination that is accessible for colorblind folk) – Will Aug 16 '16 at 17:01
  • @will right, sorry I tend to not think of that issue when doing these. I'll fix it. – dcfyj Aug 16 '16 at 17:02
  • @will Does this work better? – dcfyj Aug 16 '16 at 17:07
  • 4
    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). – gtwebb Aug 16 '16 at 17:19
  • @gtwebb nifty, I'll start using that too. – dcfyj Aug 16 '16 at 17:20
  • It's definitely better now, but that red is still a bit pain-inducing especially with the extra black. Less saturated colors would be nice: two possible palettes which are less saturated but still contrasting. – Will Aug 16 '16 at 17:44
  • @Will less painful? – dcfyj Aug 16 '16 at 17:51