NeetCode #530LC-358HardHeap / Priority QueueNC Algo100
← Back to All Problems#530 · #358 · Rearrange String k Distance Apart(K 距离间隔重排字符串)
📌 Problem Statement & Constraints
Given a string
s and an integer k, rearrange it so that the same characters are at least k positions apart. Return any valid arrangement, or the empty string if impossible. Constraints: 1 <= s.length <= 3 * 10^4, 0 <= k <= s.length, lowercase letters.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!