Apply Operations to Make String Empty⚓︎
Solution⚓︎
Way 1⚓︎
See reference (Chinese).
- Time complexity: \(O\left( n+\left| \Sigma \right|\log \left| \Sigma \right| \right)\), where \(\left| \Sigma \right| = 26\);
- Space complexity: \(O\left( \left| \Sigma \right| \right)\).