Discount Tags

Problem Overview

  • Select a subset of tags so the total value is even and as large as possible.
  • Input: val[] (integers, positive or negative, at least one even); Output: int maximum even sum; choosing no tags is allowed.
  • Real-world context: picking discount tags in HackerMall to qualify for coupons.
  • Source: Mathworks interviews; a coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: