Reorganize String
Medium
Heap / Priority Queue
Rearrange the characters of a string so that no two adjacent characters are the same. Print the lexicographically smallest valid rearrangement, or an empty line if impossible.
Constraints
1 <= len(s) <= 500 Lowercase letters
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.