Explain median vs mean for L1/L2
Company: Snapchat
Role: Software Engineer
Category: Statistics & Math
Difficulty: medium
Interview Round: Technical Screen
Explain, with intuition and a brief derivation, why the median minimizes the sum of absolute deviations (L
1) while the mean minimizes the sum of squared deviations (L
2). How does this extend to selecting an optimal point in two dimensions under Manhattan versus Euclidean distance, and when is the average a poor choice due to outliers?
Quick Answer: This question evaluates understanding of central tendency and loss functions—specifically the roles of median and mean under L1 (absolute) and L2 (squared) norms—and the geometric extension of these concepts to two-dimensional data.