cp-wiki icon indicating copy to clipboard operation
cp-wiki copied to clipboard

Leetcode 第39场双周赛题解

Open utterances-bot opened this issue 4 years ago • 2 comments

Leetcode 第39场双周赛题解 | CP Wiki

数据范围有限,可以直接暴力模拟。如果数据范围扩大,可以预先计算前缀和。

https://cp-wiki.vercel.app/tutorial/leetcode/BC39/

utterances-bot avatar Nov 17 '20 14:11 utterances-bot

题主能讲下 Problem B的详细解法吗

TheBestCVMan avatar Nov 17 '20 14:11 TheBestCVMan

@TheBestCVMan 最终形成的字符串一定是前半段为a,后半段为b,所以我们就枚举它是从哪一位开始变成b的。需要的修改次数等于前半段的b的个数加上后半段的a的个数。

lucifer1004 avatar Nov 17 '20 14:11 lucifer1004