Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Lintcode29 Interleaving String solution problem solution

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

[topic description]

Given three strings: s1, s2, s3, determine whether s3 is formed by the interleaving of s1 and s2.

Three strings: S1, S2, S3 are given to determine whether S3 is composed of S1 and S2.

[topic link]

Http://www.lintcode.com/en/problem/interleaving-string/

[topic Analysis]

Dp [I] [j] denotes whether the first I of S1 and the first j of S2 are interleaving string or not.

Initialize first. Traverse S1, initializing all dp [I] [0]

Then iterate through S2 and initialize all dp [0] [j]

If the I + Jmur1 bit of S3 is equal to the I bit of S1, let's see if dp [I-1] [j] is true; isomorphic, and if the i+j-1 bit of S3 is equal to the j bit of S2, then let's see whether dp [I] [Jmur1] is true. As long as either of the two cases is true, dp [I] [j] is true.

[reference answer]

Http://www.jiuzhang.com/solutions/interleaving-string/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report