Search
⌘K

Leetcode 767. Reorganize String

Rearrange the characters of a string so that no two adjacent characters are the same, returning any valid permutation or "" if none exists. Key insight: feasibility depends on character frequencies (no letter can occur more than (n+1)/2 times), and it's typically solved with a greedy/priority-queue strategy to place the most frequent remaining letters.

Asked at:

Amazon

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid January, 2025

Amazon

Amazon

Mid-level

Late August, 2024

Amazon

Amazon

Intern

Reorganize String (LeetCode 767)

Comments

Your account is free and you can post anonymously if you choose.