Tap here to switch tabs
Problem
Submissions

Problem: Lexicographically Smallest Permutation Above Target

Lexicographically Smallest Permutation Above Target gives two equal-length strings and asks for the smallest permutation of one that exceeds the other, or an empty string if none exists.

Statement

You are given two strings s and target of equal length.

Return the lexicographically smallest permutation of s that is strictly greater than target. If no such permutation exists, return an empty string "".

Constraints:

  • 1≤1 \leq s.length == target.length ≤300\leq 300

  • s and target consist only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Lexicographically Smallest Permutation Above Target

Lexicographically Smallest Permutation Above Target gives two equal-length strings and asks for the smallest permutation of one that exceeds the other, or an empty string if none exists.

Statement

You are given two strings s and target of equal length.

Return the lexicographically smallest permutation of s that is strictly greater than target. If no such permutation exists, return an empty string "".

Constraints:

  • 1≤1 \leq s.length == target.length ≤300\leq 300

  • s and target consist only of lowercase English letters.