Company: amazon_23april
Difficulty: medium
Amazon Real Estate Analytics - Building Height Variance Problem Within the Amazon Real Estate Analytics Toolset, an investor is evaluating a series of buildings of varying heights. The investor aims to find a group of buildings that adhere to two key conditions: 1. The selected buildings must form a valid group: A group is considered valid if it is a contiguous subsegment of the original array with a size of at least 2 The heights of the first and last buildings in this subsegment must be the same 2. The group variance should be as minimal as possible The variance of a group is defined as: the difference between the size of the group and the occurrences of the first element height in the group. For example, the variance of group [4, 2, 5, 4] is 4 - 2 = 2 (size 4 minus two occurrences of 4). Function Description Complete the function findMinimumVariance with the following parameter: int height[n] : the height of each building Returns int : the variance of a valid group of buildings with