Tap here to switch tabs
Problem
Submissions

Problem: Scramble String

med
30 min
Try to solve the Scramble String problem.

Statement

Given two strings s1 and s2 of equal length, determine whether s2 is a scrambled version of s1.

A string is considered a scramble of another if it can be produced by repeatedly applying the following process to any substring:
Choose an index to split the substring into two non empty parts, then either keep the two parts in the same order or swap them, and continue recursively on each part.

Return true if s2 can be obtained from s1 using this process, otherwise return false.

Constraints:

  • s1.length == s2.length

  • 1≤1 \leq s1.length ≤30\leq 30

  • s1 and s2 consist of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Scramble String

med
30 min
Try to solve the Scramble String problem.

Statement

Given two strings s1 and s2 of equal length, determine whether s2 is a scrambled version of s1.

A string is considered a scramble of another if it can be produced by repeatedly applying the following process to any substring:
Choose an index to split the substring into two non empty parts, then either keep the two parts in the same order or swap them, and continue recursively on each part.

Return true if s2 can be obtained from s1 using this process, otherwise return false.

Constraints:

  • s1.length == s2.length

  • 1≤1 \leq s1.length ≤30\leq 30

  • s1 and s2 consist of lowercase English letters.