题解 | Crazy Binary String-2019牛客暑期多校训练营第三场B题

题目来源于牛客竞赛:https://ac.nowcoder.com/acm/contest/discuss
题目描述:
ZYB loves binary strings (strings that only contains ‘0’ ‘1’ ). And he loves equal binary strings more, where the number of ‘0’ and the number `1’ in the string are equal.

ZYB wants to choose a substring from an original string T so that it is an equal binary string with the longest length possible. He also wants to choose a subsequence of T which meets the same requirements.

A string v is a substring of a string w if v is empty, or there are two integers l and r(1≤l≤r≤|w|) such that v=w1wl+1…wr.A string v is a subsequence of a string \ w w if it can be derived from w by deleting any number (including zero) of characters without changing the order of the remaining characters.

For simplicity, you only need to output the maximum possible length. Note that the empty string is both a substring and a subsequence of any string.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值