## Ice Cream Parlor

Solutions The brute force approach is easy: just run two nested loops and for each value \( x \) find if it exists a value equals to \( target - x \). This solution is quadratic.
Efficient solutions are based either on sorting or additional storage (e.g. frequency table, hash maps).
A sort-based solution Suppose we sort the prices \( p \) in ascending order. Consider the sum \( p[0] + p[n-1] \) where \( n \) is the number of available prices.
[Read More]