87.Scramble-String

87. Scramble String

题目地址

https://www.lintcode.com/problem/scramble-string/description

https://leetcode.com/problems/scramble-string/

题目描述

Given a string s1, we may represent it as binary tree by partitioning it to two non-empty substrings recursively.

Below is one possible representation of s1 = "great":
        great
       /     \
    gr        eat
  /    \      / \
g       r    e   at
                 / \
                a   t

Approach #1

exponential complexity O(2^n)

Last updated

Was this helpful?