Deduplicate the Activity Feed

Intermediate

An activity feed sometimes logs the same action twice in a row, but the display should show each action once, in the order it first occurred.

Implement `solve(List<String> input)` to return each value once in first-seen order.

Examples

Input["b", "a", "b", "c", "a", "d"]
Output["b", "a", "c", "d"]
Input["x", "x"]
Output["x"]
Hints
  • Track seen values in a Set; only add to the result list when first seen.
Anonymous Apex

Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically.