request solutions to 2 questions on leetcode# JobHunting - 待字闺中
e*a
1 楼
1. Set Matrix Zeroes
Given a m x n matrix, if an element is 0, set its entire row and
column to 0. Do it in place.
How to devise a constant space solution?
2. Scramble String
Given a string s1, we may represent it as a binary tree by partitioning
it to two non-empty substrings recursively. To scramble the string,
we may choose any non-leaf node and swap its two children. Given two
strings s1 and s2 of the same length, determine if s2 is a scrambled string
of s1.
Given a m x n matrix, if an element is 0, set its entire row and
column to 0. Do it in place.
How to devise a constant space solution?
2. Scramble String
Given a string s1, we may represent it as a binary tree by partitioning
it to two non-empty substrings recursively. To scramble the string,
we may choose any non-leaf node and swap its two children. Given two
strings s1 and s2 of the same length, determine if s2 is a scrambled string
of s1.