首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
重排字符串和数字
[编程题]重排字符串和数字
热度指数:2925
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 256M,其他语言512M
算法知识视频讲解
对于给定的一个包含连续字母、连续数字及空格的字符串(不会出现字母和数字连在一起出现),实现字母部分按出现顺序排列而数字按照从小到达顺序排在最后一个字母的后面。
数据范围: 字符串长度满足
进阶:空间复杂度
, 时间复杂度
示例1
输入
"xb 1 cc 5 dd 10 ee 2"
输出
"xb cc dd ee 1 2 5 10"
示例2
输入
""
输出
""
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(22)
邀请回答
收藏(114)
分享
纠错
提交结果有问题?
21个回答
1篇题解
开通博客
GreyPigeon
发表于 2022-07-24 22:37:12
//> 字符串拆成两个部分保存,C++贴 class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接
展开全文
问题信息
C++工程师
golang工程师
iOS工程师
安卓工程师
算法工程师
PHP工程师
深圳虾皮信息科技有限公司
游戏研发工程师
大数据开发工程师
Java工程师
上传者:
小小
难度:
21条回答
114收藏
4341浏览
热门推荐
通过挑战的用户
是非凡没有牛
2022-11-14 17:23:10
牛客26080...
2022-11-14 17:23:04
快起一个响亮的名字吧
2022-10-14 15:23:50
时尚手抓饼>
2022-10-07 21:26:22
牛客98866...
2022-09-27 21:41:18
相关试题
建物流中转站
数组
模拟
穷举
Java工程师
C++工程师
iOS工程师
安卓工程师
运维工程师
前端工程师
算法工程师
PHP工程师
测试工程师
深圳虾皮信息科技有限公司
2019
golang工程师
评论
(48)
来自
Shopee 2019校...
Shopee的办公室(二)
动态规划
Java工程师
C++工程师
iOS工程师
安卓工程师
运维工程师
前端工程师
算法工程师
PHP工程师
测试工程师
深圳虾皮信息科技有限公司
数学
2019
golang工程师
评论
(83)
来自
Shopee 2019校...
在类的定义中构造函数的作用是()
哔哩哔哩
游戏研发工程师
2020
评论
(1)
以下Verilog代码描述了两个同...
Verilog
评论
(1)
以下使用生成器的数据管道代码中,若...
Python
评论
(1)
重排字符串和数字
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ public String char_and_num_return (String text_source) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ string char_and_num_return(string text_source) { // write code here } };
#coding:utf-8 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param text_source string字符串 原始输入 # @return string字符串 # class Solution: def char_and_num_return(self , text_source ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ public string char_and_num_return (string text_source) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ function char_and_num_return( text_source ) { // write code here } module.exports = { char_and_num_return : char_and_num_return };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param text_source string字符串 原始输入 # @return string字符串 # class Solution: def char_and_num_return(self , text_source ): # write code here
package main import "fmt" /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ func char_and_num_return( text_source string ) string { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ char* char_and_num_return(char* text_source ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param text_source string字符串 原始输入 # @return string字符串 # class Solution def char_and_num_return(text_source) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ def char_and_num_return(text_source: String): String = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ fun char_and_num_return(text_source: String): String { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ public String char_and_num_return (String text_source) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ export function char_and_num_return(text_source: string): string { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ func char_and_num_return ( _ text_source: String) -> String { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param text_source string字符串 原始输入 * @return string字符串 */ pub fn char_and_num_return(&self, text_source: String) -> String { // write code here } }
"xb 1 cc 5 dd 10 ee 2"
"xb cc dd ee 1 2 5 10"
""
""