Search
⌘K
Get Premium
Leetcode 1262. Greatest Sum Divisible by Three
Choose a subset of array elements whose sum is maximized subject to being divisible by 3. Solve by tracking best achievable sums for each remainder class modulo 3 (dynamic programming/greedy on residues) to update and return the maximum sum with remainder 0.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.