For example, given:
S:
"barfoothefoobarman"L:
["foo", "bar"]
You should return the indices:
[0,9].(order does not matter).
"barfoothefoobarman"["foo", "bar"]
[0,9]."great":
great
/ \
gr eat
/ \ / \
g r e at
/ \
a t
To scramble the string, we may choose any non-leaf node and swap its two children.
"gr" and swap its two children, it produces a scrambled string "rgeat".
rgeat
/ \
rg eat
/ \ / \
r g e at
/ \
a t
We say that "rgeat" is a scrambled string of "great".
"eat" and "at", it produces a scrambled string "rgtae".
rgtae
/ \
rg tae
/ \ / \
r g ta e
/ \
t a
We say that "rgtae" is a scrambled string of "great".
"aabcc","dbbca",
"aadbbcbcac", return true."aadbbbaccc", return false.1 and 0 respectively in the grid.[ [0,0,0], [0,1,0], [0,0,0] ]The total number of unique paths is
2.