#3627
Maximum Median Sum of Subsequences of Size 3
specialist · 645 · lc medium +30 · 65.1% accepted · 79 likes · top 69%
Description
Integer array nums has a length divisible by 3. In each step, pick any three elements, record their median, then remove all three from the array.
The median of three sorted elements is the middle one.
Return the maximum achievable sum of all recorded medians.
Code
1
2
3