problem
solution
option 1 - heap
1 | class Solution { |
option 2 - counting sort
1 |
analysis
- option 1 - heap
- time complexity
O(nlogn)
- space complexity
O(n)
- time complexity
- option 2 - sort
- time complexity
O(n)
- space complexity
O(1)
- time complexity
1 | class Solution { |
1 |
O(nlogn)
O(n)
O(n)
O(1)