[LeetCode] Buy Two Chocolates

1 · · May 28, 2023, 1:39 a.m.
2706. Buy Two Chocolates You are given an integer array prices representing the prices of various chocolates in a store. You are also given a single integer money, which represents your initial amount of money. You must buy exactly two chocolates in such a way that you still have some non-negative leftover money. You would like to minimize the sum of the prices of the two chocolates you buy. Return the amount of money you will have leftover after buying the two chocolates. If there is no way fo...