Gifts
You have gifts, and each gift contains a certain number of candies and oranges. Your goal is to make all gifts identical in terms of the number of candies and oranges. You are allowed to perform the following operations on any gift:
- Remove one candy.
- Remove one orange.
- Remove one candy and one orange at the same time.
- You cannot remove more than what is available in a gift (no negative values).
After performing some moves, all gifts must have the same number of candies and the same number of oranges (though candies and oranges do not need to be equal to each other). Your task is to find the minimum number of moves required to achieve this.
Example 1
Input:
candies = [3, 5, 6]; oranges = [3, 2, 3]
Output:
6
main.cpp
C++
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat