Company: wayfair_27oct
Difficulty: medium
Discount Tags Problem Description A shop in HackerMall offers discount coupons based on a puzzle. There are n tags, each with a value denoted by val[i] . A customer needs to choose tags in such a way that the sum of values is even. The goal is to find the maximum possible even sum of values of tags that can be chosen. Note: There is at least one tag with an even value. Tags can have positive or negative values. It is possible to choose no tags at all. Complete the function getMaximumEvenSum in the editor. Function Signature: long getMaximumEvenSum(vector<int> val) Parameters: val : An array of integers representing the values of tags. The size of val is n . Returns: long : The maximum even sum of tag values. Examples Example 1: Consider some of the following chosen tags and their corresponding sums: val = [2, 3, 6, -5, 10, 1, 1] Chosen Tags | Sum | Is sum even? ----------------------------|-----|------------- [2, 3, 6, 10, 1, 1] | 23 | No [2, 3, 6, -5, 10, 1, 1] | 18 | Yes [2, 6,