当前位置:网站首页>761. Special Binary Sequences
761. Special Binary Sequences
2022-08-10 06:35:00 【anieoo】
Original title link: 761. Special Binary Sequence

solution
class Solution {public:static bool cmp(const string &a, const string &b) {return a > b;}string makeLargestSpecial(string s) {if(s.size() <= 2) return s;int cnt = 0, left = 0;vector subs;for (int i = 0; i < s.size(); ++i) {if (s[i] == '1') {++cnt;}else {--cnt;if (cnt == 0) {subs.push_back("1" + makeLargestSpecial(s.substr(left + 1, i - left - 1)) + "0");left = i + 1;}}}sort(subs.begin(), subs.end(), cmp);string ans;for(auto &c : subs) ans += c;return ans;}}; 边栏推荐
- 数据库学习之表的约束
- Tencent Cloud Song Xiang: Kubernetes cluster utilization improvement practice
- 【愚公系列】2022年08月 Go教学课程 034-接口和多态
- ES13 - ES2022 - The 123rd ECMA Congress approves the ECMAScript 2022 language specification
- XV6系统调用实现
- BUUCTF笔记(web)
- 关于MongoDb查询Decimal128转BigDecimal问题
- 驱动的参数传入:module_param,module_param_array,module_param_cb
- 个人实现的可任意折叠QToolBox——AdvancedToolBox
- 强化学习_07_DataWhale深度Q网络进阶技巧
猜你喜欢
随机推荐
MySQL事务隔离级别
Why do games need hot updates
Qt中输入框在Win10上“Win+/“快捷键的一个Bug
动态代理-cglib
进制的前缀表示和后缀表示
ebp/栈帧/call stack
UnityShader入门精要-透明效果
UnityShader入门精要-立方体纹理、反射、折射、菲涅尔反射
请问为什么sqlserver cdc,任务启动过了一天,会报这个错误,明明已经开启cdc了。
什么是代理ip?市面上好用的代理软件有哪些
第11章 数据库的设计规范【2.索引及调优篇】【MySQL高级】
请问一下。Oracle CDC 连接器支持 LogMiner 和 XStream API 两种方式捕
OpenGL学习笔记(LearnOpenGL)第一部分-环境配置与基础知识
Introduction to KDE Framework
elf文件与链接脚本
Unity3d famous project-Dark Tree translation
语法基础(判断语句)
全网可达,交换机和路由器的配置,vlan
qemu and host share disk
Kernel Image File Format



![[网络安全]实操AWVS靶场复现CSRF漏洞](/img/7f/f08e429e3d8ede03a1c1754e256f99.png)





