Expected Weight
Given a sequence $A$ of length $N$, the weight of this sequence is defined as $$\text{weight}(A) = \sum_{i = 1}^{N} i\cdot A_i$$ Given an integer $N$, we pick a permutation $A$ of $[1, 2 \dots N]$ uniformly at random. What is the expected weight of this permutation? It can be shown that the answer can be represented as $\displaystyle \frac{P}{Q}$ where $P$ and $Q$ are coprime integers and $Q \n
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start