HBC52897FarmingMarsString Transformation题解

一沫阳光 算法基础篇 60 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
sn consists of letter `a`, `b` and `c`. He can transform the string by inserting or deleting substrings `aa`, `bb` and `abab`. Formally, A=uwvA = u circ w circ vA=uwv can be transformed into A′=uvA' = u circ vA′=uv and vice versa where u, v are strings and w∈{aa,bb,abab}w in {mathrm{aa}, mathrm{bb}, mathrm{abab}}w∈{aa,bb,abab}. Given the target string T=t1t2…tm, determine if Bobo can transform the string S into T.

Bobo has a string S=s1s2…snS = s_1s_2dots s_nS=s1​s2​…sn​ consists of letter `a`, `b` and `c`. He can transform the string by inserting or deleting substrings `aa`, `bb` and `abab`. Formally, A=u∘w∘vA = u circ w circ vA=u∘w∘v (``∘circ∘'' denotes string concatenation) can be transformed into A′=u∘vA' = u circ vA′=u∘v and vice versa where u, v are (possibly empty) strings and w∈{aa,bb,abab}w in {mathrm{aa}, mathrm{bb}, mathrm{abab}}w∈{aa,bb,abab}. Given the target string T=t1t2…tmT = t_1t_2dots t_mT=t1​t2​…tm​, determine if Bobo can transform the string S into T.

HBC52897FarmingMarsString Transformation题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
想要在职场中立于不败之地?那就来试试全网最全C++题库,让您在练习中快速提升技能。

标签: HBC52897FarmingMarsString Transformation题解