Optimal Regularity of Lower-Dimensional Obstacle Problems