Remove Last Duplicate Entries
Given a list of integers nums
, find all duplicate numbers and delete their last occurrences.
Constraints
0 ≤ n ≤ 100,000
wheren
is the length ofnums
https://binarysearch.com/problems/Remove-Last-Duplicate-Entries
Examples
Example 1
Input
- nums =
[1, 1, 1, 2, 2, 2, 3, 3, 3]
Output
- answer =
[1, 1, 2, 2, 3, 3]
Example 2
Input
- nums =
[1, 3, 4, 1, 3, 5]
Output
- answer =
[1, 3, 4, 5]
Leave a comment