less than 1 minute read

You are given a list of non-negative integers nums. Return the maximum sum of a sublist in nums containing only unique values.

Constraints

  • 1 ≤ n ≤ 100,000 where n is the length of nums

https://binarysearch.com/problems/Maximum-Unique-Sublist-Sum

Examples

Example 1

Input

  • nums = [1, 2, 2, 3, 4, 4]

Output

  • answer = 9

Explanation

We can take the sublist [2, 3, 4] which has unique numbers.

Solution

Leave a comment