【leetcode】1011. 在 D 天内送达包裹的能力(capacity-to-ship-packages-within-d-days)(二分)[中等]

LeetCode1011.Capacity To Ship Packages Within D Days(在 D 天内送达包裹的能力) 1014.Capacity To Ship Packages Within D Days(在 D 天内送达包裹的能力)DescriptionDifficulty: mediumExample 1:Example 2:Example 3:Note:分析参考代码 Description A conveyor belt has packages that must be shipped from one... 阅读详情

链接

https://leetcode-cn.com/problems/capacity-to-ship-packages-within-d-days/

耗时

解题:62 min
题解:30 min

题意

传送带上的包裹必须在 D 天内从一个港口运送到另一个港口。

传送带上的第 i 个包裹的重量为 weights[i]。每一天,我们都会按给出重量的顺序往传送带上装载包裹。我们装载的重量不会超过船的最大运载重量。

返回能在 D 天内将传送带上的所有包裹送达的船的最低运载能力。

提示:

  • 1 <= D <= weights.length <= 50000
  • 1 <= weights[i] <= 500

思路

二分答案。将所有重量的和作为上边界,最大的重量作为下边界。

对于当前的 载重能力,贪心的判断最少需要多少天才能将传送带上的所有包裹送达。如果需要的天数小于等于 D,说明当前的载重能力可以,则将中间值赋给下边界,如果大于 D,说明不可以,将中间值赋给上边界。

时间复杂度: O ( l o g ( t − s ) ) O(log(t-s)) O(log(t−s))

AC代码

class Solution {
private:
    vector<int> weights;
    int D;
public:
    bool check(int capacity) {
        int day_cnt = 0, curr_wei = 0;
        for(auto weight : weights) {
            if(curr_wei + weight > capacity) {
                day_cnt++;
                curr_wei = 0;
            }
            if(day_cnt > D) return false;
            curr_wei += weight;
        }
        day_cnt++;
        return day_cnt <= D;
    }
    
    int shipWithinDays(vector<int>& weights, int D) {
        this->weights = weights;
        this->D = D;
        int sum_wei = accumulate(weights.begin(), weights.end(), 0);
        int max_wei = *max_element(weights.begin(), weights.end());
        int s = max_wei, t = sum_wei;
        while(s < t) {
            int m = s + ((t-s)>>1);
            if(check(m)) t = m;
            else s = m+1;
        }
        return s;
    }
};
Android Qcom Display学习(十一) 该系列文章总目录链接与各部分简介:本章主要是基于MIPI Payload传输接口的学习,包括Generic和DCS的接口不同。底层都是基于去封装的,下面第一部分调用原生接口,第二部分分析高通是如何进行读写操作的。 阅读详情

相关推荐

Frida实战:从adb连接到安卓设备参数加密Hook全流程解析

本文详细解析了使用Frida进行安卓应用动态分析的全流程。通过adb连接设备并部署Frida服务端,结合静态分析与动态Hook技术,精准定位并拦截关键函数,特别是针对参数加密等核心逻辑的实时监控与修改,为逆向分析与安全研究提供了高效实战方案。

weixin_29208077的博客 355

22-二分-值域二分-在 D 天内送达包裹的能力

请注意,货物必须按照给定的顺序装运,因此使用载重能力为 14 的船舶并将包装分成 (2, 3, 4, 5), (1, 6, 7), (8), (9), (10) 是不允许的。老规矩用二分法解决问题,这不过这里的mid要求大于weights[i],而且这里左右指针移动的条件可以根据砍几刀来判断,砍几刀可以根据贪心法来判断。我们装载的重量不会超过船的最大运载重量。天内将传送带上的所有包裹送达的船的最低运载能力。第 1 天:1, 2, 3, 4, 5。第 1 天:3, 2。第 2 天:2, 4。

weixin_56270372的博客 420

LIN总线从入门到精通:低成本汽车通信协议原理与实战

在汽车电子和嵌入式系统中,串行通信协议是实现分布式控制的关键技术。其中,LIN(Local Interconnect Network)总线作为一种专为低成本应用设计的单主多从网络协议,其核心原理在于通过简化的“领导-汇报”通信模式,在满足车身控制、传感器数据采集等场景需求的同时,将硬件与布线成本降至最低。LIN总线采用标准化的帧结构,包含间隔场、同步场和受保护标识符场,并依赖调度表来管理通信时序,确保了网络的确定性与可靠性。其技术价值在于为车窗、座椅、灯光等非安全关键系统提供了高性价比的解决方案,是构建分层

weixin_29185167的博客 268

《LeetCode之每日一题》:33.在 D 天内送达包裹的能力

在 D 天内送达包裹的能力有关题目题解 题目链接:在 D 天内送达包裹的能力 有关题目 传送带上的包裹必须在 D 天内从一个港口运送到另一个港口。 传送带上的第 i 个包裹的重量为 weights[i]。 每一天,我们都会按给出重量的顺序往传送带上装载包裹。 我们装载的重量不会超过船的最大运载重量。 返回能在 D 天内将传送带上的所有包裹送达的船的最低运载能力。 示例 1: 输入:weights = [1,2,3,4,5,6,7,8,9,10], D = 5 输出:15 解释: 船舶最低载重 15

MerryMaking7946的博客 418

实战解析:利用Wireshark解密QQ通信协议

本文提供了一份利用Wireshark工具分析QQ通信协议的实战指南。文章详细介绍了从环境准备、捕获数据包到解析协议层的完整流程,重点演示了如何识别QQ号码字段、观察加密数据特征以及区分不同通信类型(如文本、文件传输)。通过此实践,读者可以深入理解网络分层模型和现代应用加密通信机制,提升网络协议分析与安全诊断能力。

weixin_29210727的博客 420

Fastjson2 2.0.26反序列化漏洞深度剖析:从原理到PoC构造

本文深度剖析了Fastjson2在2.0.26及之前版本中存在的反序列化漏洞。该漏洞允许攻击者通过构造包含恶意TemplatesImpl对象的JSONArray,并利用BadAttributeValueExpException触发,在反序列化过程中实现远程代码执行。文章从漏洞原理、PoC构造、利用链分析到防御建议,提供了全面的技术解读,帮助开发者和安全人员理解其危害并采取应对措施。

d3e4f的博客 1060

Leetcode 1011. Capacity To Ship Packages Within D Days 在 D 天内送达包裹的能力

Leetcode 1011. Capacity To Ship Packages Within D Days 在 D 天内送达包裹的能力1011. Capacity To Ship Packages Within D Days题目描述:示例:解答:代码: 1011. Capacity To Ship Packages Within D Days 题目描述: A conveyor belt has ...

importsys的博客 344

MiniMax H3 + ComfyUI 工作流搭建指南:从整合包到视频生成

AI视频生成正成为内容创作的新基础设施,而ComfyUI作为可视化工作流引擎,将复杂的模型推理过程拆解为节点与连线,让本地视频生成变得可复用、可批量。理解这一原理后,用户无需编写代码,只需掌握模型加载、提示词控制、采样与解码的基本链路,即可搭建出稳定的视频生产管线。MiniMax H3作为前沿视频生成模型,在ComfyUI中通过权重文件和自定义节点落地,配合整合包可大幅降低环境配置门槛。从硬件评估、目录结构到节点连接与参数调优,本文系统性梳理了从零跑通一条视频生成工作流的完整路径,帮助用户在批量素材生成、风

weixin_29057065的博客 444

Leetcode 1011.在 D 天内送达包裹的能力(Capacity To Ship Packages Within D Days)

Leetcode 1011.在 D 天内送达包裹的能力 1 题目描述(Leetcode题目链接)   传送带上的包裹必须在 D 天内从一个港口运送到另一个港口。 传送带上的第 i 个包裹的重量为 weights[i]。每一天,我们都会按给出重量的顺序往传送带上装载包裹。我们装载的重量不会超过船的最大运载重量。 返回能在 D 天内将传送带上的所有包裹送达的船的最低运载能力。 输入:weights =...

qq_39378221的博客 290

软件测试--用例篇(测试用例的好处、测试用例的七种设计方法、测试用例的粒度、测试用例的评价)

作为软件测试工程师,最主要的工作就是:编写测试用例,那么为什么要编写测试用例?它有什么好处?如何编写测试用例?测试用例写简单好还是复杂好?如何评价测试用例的质量? 天呐撸!能说不会吗?! 作为倾向软件测试工程师的老铁们,还是一起来学习吧! 一、编写测试用例的好处 测试用例是测试者的依据 测试用例使得工作可重复,是自动化测试的基础 补充:自动化测试的前提条件是:功能比较稳定,页面...

cherrydreamsover的博客 3741

cocos2dx中DrawNode画线锯齿和非凸多边形填充

记录一下在cocos2dx中使用DrawNode所遇到的2个问题 1.画线锯齿问题 ios版本下,在AppController.mm中设置CCEAGLView的multiSampling和numberOfSamples。如下图 CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds]

hello-world 5419

LeetCode 1011. Capacity To Ship Packages Within D Days(python)

1011. Capacity To Ship Packages Within D Days Capacity To Ship Packages Within D Days python solution 题目描述 A conveyor belt has packages that must be shipped from one port to another within D days. T...

Orientliu96的博客 477

深入浅出:使用Python爬取链家二手房数据

在数据驱动的时代,房地产数据作为社会经济的重要指标,一直是数据分析师、投资者和研究人员关注的焦点。链家作为国内领先的房产中介平台,其二手房数据具有较高的真实性和时效性。然而,官方API的访问限制和数据获取的门槛,让很多初学者望而却步。本文将带你从零开始,使用Python编写一个符合robots.txt规范的链家二手房爬虫,获取标题、户型、价格等信息。文章不仅会提供完整代码,还会深入讲解反爬策略、请求头伪装、数据解析、异常处理等实战技术。目录前言:为什么要写这篇博客?一、爬虫前的准备:法律与道德。

2201_76125261的博客 100

Leetcode 1011:在 D 天内送达包裹的能力 Capacity To Ship Packages Within D Days

中文描述: 传送带上的包裹必须在 D 天内从一个港口运送到另一个港口。 传送带上的第 i 个包裹的重量为 weights[i]。每一天,我们都会按给出重量的顺序往传送带上装载包裹。我们装载的重量不会超过船的最大运载重量。 返回能在 D 天内将传送带上的所有包裹送达的船的最低运载能力。 题目描述: A conveyor belt has packages that must be shipped from one port to another within D days. The ith packag

weixin_43946031的博客 256

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

LeetCode——1011. 在 D 天内送达包裹的能力(Capacity To Ship Packages Within D Days)[中等]——分析及代码(Java)

LeetCode——1011. 在 D 天内送达包裹的能力[Capacity To Ship Packages Within D Days][中等]——分析及代码[Java]一、题目二、分析及代码1. 二分查找(1)思路(2)代码(3)结果三、其他 一、题目 传送带上的包裹必须在 D 天内从一个港口运送到另一个港口。 传送带上的第 i 个包裹的重量为 weights[i]。每一天,我们都会按给出重量的顺序往传送带上装载包裹。我们装载的重量不会超过船的最大运载重量。 返回能在 D 天内将传

江南土豆的博客 352

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

Leetcode之二分法专题-1011. 在 D 天内送达包裹的能力(Capacity To Ship Packages Within D Days)...

Leetcode之二分法专题-1011. 在 D 天内送达包裹的能力(Capacity To Ship Packages Within D Days) 传送带上的包裹必须在 D 天内从一个港口运送到另一个港口。 传送带上的第i个包裹的重量为weights[i]。每一天,我们都会按给出重量的顺序往传送带上装载包裹。我们装载的重量不会超过船的最大运载重量。 返回能在D...

denghan1065的博客 186

深度学习工具包 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-1011. Capacity to Ship Packages Within D Days

Original link: https://leetcode.com/problems/capacity-to-ship-packages-within-d-days/ Inspired by Hint: Binary search on the answer. We need a function possible(capacity) which returns true if and onl...

Liuu Zn的博客 325

[Swift]LeetCode1011. 在 D 天内送达包裹的能力 | Capacity To Ship Packages Within D Days

★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs.com/strengthen/)➤GitHub地址:https://github.com/strengthen/LeetCode➤原文地址:https://www.cnblogs.com/stren...

weixin_30610755的博客 165

leetcode 1011. capacity-to-ship-packages-within-d-days 在 D 天内送达包裹的能力 python3

时间:2021-02-21 题目地址:https://leetcode-cn.com/problems/capacity-to-ship-packages-within-d-days/ 题目难度:Medium 题目描述: 传送带上的包裹必须在 D 天内从一个港口运送到另一个港口。 传送带上的第 i个包裹的重量为weights[i]。每一天,我们都会按给出重量的顺序往传送带上装载包裹。我们装载的重量不会超过船的最大运载重量。 返回能在 D 天内将传送带上的所有包裹送达的船的最低运载能力。 示..

isabloomingtree的博客 190

LeetCode C++ 1011. Capacity To Ship Packages Within D Days【Binary Search/Array】中等

A conveyor belt has packages that must be shipped from one port to another within D days. The ith package on the conveyor belt has a weight of weights[i]. Each day, we load the ship with packages on the conveyor belt (in the order given by weights). We may

memcpy0的博客 407

leetcode:1014. Capacity To Ship Packages Within D Days

package com.springboot.demo.leetcode; /** * 显示英文描述 用户通过次数 197 用户尝试次数 272 通过次数 203 提交次数 538 题目难度 Medium 传送带上的包裹必须在 D 天内从一个港口运送到另一个港口。 传送带上的第 i 个包裹的重量为 weights[i]。每一天,我们都会按给出重量的顺序往传送带上装...

cx372877498的专栏 319

Leetcode 1011. Capacity To Ship Packages Within D Days (Binary Search经典)

Leetcode 1011:Binary Search经典

roufoo的博客 470

LeetCode 热题 100-普通数组

因为nums[i]应该在的位置索引是nums[i]-1,所以如果nums[nums[i]-1](按索引找出来的值)不是nums[i],那就换位置。lambda是匿名函数,lambda表达式本身产生一个函数对象,可以赋值给变量,传给 函数,立即调用。找半天错误,发现不该和intervals前一个区间做对比,应该和list1的最后一个区间做对比。我原本的想法是创建一个新列表,把轮转后的数字放在新列表中,然后把新列表赋值给nums。列表原地排序,排序依据是每个元素(一个区间)的第 0 个值,即左端点。

m0_74153997的博客 167

LeetCode100 22.括号生成

该解法通过深度优先搜索生成所有合法括号组合。使用递归时传入剩余左括号数 left 和右括号数 right,剪枝条件为 left > right(防止右括号多于左括号),非法则返回。每次递归尝试添加左括号或右括号,当两者均为0时,得到一组合法结果。因字符串不可变,无需回溯,直接传递新串。最终返回所有合法括号组合。

Shaoxingzong的博客 162

LeetCode Hot 100 二分查找专题 34 / 33 / 153(Java)

专题主线:三道题共用同一副二分骨架,差别只在循环条件和收缩方向: 34.在排序数组中查找元素的第一个和最后一个位置:用 left <= right 练「边界二分」, 153.寻找旋转排序数组中的最小值:用 left < right + right = mid 练「下界模板」, 33.搜索旋转排序数组:是二者的组合应用。

2401_88612756的博客 570

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 405
上一篇: 【leetcode】897. 递增顺序搜索树(increasing-order-search-tree)(dfs)[简单]
下一篇: 【leetcode】938. 二叉搜索树的范围和(range-sum-of-bst)(dfs)[简单]
KroneX
博客等级 码龄9年 76粉丝 299原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值