剑指Offer(55)-[Array&String]左旋转字符串

印尼稻米收成与粮食安全数据集2026年 本数据集收录印度尼西亚2026年水稻收成与粮食安全遥测数据,包含10000条稻米农业收成产量与粮食安全监测记录,围绕印尼国家粮食安全体系中的核心作物水稻展开。稻米是印尼逾两亿人口的主粮,其收成波动直接影响国家粮食安全与进口政策,本数据集将种植区域、收成产量、气候与土壤相关遥测指标整合为结构化表格,可支撑粮食产量预测、收成影响因素分析、区域粮食安全评估与农业政策模拟等研究任务。典型应用场景包括:农业时间序列产量预测模型构建、气候因子与水稻收成的关联分析、省份与地区层面的粮食自给率测算、粮食安全风险预警指标设计,也可作为农业经济、粮食政策与数据科学交叉课程的教学素材。数据为2026年最新版,规模约1.2MB、单CSV结构规整,字段命名清晰,适合Python、Pandas、Scikit-learn等主流工具链直接使用,便于开展探索性分析、可视化与机器学习全流程练习。重要说明:本数据为遥测整理数据,分析结论以数据集文档口径为准,农业决策请结合官方统计综合研判。许可:CC0公有领域,可自由使用与二次分发。 立即下载

点击查看剑指Offer全解【Java & Golang】实现

题目描述

汇编语言中有一种移位指令叫做循环左移(ROL),现在有个简单的任务,就是用字符串模拟这个指令的运算结果。对于一个给定的字符序列S,请你把其循环左移K位后的序列输出。例如,字符序列S=”abcXYZdef”,要求输出循环左移3位后的结果,即“XYZdefabc”。是不是很简单?OK,搞定它!


思路

第一种思路是使用一个辅助数组去存储旋转过后的字符。时间复杂度O(n),空间复杂度O(n)。

第二种思路是进行三次翻转,第一次翻转0~k - 1的字符串,第二次反转k~len - 1的字符串,第三次反转0~len-1的字符串即可完成循环左移动k的结果了。

第二种思路是双指针法,通过两个指针去夹逼,获取到和为sum的元素。

Java第一种思路实现

public class Solution {
    public String LeftRotateString(String str,int n) {
        if (str.length() == 0) {
            return "";
        }
        n = n % str.length();
        char[] res = new char[str.length()];
        for (int i = 0; i < res.length; i++) {
            if (i >= n) {
                res[i - n] = str.charAt(i);
            } else {
                res[res.length - n + i] = str.charAt(i);
            }
        }
        return new String(res);
    }
}

Java第二种思路实现

public class Solution {
    public String LeftRotateString(String str,int n) {
        if (str.length() == 0) {
            return "";
        }
        n = n % str.length();
        char[] chars = str.toCharArray();
        reverse(chars, 0, n - 1);
        reverse(chars, n, str.length() - 1);
        reverse(chars, 0, str.length() - 1);
        StringBuilder builder = new StringBuilder();
        for (char c:chars) {
            builder.append(c);
        }
        return builder.toString();
    }
    private void reverse(char[] chars, int left, int right) {
        while (left < right) {
            char temp = chars[left];
            chars[left] = chars[right];
            chars[right] = temp;
            left++;
            right--;
        }
    }
}
企业数字化转型AI大模型赋能智能体平台及AI场景应用规划方案(生态合作版).pptx 立即下载

相关推荐

智慧环保生态保护行业可信数据空间应用规划方案(技术方案版).pptx

智慧环保生态保护行业可信数据空间应用规划方案(技术方案版).pptx

剑指Offer(48)-[Array&String]替换空格

点击查看剑指Offer全解【Java & Golang】实现 题目描述 请实现一个函数,将一个字符串中的每个空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。 思路 第一种思路是直接使用系统的内置字符串处理库去替换掉所有的空格,但是这种方法一般是取巧方法,所以除非真的做不出来,否则不能使用。 第二种思路是先统计空格的...

BoringError的博客 9562

气象服务行业可信数据空间应用规划方案(技术方案版).pptx

气象服务行业可信数据空间应用规划方案(技术方案版).pptx

【吐血整理】LeetCode与剑指Offer百道经典题解总结

本文整理了LeetCode与剑指Offer中百余道经典的题目,整理出了数组、字符串、链表、二叉树、栈、回溯、动态规划、位运算中的经典问题以及问题对应的链接地址和个人提供的题解,方便查阅以及练习。以下是百题的索引,点击即可找到题目的出处并练习,也可直接查阅答案。 建议刚开始刷题的朋友直接按一下的Tag分类一个专题一个专题地进行学习与作答,完全理解这一百题,一线大厂非你莫属。

BoringError的博客 3900

MCGS的Http协议驱动,支持http协议

硬件配置 参数设置 设备属性 设备命令 通讯状态 附录 #HTTP 1、 设备简介 驱动类型 该驱动为独立设备,直接添加构件即可,不需要挂载到父设备下 通讯协议 采用标准HTTP1.1协议 通讯方式 驱动构件为客户端。 2、 硬件连接 本软件在通讯之前,请保证通讯连接正确。通讯连接方式:采用标准的RJ45接口的以太网接线(对调网线或使用HUB交换)。 3、 设备通讯参数 本设备为独立设备,无父设备参数 4、 设备构件参数设置 “HTTP设备”参数设置如下: <1> 内部属性: 构建url信息。 <2> 最小采集周期:本软件对设备进行操作的时间周期,单位为ms,默认为100ms。 <3> 通讯等待时间:通讯数据接收等待时间,默认设置为200ms,当采集速度要求较高或数据量较大时,设置值可适当减小或增大。 <4> HttpHead:http head添加需要的字段,不需要添加http head时值为空,默认不添加。 5、 设备命令 本设备构件提供设备命令,用于进行相应的操作,设备命令的格式如下: 设备命令 命令介绍 GetHttpHead 格式1 GetHttpHead(headStr) 用途 获取http head参数 参数 headStr 参数可以为字符型变量、字符串常量 例1 !SetDevice(设备0,6,"GetHttpHead(headStr)") 获取http head数据保存到headStr中 SetHttpHead 格式1 SetHttpHead(headStr) 用途 设置http head参数 参数 headStr 参数可以为字符型变量、字符串常量

【AMD显卡在WIndow10/11部署带GPU支持的深度学习环境(Pytorch-DirectML篇)】

这篇是之前Tensorflow-DirectML的姊妹篇,如果对TF感兴趣的可以搜索我的博文。 首先我们丢一个官网地址,但是官网那个会误导新人如果你按那个操作的话。 https://docs.microsoft.com/en-us/windows/ai/directml/gpu-pytorch-windows 这里用我的方法操作: 首先声明一下,因为我的显卡是AMD RX6600,不带XT(性能和RTX3060 12G版本半斤八两),所以目前没有最新的WSL2驱动,如果有了的话欢迎告知我,所以我这里就.

weixin_44029053的博客 2万+

LeetCode(5)-链表:其他问题

LeetCode 148.排序链表 在O(nlogn) 时间复杂度和常数级空间复杂度下,对链表进行排序。 示例 1: 输入: 4->2->1->3 输出: 1->2->3->4 示例 2: 输入: -1->5->3->4->0 输出: -1->0->3->4->5 来源:力扣(LeetCode) ...

BoringError的博客 1128

C语言实现AES加解密

C语言实现AES加解密 #include<stdio.h> #include<string.h> #include<time.h> #include<windows.h> #define Nb 4 //数据块行数 #define Nk 4 //密码块行数 #define Nr 10 //轮加密次数 unsigned char RoundKey[4*Nb*(Nr+1)]; //轮密钥 unsigned char Key[17];

qq_44310495的博客 8891

LeetCode(2)-栈:单调栈结构

文章目录 一、LeetCode 739. 每日温度 二、LeetCode 496. 下一个更大元素 I 三、LeetCode 503. 下一个更大元素 II 本文是LeetCode刷题总结第二篇,主要总结关于单调栈的题型。单调栈是一种基于栈的数据结构,它是一种有序的栈;它一般用来解决譬如“下一个更大/更小元素”,“当前元素和下一个更大/更小元素间隔多少”,且题目一般会要求...

BoringError的博客 1101

别再为CAD和GIS数据对不上而头疼了!一份完整的ArcGIS for AutoCAD坐标系定义与数据套合指南

本文详细介绍了如何通过ArcGIS for AutoCAD插件解决CAD与GIS数据坐标系不匹配的问题,实现数据的精准套合。文章从坐标系冲突分析、插件核心功能解析到五步标准化工作流,提供了完整的解决方案,帮助工程师和设计师提升跨平台协作效率。

weixin_42531886的博客 218

AI与Agent赋能下的软件测试变革:面向未来测试工程师的工作方法论

AI Agent 软件测试 测试 software testing test

测试技师的自我修养 1241

LeetCode(4)-链表:快慢指针

文章目录 LeetCode 876.链表的中间节点 LeetCode 19. 删除链表的倒数第N个节点 LeetCode 141. 环形链表 链表中有一个很常用的技巧被称为快慢指针技巧,通常用于找到中间节点和用于解决一些具有环状链表性质的问题 LeetCode 876.链表的中间节点 给定一个带有头结点 head 的非空单链表,返回链表的中间结点。...

BoringError的博客 893

【Attention Is All You Need】Transformer模型精读

Attention Is All You Need》这篇论文奠定了Transformer模型的基础,为深度学习的发展提供了新的方向。Transformer通过自注意力机制和并行化处理显著提升了计算效率和模型性能。然而,Transformer的广泛应用也带来了新的挑战,如计算资源的消耗和对长序列的处理能力等。随着技术的不断发展,研究人员已经提出了诸如Efficient Transformer、Reformer等变种,旨在提升Transformer的效率和适应性。

Lewiz_124的博客 1501

LeetCode(1)-栈:符号匹配类问题

文章目录 一、LeetCode 20.有效的括号 二、LeetCode 844. 比较含退格的字符串 三、LeetCode 682. 棒球比赛 四、LeetCode 921. 使括号有效的最少添加 五、LeetCode 1021. 删除最外层的括号 六、LeetCode 1047. 删除字符串中的所有相邻重复项 本文是LeetCode刷题总结第一篇之栈的...

BoringError的博客 883

【RT-DETR涨点改进】独家创新改进篇 | AAAI2024 | RT-DETR引入CFBlock增强对长程依赖和全局语义信息的建模能力,有助于提升复杂场景下小目标、遮挡目标的检测精度

本文给大家介绍在RT-DETR中引入CFBlock模块,能够有效提升模型对长程依赖和全局语义信息的建模能力,在保持轻量化和高效推理的基础上增强特征表达力,特别有助于提升复杂场景下小目标、遮挡目标的检测精度,从而实现更优的精度与速度平衡。

Ai缝合怪、助力小伙伴高效发论文 262

YOLOv8【第一章:基础入门篇·第1节】一文搞定,核心架构深度解析与环境配置!

🏆 本文收录于 《YOLOv8实战:从入门到深度优化》 专栏,该专栏专注于分享我在YOLOv8目标检测模型中的实战经验,涵盖从入门基础到深度优化的全方位解决方案。无论你是计算机视觉的新手,还是具有多年深度学习经验的专家,本专栏都将为你提供高效、可复现的技术方案,助你掌握YOLOv8的核心技术,提升目标检测性能,突破瓶颈,优化模型,并加速项目开发🚀!

**My Coding Family** 2106

LeetCode(6)-树:递归问题

一、递归 二、LeetCode相关题目 2.1、LeetCode 226. 翻转二叉树 2.2、LeetCode 104. 二叉树的最大深度 2.3、LeetCode 112. 路径总和 2.4、LeetCode 111. 二叉树的最小深度 二叉树和多叉树是一种天然的递归结构,每一个节点下的左子树或右子树(针对二叉...

BoringError的博客 839

【AI编程】Qoder AI 编程工具从部署到深度使用实战详解

Qoder AI 编程工具从部署到深度使用实战详解

congge 8348

LeetCode(7)-树:DFS/BFS类问题

文章目录1. LeetCode 144. 二叉树的前序遍历2. LeetCode 589. N叉树的前序遍历3. LeetCode 94. 二叉树的中序遍历4. LeetCode 145.二叉树的后序遍历5. LeetCode 590. N叉树的后序遍历6. LeetCode 102. 二叉树的层次遍历7. LeetCode 102. N叉树的层序遍历8. LeetCode 102. N叉树的层序...

BoringError的博客 763

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

剑指Offer(19)-[LinkedList] 合并两个排序的链表

点击查看剑指Offer全解【Java & Golang】实现 题目描述 输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。 思路 其实这就是链表的归并排序中的“合并”部分: [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-wLB6HLu9-1573886800546)(http://note.youdao.com/y...

BoringError的博客 757

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

剑指Offer(52)-[Array&String]丑数

点击查看剑指Offer全解【Java & Golang】实现 题目描述 把只包含质因子2、3和5的数称作丑数(Ugly Number)。例如6、8都是丑数,但14不是,因为它包含质因子7。 习惯上我们把1当做是第一个丑数。求按从小到大的顺序的第N个丑数。 思路 转载自牛客网评论区大佬的思路: 链接:https://www.nowcoder.com/questionTerminal/6aa...

BoringError的博客 685

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

LeetCode(8)-回溯:组合排列问题

文章目录1.1 LeetCode 46.全排列1.2 LeetCode 47. 全排列 II1.3 LeetCode 77. 组合 今天来总结下LeetCode上关于回溯的应用之排列组合相关的问题 - ( ゜- ゜)つロ 1.1 LeetCode 46.全排列 给定一个没有重复数字的序列,返回其所有可能的全排列。 示例: 输入: [1,2,3] 输出: [ [1,2,3], [1,...

BoringError的博客 598

剑指Offer(30)-[HashTable]只出现一次的字符

点击查看剑指Offer全解【Java & Golang】实现 题目描述 在一个字符串(0<=字符串长度<=10000,全部由字母组成)中找到第一个只出现一次的字符,并返回它的位置, 如果没有则返回 -1(需要区分大小写). 思路 创建一个哈希表,在遍历字符串的过程中将当前字符出现的次数存储在哈希表中,第一次出现是1,之后出现N次都算作1(因为只要求得到第一个出现的字符,而不需...

BoringError的博客 563

LeetCode(3)-链表:反转

反转链表是链表的经典问题,往往思路很清晰,但是实现起来总是会出现一些小问题,这里记下一些经典的反转链表问题 目录 Leetcode 206.反转链表 Leetcode 92.反转链表II Leetcode 206.反转链表 反转一个单链表。 示例: 输入: 1->2->3->4->5->NULL 输出: 5->4->...

BoringError的博客 541

剑指Offer(23)-[LinkedList]删除链表中的重复节点

点击查看剑指Offer全解【Java & Golang】实现 题目描述 在一个排序的链表中,存在重复的结点,请删除该链表中重复的结点,重复的结点不保留,返回链表头指针。 例如,链表1->2->3->3->4->4->5 处理后为 1->2->5 思路 首先添加一个头节点dummy,以方便碰到第一个,第二个节点就相同的情况 设置 pr...

BoringError的博客 535

剑指Offer(51)-[Array&String]把数组排成最小的数

点击查看剑指Offer全解【Java & Golang】实现 题目描述 输入一个正整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接出的所有数字中最小的一个。例如输入数组{3,32,321},则打印出这三个数字能排成的最小数字为321323。 思路 将数组中的数字连接起来,排成一个最小的数字。将’大数’往后放’小数’往前放,如何定义’大数’和’小数’?比如说有两个数a和b,如果ab...

BoringError的博客 522
上一篇: 剑指Offer(54)-[Array&String]和为S的两个数字
下一篇: 剑指Offer(56)-[Array&String]孩子们的游戏
BoringRong
BoringRong 领域专家: 后端开发技术领域 领域专家: 后端开发技术领域
博客等级 码龄9年 2万+粉丝 386原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

BoringRong

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值