FastPrepMaximum Even Sum Subsequence
Problems/Maximum Even Sum Subsequence

Maximum Even Sum Subsequence

MathWorks logoMathWorks● MediumFULLTIMEOA

Updated Jul 2026

QuestionFunctionExamples

Problem statement

Given an array arr containing positive and negative integers, choose a subsequence whose sum is even and as large as possible.

The subsequence may be empty. The empty subsequence has sum 0.

Return the maximum possible even sum.

Function

maximumEvenSumSubsequence(arr: int[]) → int

Examples

Example 1

arr = [-2, 2, -3, 1, 3]return = 6

Choose the subsequence [2, 1, 3]. Its sum is 6, which is the largest achievable even sum.

Example 2

arr = [-2, 2, -3, 4, 5]return = 8

Choose the subsequence [2, -3, 4, 5]. Its sum is 8, which is the largest achievable even sum.

More MathWorks interview questions

  • Earliest Time to Schedule a MeetingOA · Seen Nov 2026
  • Minimum Cost to Serve Requests on a RingOA · Seen Nov 2026
  • Minimum Tree Diameter After Removing K LeavesOA · Seen Nov 2026
  • Cities on Shortest Delivery RoutesOA · Seen Nov 2026
  • Repeated Mirror XOROA · Seen Nov 2026
  • Beautiful ArrangementONSITE INTERVIEW · Seen Jul 2026
  • Find Minimum Cost to Remove Array ElementsONSITE INTERVIEW · Seen Jul 2026
  • Group Shifted StringsONSITE INTERVIEW · Seen Jul 2026
  • Longest Valid ParenthesesONSITE INTERVIEW · Seen Jul 2026
  • Balancing TeamsOA · Seen Nov 2025

Similar questions at other companies

  • Maximum Game Score with Fixed Forward JumpsStripe · OAStripe interview questions
  • 0/1 KnapsackConfluent · OAConfluent interview questions
  • Minimum Cost to Tile a Strip with Widths 1, 2, and 3Infosys · OAInfosys interview questions
  • Maximum Escape Game ScoreMicrosoft · OAMicrosoft interview questions
  • Maximum Subarray SumStraive · OA
  • Longest Increasing Price SubsequenceOpenAI · OAOpenAI interview questions
  • Lowest-Cost Shirt Color ScheduleElevenLabs · OAElevenLabs interview questions
  • Maximum Game Board ScoreJP Morgan Chase · OAJP Morgan Chase interview questions
  • API Bandwidth AllocationArista Networks · OAArista Networks interview questions
  • Maximum Points by Deleting ElementsIBM · OAIBM interview questions

MathWorks interview experiences

  • MathWorks SWE Intern Phone Screens: 1 Experience
  • MathWorks Software Engineer in Test OA and HireVue: 1 Experience
All MathWorks interview questionsSee MathWorks hiring insights
Saved
class Solution {
    public int maximumEvenSumSubsequence(int[] arr) {
      // write your code here
    }

}
Checking account…