#3780

Maximum Sum of Three Numbers Divisible by Three

specialist · 915 · lc medium +31 · 47.7% accepted · 60 likes · top 33%

Description

Given an integer array nums, select exactly three elements whose sum is divisible by 3 and return the largest such sum achievable; if no valid triplet exists, return 0.

Code

1
2
3