Tap here to switch tabs
Problem
Submissions

Problem: Check If String Is Transformable With Substring Sorts

Check If String Is Transformable With Substring Sorts asks whether one digit string can become another by repeatedly sorting any contiguous substring in ascending order, returning true or false.

Statement

Given two strings s and t, determine whether it is possible to transform s into t by applying the following operation any number of times:

  • Choose any contiguous substring of s and sort its characters in ascending order.

Return true if s can be transformed into t, or false otherwise.

Constraints:

  • s.length ==== t.length

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s and t consist of only digits.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check If String Is Transformable With Substring Sorts

Check If String Is Transformable With Substring Sorts asks whether one digit string can become another by repeatedly sorting any contiguous substring in ascending order, returning true or false.

Statement

Given two strings s and t, determine whether it is possible to transform s into t by applying the following operation any number of times:

  • Choose any contiguous substring of s and sort its characters in ascending order.

Return true if s can be transformed into t, or false otherwise.

Constraints:

  • s.length ==== t.length

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s and t consist of only digits.