Leetcode 第 133 场双周赛题解

二进制转化成十进制 数制转换 输入一个 4 位二进制数,将其转换为十进制数输出。 例如:从键盘输入 1101 所以,程序应输出 13 #include<bits/stdc++.h> using namespace std; int ss(int x, int n) { int sum = 1; while(n--) { sum = sum * 2; } return sum * x; } int main() { int x; int 阅读详情

Leetcode 第 133 场双周赛题解

题目1:3190. 使所有元素都可以被 3 整除的最少操作数

思路

遍历数组,累加最少操作数,即 min(num % 3, 3 - num % 3)。

代码

/*
 * @lc app=leetcode.cn id=3190 lang=cpp
 *
 * [3190] 使所有元素都可以被 3 整除的最少操作数
 */

// @lc code=start
class Solution
{
public:
    int minimumOperations(vector<int> &nums)
    {
        int ans = 0;
        for (int &num : nums)
            ans += min(num % 3, 3 - num % 3);
        return ans;
    }
};
// @lc code=end

复杂度分析

时间复杂度:O(n),其中 n 是数组 nums 的长度。

空间复杂度:O(1)。

题目2:3191. 使二进制数组全部等于 1 的最少操作次数 I

思路

分类讨论:

  • 如果 nums[i]=1,无需修改,问题变成剩下 n−i-1 个数如何操作。接下来考虑 nums[i+1]。
  • 如果 nums[i]=0,修改,问题变成剩下 n−i-1 个数如何操作。接下来考虑 nums[i+1]。

所以从左到右遍历数组,一边遍历一边修改。

代码

/*
 * @lc app=leetcode.cn id=3191 lang=cpp
 *
 * [3191] 使二进制数组全部等于 1 的最少操作次数 I
 */

// @lc code=start
class Solution
{
public:
    int minOperations(vector<int> &nums)
    {
        int n = nums.size();
        int ans = 0;
        for (int i = 0; i < n - 2; i++)
        {
            if (nums[i] == 0)
            {
                nums[i + 1] = (nums[i + 1] ? 0 : 1);
                nums[i + 2] = (nums[i + 2] ? 0 : 1);
                ans++;
            }
        }
        if (nums[n - 2] == 0 || nums[n - 1] == 0)
            return -1;
        return ans;
    }
};
// @lc code=end

复杂度分析

时间复杂度:O(n),其中 n 是数组 nums 的长度。

空间复杂度:O(1)。

题目3:3192. 使二进制数组全部等于 1 的最少操作次数 II

思路

由于 nums[i] 会被其左侧元素的操作影响,所以我们先从最左边的 nums[0] 开始思考。

分类讨论:

  • 如果 nums[0]=1,无需反转,问题变成剩下 n−1 个数如何操作。接下来考虑 nums[1]。
  • 如果 nums[0]=0,反转次数加一,问题变成剩下 n−1 个数(在修改次数是奇数的情况下)如何操作。接下来考虑 nums[1]。

对后续元素来说,由于反转偶数次等于没反转,所以只需考虑反转次数的奇偶性。

一般地,设反转次数的奇偶性为 k,分类讨论:

  • 如果 nums[i]≠k,无需反转,接下来考虑 nums[i+1]。
  • 如果 nums[i]=k,反转次数加一,接下来考虑 nums[i+1]。

代码

/*
 * @lc app=leetcode.cn id=3192 lang=cpp
 *
 * [3192] 使二进制数组全部等于 1 的最少操作次数 II
 */

// @lc code=start
class Solution
{
public:
    int minOperations(vector<int> &nums)
    {
        int n = nums.size();
        int ans = 0;
        for (int i = 0; i < n; i++)
        {
            if (nums[i] == 1 && ans % 2 == 1)
                ans++;
            if (nums[i] == 0 && ans % 2 == 0)
                ans++;
        }
        return ans;
    }
};
// @lc code=end

复杂度分析

时间复杂度:O(n),其中 n 是数组 nums 的长度。

空间复杂度:O(1)。

题目4:3193. 统计逆序对的数目

思路

题解:教你一步步思考 DP:从记忆化搜索到递推到终极优化!(Python/Java/C++/Go)

代码

#
# @lc app=leetcode.cn id=3193 lang=python3
#
# [3193] 统计逆序对的数目
#

# @lc code=start
class Solution:
    def numberOfPermutations(self, n: int, requirements: List[List[int]]) -> int:
        MOD = 1_000_000_007
        # req[i] 是前 i 个数的逆序对个数
        req = [-1] * n
        req[0] = 0

        for end, cnt in requirements:
            req[end] = cnt

        if req[0]:
            return 0
        
        @cache
        def dfs(i: int, j: int) -> int:
            if i == 0:
                return 1
            r = req[i - 1]
            if r >= 0:
                return dfs(i - 1, r) if r <= j <= i + r else 0
            return sum(dfs(i - 1, j - k) for k in range(min(i, j) + 1)) % MOD
        return dfs(n - 1, req[n - 1])

# @lc code=end

复杂度分析

时间复杂度:O(n*m*min(n,m)),其中 m=max(cnti)。

空间复杂度:O(n*m),其中 m=max(cnti)。

HPM6E00:PWM V2使用指南 阅读详情

相关推荐

分析android逆向的学习路线

俗话说:“一入逆向深似海,从此头发是路人”。 安卓逆向作为当下热门行业“网络安全”的主要技术之一,已经受到了越来越多人的青睐。但是很多刚入门的新手小伙伴对于怎么去学习却还很是迷糊。本文就分享一下android逆向的学习路线供大家参考。 目前学习安卓逆向的人群大约分为两种: 第一种是完全没有任何基础的计算机纯小白; 第二种是本来就做开发懂编程的IT行业人员。 我们就针对这两个不同的人群做一下安卓逆向的学习路线分析。 一、无基础小白想入门 作为没有任何基础想要入门的计算机纯小白,学习上推荐参照以下步骤: (一

Hacker_by_V的博客 3084

Leetcode3192. 使二进制数组全部等于 1 的最少操作次数 II

Leetcode3192. 使二进制数组全部等于 1 的最少操作次数 II

ProgramNovice的博客 557

Informer:比Transformer更有效的长时间序列预测

目录 AAAI 2021最佳论文:比Transformer更有效的长时间序列预测 Background Why attention Methods:the details of Informer Solve_Challenge_1:最基本的一个思路就是降低Attention的计算量,仅计算一些非常重要的或者说有代表性的Attention即可,一些相近的思路在近期不断的提出,比如Sparse-Attention,这个方法涉及了稀疏化Attention的操作,来减少Attention计算量,然后涉及的

To be a better man 1万+

leetcode 第133场双周赛 100333.统计逆序对的数目【计数dp/滚动数组/前缀和优化】

逆序对 计数dp 滚动数组 前缀后优化

qq_33969563的博客 1190

海康威视iVMS-4200在银河麒麟系统部署全攻略与疑难排解

在信创国产化进程中,软件兼容性是关键挑战之一。以安防监控领域广泛使用的海康威视iVMS-4200客户端为例,其从Windows环境迁移到银河麒麟等国产操作系统时,面临架构适配、依赖库匹配等核心兼容性问题。这涉及到跨平台软件部署的通用原理:不同CPU架构(如ARM的飞腾、x86的兆芯)和操作系统底层API的差异,要求软件必须进行针对性编译和优化。解决这类问题的技术价值在于保障专业软件在国产化环境中的稳定运行,是信创产业落地的重要环节。具体到应用场景,如在基于银河麒麟V10的安防监控项目中,通过获取对应架构的.

weixin_33423874的博客 1573

scannet数据集下载文件

scannet数据集下载文件 由于大家会申请scannet数据集,审批比较慢,我将下载的文件里面的内容贴出来,大家可以复制放进py文件中,运行就可以下载 ps:别再私信要数据集了,这个自己下载,如果光三维数据的话,还是很快的,当然如果路由器翻了墙的话,下载会更快。 #!/usr/bin/env python # Downloads ScanNet public data release # Run with ./download-scannet.py (or python download-scannet.

weixin_40766438的博客 9242

LeetCode 100346. 使二进制数组全部等于 1 的最少操作次数 II

更多题解尽在每日更新。组队打卡,更多解法等你一起来参与哦!,难度。

m0_64381458的博客 964

Power Automate实战:用SharePoint REST API批量处理列表数据(附JSON解析技巧)

本文深入探讨了如何利用Power Automate调用SharePoint REST API实现列表数据的批量自动化处理。文章详细解析了API的协同工作原理、高效的数据获取与筛选技巧,并重点分享了JSON数据解析的核心难点与实战解决方案,旨在帮助企业用户构建稳定可靠的数据处理流程,提升运营效率。

coffee的博客 781

补码加法运算溢出判断

补码加法运算溢出判断三种方法: [方法一] Xf、Yf分别两个数符号位,Zf为运算结果符号位。 当Xf =Yf =0(两数同为正),而Zf=1(结果为负)时,负溢出; 当出现Xf =Yf =1(两数同为负),而Zf=0(结果为正),正溢出. [方法二] Cs表示符号位的进位,Cp表示最高数值位进位,⊕表示异或。 若 Cs⊕Cp =0 ,无溢出; 若 Cs⊕Cp =1 ,有溢出。 [方法三] 用变形

u011225147的专栏 2万+

全球气候模式降尺度方法总结及其代码实现

简介总结各类型气候模式降尺度方法

WW、forever的博客 1万+

rosbag分析传感器数据的时间同步情况方法

ROS传感器时间同步分析流程:通过rosbaginfo初步检查bag文件信息,使用rqt_bag可视化时间线分布,采用rostopicecho或Python脚本提取各传感器时间戳并计算时间差统计值(均值/最大差/标准差),最后分析接收与采样时间延迟。量化评估同步精度,识别固定偏移或随机抖动问题,确保多传感器数据对齐,为后续融合处理提供可靠数据基础。

start_up_go的博客 206

第 133 场 LeetCode 双周赛题解

t4题目条件很有提示作用

xhchen的博客 894

AutoSar实战营 - 总目录

欢迎大家来学习《AutoSar实战营》专栏,该篇为总目录,方便以后大家直接进入需要学习的文章。 ~正所谓独乐乐不如众乐乐 - - ~1, AutoSar之DaVinci开发环境2,BswM模块之Ecu State Handling1)读写DID功能 《AutoSar实战》读写DID之一:CDD准备 《AutoSar实战》读写DID之二:工具链配置 《AutoSar实战》读写DID之三:代码实现2)功能寻址 《AutoSar实战》禁止功能寻址

weixin_48498880的博客 3640

Leetcode - 133双周赛

leetcode - 133双周赛,主要知识点: &运算的性质及计算

m0_74859835的博客 1064

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

.NET 进制转换

  二进制转化为十进制 方法:二进制数从低到高(即从右到左)计算,第零位的值是2的0次方,第一位是2的1次方,第二位的值是2的2次方,一次递增下去,把最后的结果相加的值就是十进制的值了。 列:将二进制的(101011)B转换为十进制的步骤如下 1:一位  1*2^1=2; 2: 二位   0*2^2=0; 八进制 转化 十进制     方法:八进制数从低位到高位(即从右往左)计算,...

qq_36074088的博客 582

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

[Leetcode] 反转链表

反转链表的三道题

皮卡丘在充电 231

深度学习工具包 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 //C - 1325. Delete Leaves With a Given Value

This problem involves removing all leaf nodes from a binary tree that have a given target value, including cases where parent nodes become new leaves with the target value after deletion. The solution uses a postorder traversal approach (left-right-root) t

Made in Code 393

LeetCode100 136.只出现一次的数字

利用异或运算性质:相同数异或为0,任何数与0异或为自身,且异或满足交换律和结合律。数组中成对数字异或后抵消为0,仅剩唯一出现一次的数。通过遍历数组异或所有元素,可在线性时间复杂度O(n)和常数空间复杂度O(1)内求解。

Shaoxingzong的博客 223

LeetCode Hot 100 栈专题(20 / 155 / 394 / 739)(Java)

本专题四道题恰好覆盖栈的三类核心用法:括号匹配(延迟匹配)、辅助栈维护额外信息(最小值)、单调栈找下一个更大元素。把这三类打通,Hot 100 里的栈题基本可以通吃。 覆盖:20.有效的括号、155.最小栈、394.字符串解码、739.每日温度

2401_88612756的博客 327

LeetCode100 139.单词拆分

该解法使用动态规划判断字符串是否可被字典中的单词拆分。定义 dp[i] 表示前 i 个字符能否被成功拆分。遍历每个位置 i,尝试所有可能的分割点 j,若 dp[j] 为真且子串 s[j:i] 在字典中,则 dp[i] 设为真。一旦找到可行分割即跳出内层循环。最终返回 dp[n]。时间复杂度 O(n²),空间复杂度 O(n)。

Shaoxingzong的博客 181

LeetCode Hot 100 堆专题 215. 数组中的第 K 个最大元素 / 347. 前 K 个高频元素(Java)

本专题收录 Hot 100 中与「堆 / 优先队列」相关的两道题:215. 数组中的第 K 个最大元素、347. 前 K 个高频元素,每题按「题目分析与解题思路 → 常见解法(附代码)与讲解 → 知识点总结」三段组织。

2401_88612756的博客 242

LeetCode 3411.最长乘积等价子数组:二重循环“暴力”计算

LeetCode 3411.最长乘积等价子数组:二重循环“暴力”计算 给你一个由 正整数 组成的数组 nums。 如果一个数组 arr 满足 prod(arr) == lcm(arr) * gcd(arr),则称其为 乘积等价数组 ,其中: prod(arr) 表示 arr 中所有元素的乘积。 gcd(arr) 表示 arr 中所有元素的最大公因数 (GCD)。 lcm(arr) 表示 arr 中所有元素的最小公倍数 (LCM)。 返回数组 nums 的 最长 乘积等价 子数组 的长度。

<font color="Pink">Tisfy的博客</font> 228

LeetCode 207 课程表:用三态 DFS 判断有向图的环

用先修关系画图,讲清 DFS 的三种状态、两条路径汇合时为何不算环,以及怎样避免漏查独立分量。附 C++17 实现和 6 个本地验证用例。

wu77777777wu的博客 172

LeetCode Hop100 -- (160.相交链表)思路与总结

本文详解链表相交问题的三种解法:暴力遍历(O(mn))、哈希集合优化(O(m+n),O(m)空间),以及双指针巧妙解法(O(m+n),O(1)空间)。核心思想是通过让两指针分别走完自身链表后转向另一条,使它们在相遇点同步,从而找到交点。适用于求两条链表的公共节点,体现从暴力到优化的思维递进。

NGEFF的博客 200

LeetCode 33:搜索旋转排序数组——从二分查找到旋转数组的区间判定

本文详解LeetCode第33题“搜索旋转排序数组”的解法。核心思想是利用旋转数组中至少一半区间有序的特性,结合二分查找,在每次迭代中判断左半或右半部分是否有序,并据此确定目标值可能存在的区间,从而高效定位目标。通过合理更新边界,实现O(log n)时间复杂度。关键点包括:使用left <= right确保单元素处理、mid = left + (right - left)/2防溢出、以及根据有序区间判断目标范围。适用于无重复元素的旋转数组,若存在重复则需额外处理,可能导致最坏O(n)复杂度。

yu____yuan的博客 173

LeetCode Hot 100 -- (206.反转链表) 思路与总结

这题的思路是两层推上来的:首先是既然不能倒着走,就把节点全存进 List,再倒着重新连然后是发现处理每个节点其实只要 prev、next 两个信息,用三个指针滚着走就行如果题目里出现单链表、要反转、要改变节点之间的指向关系,先想三指针:存下一个、掉头、两个指针一起前进,大概思路就是这样了。

NGEFF的博客 184
上一篇: 渲染回调函数将音频传给音频单元
下一篇: ViewController 生命周期
UestcXiye
博客等级 码龄8年 9047粉丝 1306原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

打赏作者

UestcXiye

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

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

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

打赏作者

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

抵扣说明:

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

余额充值