Answered step by step
Verified Expert Solution
Link Copied!
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<=1<=n<=10^5<=10^5
10^9<=-10^9<=val[[i]<=10^9]<=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 ... blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Cost Accounting A Managerial Emphasis

Authors: Horngren, Srikant Datar, George Foster, Madhav Rajan, Christ

6th Canadian edition

978-0132893534, 9780133389401, 132893533, 133389405, 978-0133392883

More Books

Students explore these related Programming questions