Company: Amazon_3oct
Difficulty: medium
Minimum Operations to Dispatch Items Problem Description The logistics coordinator at an Amazon fulfillment center needs to dispatch n items from different warehouses. The warehouse of the i -th item is given by the array warehouses[i] . The coordinator performs one operation at a time, and each operation is one of the following: If the inventory has two or more items, the coordinator can select two items x and y from the inventory if they are stored in different warehouses, that is warehouses[x] != warehouses[y] , and dispatch both of them. If the inventory has one or more items, the coordinator can select one item x from the inventory and dispatch it. After an item is dispatched it is removed from the inventory, and the items that are not yet dispatched close up, keeping the same order as before. Any two remaining items may be chosen in operation 1; they do not have to be next to each other. Given n items and the array warehouses , find the minimum number of operations the coordinato