当前位置:网站首页>899. 有序队列
899. 有序队列
2022-08-03 11:59:00 【anieoo】
原题链接:899. 有序队列
solution:
class Solution {
public:
string orderlyQueue(string s, int k) {
string res = s;
if(k != 1) { //k != 1可以组合成任意最小的字典序字符串
sort(s.begin(), s.end());
return s;
} else {
int n = s.size();
for(int i = 0;i < n;i++) {
s.push_back(s[0]);
s.erase(s.begin());
res = min(res, s);
}
}
return res;
}
};
边栏推荐
- LeetCode-142. 环形链表 II
- 优维低代码:Provider 构件
- 4500 words sum up, a software test engineer need to master the skill books
- 小身材有大作用——光模块寿命分析(二)
- How to do App Automation Testing?Practical sharing of the whole process of App automation testing
- 详解虚拟机!京东大佬出品HotSpot VM源码剖析笔记(附完整源码)
- 项目概述、推送和存储平台准备
- What knowledge points do you need to master to learn software testing?
- Go 语言快速入门指南: 介绍及安装
- 【云原生 · Kubernetes】部署Kubernetes集群
猜你喜欢
net start mysql 启动报错:发生系统错误5。拒绝访问。
mysql进阶(二十四)防御SQL注入的方法总结
零拷贝、MMAP、堆外内存,傻傻搞不明白...
通过组策略安装软件和删除用户配置文件
After completing the interview and clearance collection of Alibaba, I successfully won the 15th Offer this year
C language advanced article: memory function
QGIS绘制演习区域示意图
一个扛住 100 亿次请求的红包系统,写得太好了!!
asdn涨薪技术之apifox+Jenkins如何玩转接口自动化测试
笔试题:金额拆分
随机推荐
国内数字藏品与国外NFT主要有以下六大方面的区别
c语言进阶篇:内存函数
Matlab学习12-图像处理之图像增强
[论文阅读] (23)恶意代码作者溯源(去匿名化)经典论文阅读:二进制和源代码对比
距LiveVideoStackCon 2022 上海站开幕还有3天!
Vs Shortcut Keys---Explore Different Programming
本周四晚19:00知识赋能第4期直播丨OpenHarmony智能家居项目之设备控制实现
QGIS绘制演习区域示意图
html+css+php+mysql实现注册+登录+修改密码(附完整代码)
基于PHP7.2+MySQL5.7的回收租凭系统
LeetCode——1161. 最大层内元素和
Blazor Server(6) from scratch--policy-based permission verification
第四课 标识符、关键字、变量、变量的分类和作用域、常量
字符串本地化和消息字典(二)
学习软件测试需要掌握哪些知识点呢?
一个扛住 100 亿次请求的红包系统,写得太好了!!
实现2d人物在跳跃的同时左右移动
基于英雄联盟的知识图谱问答系统
面试官:SOA 和微服务的区别?这回终于搞清楚了!
Objective - C code analysis of the deep and shallow copy