problem:Given A string S1, we may represent it as a binary tree by partitioning it to the Non-empty substrings Recursivel Y.Below is one possible representation of S1 = "great" : Great / gr eat/\ / g r E at /
Topic linksTitle Requirements:Given A string S1, we may represent it as a binary tree by partitioning it to the Non-empty substrings Recursivel Y.Below is one possible representation of S1 = "great" : Great / gr eat/\ / g r E
One Day together Leetcode
This series of articles has all been uploaded to my github address: Zeecoder ' s GitHubYou are welcome to follow my Sina Weibo, my Sina Weibo blogWelcome reprint, Reprint please indicate the source
(i)
The original title link is here: https://leetcode.com/problems/scramble-string/This question refers to this post: http://blog.csdn.net/linhuanmars/article/details/24506703This is actually a three-dimensional dynamic programming topic, we propose
Ideas:
1 recursion:
Simply put, if s1 and s2 are scramble, there must be a l1 length on s1, and s1 is divided into s11 and s12 segments, which also have s21 and s22.Then s11 and s21 are scramble and s12 and s22 are scramble;Either s11 and s22 are
Scramble string
Given a string S1, we may represent it as a 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 /
Topic:Given A string S1, we may represent it as a binary tree by partitioning it to the Non-empty substrings Recursivel Y.Below is one possible representation of S1 = "great" : Great / gr eat/\ / g r E at /
Scramble StringGiven A string S1, we may represent it as a binary tree by partitioning it to the Non-empty substrings Recursivel Y.Below is one possible representation of S1 = "great" : Great / gr eat/\ / g r E at /
Given a stringS1, We may represent it as a binary tree by partitioning it to two non-empty substrings recursively.
Below is one possible representationS1="great":
great / gr eat / \ / g r e at / a t
To
Original title AddressTwo strings what are the criteria to be scramble?If the length of S1 and S2 is equal to 1, it is clear that only s1=s2 is the scramble relationship.If the length of the S1 and S2 is greater than 1, then the S1 and S2 are
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.