451. Sort Characters By Frequency

1. use maxHeap,

O(nlogm), m is the 26 char, so it's O(n), O(n)

2. use bucket sort

O(n), O(n)

Last updated

Was this helpful?