Data Structures & AlgorithmsVery hardICPC regional · probability

Problem: What is the expected number of steps for a random walk on a path of length n starting at one end to reach the other end?

  1. A. (n - 1)^2 steps
  2. B. n steps
  3. C. log n steps
  4. D. 2^n steps

Correct answer: A. (n - 1)^2 steps

The expected hitting time on a path is the square of the distance for a simple random walk.

More Coding Interview Problems questions

Exams that ask this topic