PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Statistics & Math/Snapchat

Explain median vs mean for L1/L2

Last updated: Mar 29, 2026

Quick Overview

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.

  • medium
  • Snapchat
  • Statistics & Math
  • Software Engineer

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.

Related Interview Questions

  • Compute posterior spam risk from flags - Snapchat (Medium)
  • Derive logistic regression and thresholds - Snapchat (hard)
  • Compute expectations and test fairness for coin flips - Snapchat (easy)
  • How to Update Bayesian Model for Concept Drift? - Snapchat (medium)
  • Calculate Posterior Probability Using Bayes' Theorem Example - Snapchat (easy)
Snapchat logo
Snapchat
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Statistics & Math
8
0

Median vs Mean Under L1 and L2, and the 2D Extension

Task

Explain, with intuition and a brief derivation, why:

  • In 1D, the median minimizes the sum of absolute deviations (L1), while the mean minimizes the sum of squared deviations (L2).
  • In 2D, the optimal point under Manhattan distance (L1) versus Euclidean distance (L2) corresponds to which estimator.
  • When the average (mean) is a poor choice due to outliers.

Assumptions/Setup

  • 1D data: x₁, x₂, …, xₙ ∈ ℝ.
  • 2D points: pᵢ = (xᵢ, yᵢ) ∈ ℝ².
  • “L1” refers to minimizing sum of absolute deviations; “L2” refers to minimizing sum of squared deviations. For 2D Euclidean distance, clarify whether the loss is squared or unsquared; both are addressed.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Statistics & Math•More Snapchat•More Software Engineer•Snapchat Software Engineer•Snapchat Statistics & Math•Software Engineer Statistics & Math
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.