Answered step by step
Verified Expert Solution
Question
1 Approved Answer
One of the shops in hackerMall is offering discount coupons based on a puzzling porblem. There are n tags, where each tag has a value
One of the shops in hackerMall is offering discount coupons based on a puzzling porblem. There are n tags, where each tag has a value denoted by val[i]. A customer needs to choose teh tags in such a way that the sum of values is even. Teh goal is to find the maxcimum possible even sum of tags that can be chosen.
Note:
It is guaranteed taht there is atleast one tag with an even value.
The tags can have positive or negative value
It can be possible to choose no tags at all
Function description:
Complete the function getMaximumEvenSum in the editor below
getMaximumEvenSum has teh following parameters:
int val[n]: the values of tag in the shop of hackerMall
Returns:
long_int: the maximum even sum of tag values
COntraints:
1<=n<=10^5
−10^9<=val[i]<=10^9
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Identify even and odd tags Separate the tags into two lists one containing tags with even values and ...
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started