当前位置:网站首页>2022.8.3-----leetcode.899
2022.8.3-----leetcode.899
2022-08-04 02:10:00 【Lk Lu727】
public String orderlyQueue(String s, int k) {//k is 1, only one beginning can be selected in the character ring of s to make it the smallestif (k == 1) {String smallest = s;String ss =s+s;int n = s.length();for (int i = 1; i < n; i++) {if(ss.substring(i,i+n).compareTo(smallest)<0)smallest=ss.substring(i,i+n);}return smallest;} else {//k>1, the order of any two adjacent characters can be exchanged, and finally all characters can be sortedchar[] arr = s.toCharArray();Arrays.sort(arr);return new String(arr);}}边栏推荐
- QNX Hypervisor 2.2用户手册]10.1 通用vdev选项
- Simple sorting (summer vacation daily question 14)
- Presto中broadcast join和partition join执行计划的处理过程
- Intranet penetration - application
- 多线程 之 JUC 学习篇章一 创建多线程的步骤
- Flask框架初学-05-命令管理Manager及数据库的使用
- 瑞能微计量芯片RN2026的实用程序
- 实例035:设置输出颜色
- Download install and create/run project for HBuilderX
- 计算首屏时间
猜你喜欢

一个注解替换synchronized关键字:分布式场景下实现方法加锁

Dong mingzhu live cold face away, when employees frequency low-level mistakes, no one can understand their products

SAP SD module foreground operation

2022年茶艺师(中级)考试试题模拟考试平台操作

云开发校园微社区微信小程序源码/二手交易/兼职交友微信小程序开源源码

Example 039: Inserting elements into an ordered list

MySQL高级-读写分离-分库分表

ant-design的Select组件采用自定义后缀图标(suffixIcon属性)时,点击该自定义图标没有反应,不会展示下拉菜单的问题

IDEA02:配置SQL Server2019数据库

TensoFlow学习记录(二):基础操作
随机推荐
nodejs installation and environment configuration
Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
简单的线性表的顺序表示实现,以及线性表的链式表示和实现、带头节点的单向链表,C语言简单实现一些基本功能
HBuilderX的下载安装和创建/运行项目
工程制图名词解释-重点知识
Sticker Spelling - Memory Search / Shape Pressure DP
Web APIs BOM - operating browser: swiper plug-in
计算首屏时间
initramfs详解----添加硬盘驱动并访问磁盘
云开发校园微社区微信小程序源码/二手交易/兼职交友微信小程序开源源码
5. Scrapy middleware & distributed crawler
持续投入商品研发,叮咚买菜赢在了供应链投入上
halcon自定义函数基本操作
FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
Flink jdbc connector 源码改造sink之 clickhouse多节点轮询写与性能分析
Multithreading JUC Learning Chapter 1 Steps to Create Multithreading
Kubernetes:(十一)KubeSphere的介绍和安装(华丽的篇章)
2022年T电梯修理考题及答案
什么是SVN(Subversion)?
出海季,互联网出海锦囊之本地化