Tap here to switch tabs
Problem
Submissions

Problem: Rearrange String to Avoid Character Pair

Rearrange String to Avoid Character Pair gives you a string and two distinct letters. Return a rearrangement that keeps every occurrence of y before every occurrence of x.

Statement

You are given a string s and two distinct lowercase English letters x and y.

Rearrange the characters of s such that every occurrence of y appears before every occurrence of x.

Return any such rearranged string.

Constraints:

  • 1≤1 \leq s.length ≤100\leq 100

  • s consists of lowercase English letters.

  • x and y are lowercase English letters.

  • x ≠\neq y

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Rearrange String to Avoid Character Pair

Rearrange String to Avoid Character Pair gives you a string and two distinct letters. Return a rearrangement that keeps every occurrence of y before every occurrence of x.

Statement

You are given a string s and two distinct lowercase English letters x and y.

Rearrange the characters of s such that every occurrence of y appears before every occurrence of x.

Return any such rearranged string.

Constraints:

  • 1≤1 \leq s.length ≤100\leq 100

  • s consists of lowercase English letters.

  • x and y are lowercase English letters.

  • x ≠\neq y