Books · The Fiddler: Solutions
Chapter 37
Can Your Team Self-Organize?
In a team-building game, everyone writes down a distinct number, then independently places their name at a random spot on a line. The team’s score is the length of the longest increasing subsequence of the revealed numbers, read left to right. With four people placing themselves at random, what score do you expect on average?
The Fiddler, Zach Wissner-Gross, September 19, 2025(original post)
Solution
The positions make a uniformly random permutation of the four distinct values, and the score is its longest increasing subsequence (LIS). By the Robinson–Schensted correspondence the LIS equals the length of the first row of the associated Young diagram, and the number of permutations of with a given shape is , where is the number of standard tableaux. For : so the LIS distribution is over permutations and
The computation
With four players the orderings are just the permutations: compute each one’s longest increasing subsequence by patience sorting and average.
import bisect, itertools as it
from fractions import Fraction as F
def lis(p):
t = []
for x in p:
i = bisect.bisect_left(t, x); t[i:i+1] = [x]
return len(t)
print(F(sum(lis(p) for p in it.permutations(range(4))), 24)) # 29/12
Extra Credit
Now ten people play instead of four. What is the expected score?
Solution
The same identity gives , with from the hook-length formula. Summed over all partitions of , (The source’s value is paywalled; this exact figure is my own.)
The computation
Ten players make a touch much to sweep, so sample instead: draw a million random orderings of ten, take the longest increasing subsequence of each, and average. It lands on .
import numpy as np
rng = np.random.default_rng(0); M = 1_000_000; total = 0
for _ in range(M):
total += lis(rng.permutation(10))
print(round(total / M, 4)) # ~4.335