Programmers / Pick Two and Add
Problem
- Link
- Description
- Pick two numbers from different indices in a number array and return all possible sums sorted in ascending order
- Type
- Brute Force
Solution 1
| |
- Description
- Uses TreeSet for deduplication and sorting functionality
- Time Complexity
- O(len(numbers)^2)
- Two nested for loops of size len(numbers)
- Space Complexity
- O(len(numbers))
- Memory usage proportional to len(numbers) for function input