2979. Most Expensive Item That Can Not Be Bought ¶ Time: $O(1)$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6 7class Solution { public: int mostExpensiveItem(int primeOne, int primeTwo) { // https://en.wikipedia.org/wiki/Coin_problem return primeOne * primeTwo - primeOne - primeTwo; } }; 1 2 3 4 5 6class Solution { public int mostExpensiveItem(int primeOne, int primeTwo) { // https://en.wikipedia.org/wiki/Coin_problem return primeOne * primeTwo - primeOne - primeTwo; } } 1 2 3 4class Solution: def mostExpensiveItem(self, primeOne: int, primeTwo: int) -> int: # https://en.wikipedia.org/wiki/Coin_problem return primeOne * primeTwo - primeOne - primeTwo