Available question text
Given a string and integer k, rearrange the characters so that identical characters are at least k positions apart (return an empty string if no valid arrangement exists). The core challenge is a scheduling/frequency problem: you must greedily place the most frequent characters while enforcing a k-length cooldown (often modeled with a max-heap and a waiting queue) to satisfy spacing constraints.
Related questions
Continue with questions that share topics or the same question type.
- Rearrange Characters to Make Target String
Coding
- Rearrange K Substrings to Form Target String
Coding
- Shortest Distance to Target String in a Circular Array
Coding
- Time Needed to Rearrange a Binary String
Coding · Dynamic Programming · Simulation · String
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 358. Rearrange String k Distance Apart
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source