Algorithm · ByteDance · Easy
Given an array containing an even number of values, divide its elements into pairs. For each pair, take its smaller value and add these minima together. Arrange the pairings so that this total is as large as possible, then return that maximum sum. Example Input: 2 7 5 9 Output: 9 Pairing 2 with 5 and 7 with 9 produces minima of 2 and 7, so the resulting total is 9.
Checking your access…