Company: Amazon_20nov
Difficulty: medium
Code Question 1 Problem Description An Amazon distribution specialist needs to process n packages from different distribution centers, the center of the i-th package is represented by an array centers[i]. The specialist is allowed to perform one operation at a time. Each operation is described below: 1. If the queue has two or more packages, the specialist can choose two packages x and y from the queue if they are from different distribution centers. i.e. centers[x] != centers[y] and process both of them. 2. If the queue has one or more packages, the specialist can choose one package x from the queue and process it. Note: After processing a package it gets removed from the queue, and the rest of the packages which are currently not processed come together keeping the order the same as before. Given n packages and an array centers, find the minimum number of operations that the specialist has to perform to process all of the packages. Examples Example 1: Input: n = 5, centers = [3, 7, 5