当前位置:网站首页>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;
}
};边栏推荐
- OFDM 十六讲 4 -What is a Cyclic Prefix in OFDM
- Matlab学习13-图像处理之可视化GUI程序
- PC client automation testing practice based on Sikuli GUI image recognition framework
- VRRP协议的作用及VRRP+OSPF配置方法
- bash for loop
- c语言进阶篇:内存函数
- How to do App Automation Testing?Practical sharing of the whole process of App automation testing
- opencv学习—VideoCapture 类基础知识「建议收藏」
- 赛灵思MPSOC裸机下的 USB调试实验
- 【MySQL功法】第2话 · 数据库与数据表的基本操作
猜你喜欢
随机推荐
第5章 实现首页Tab数据展示
Matlab学习10-图像处理之傅里叶变换
面试突击71:GET 和 POST 有什么区别?
笔试题:金额拆分
Realize 2d characters move left and right while jumping
优维低代码:Provider 构件
Objective - C code analysis of the deep and shallow copy
fastposter v2.9.0 程序员必备海报生成器
进程内存
LeetCode 899 Ordered queue [lexicographical order] HERODING's LeetCode road
LeetCode刷题笔记:622.设计循环队列
Simple implementation of a high-performance clone of Redis using .NET (1)
【云原生 · Kubernetes】部署Kubernetes集群
Knowledge Graph Question Answering System Based on League of Legends
[论文阅读] (23)恶意代码作者溯源(去匿名化)经典论文阅读:二进制和源代码对比
数据库系统原理与应用教程(076)—— MySQL 练习题:操作题 160-167(二十):综合练习
智能日报脚本
ThreadLocal源码解析及使用场景
劝退背后。
bash for loop









