Add an element
Input
([1, 2], [3], [])
Output
[1, 2, 3]
Start with {1,2}, add 3 => {1,2,3}, nothing removed; return sorted list.
Full lesson preview
Practice adding and removing elements from a set and returning the final contents.
Problem statement
Task
Examples
Input
([1, 2], [3], [])
Output
[1, 2, 3]
Start with {1,2}, add 3 => {1,2,3}, nothing removed; return sorted list.
Input format
Output format
Constraints
Samples
Input
([1, 2], [3], [])
Output
[1, 2, 3]
3 is added to the set.