3Sum Closest

Medium algorithms interview practice: 3Sum Closest.

Given an array of integers and a target $S$, you need to find three distinct elements whose sum is closest to $S$. Which approach achieves O(n²) time complexity?