AC算法打卡-数值的整次方-打印从1到最大的N位数

2026华为OD机试(Python)真题【E卷+A卷+B卷+C卷+D卷】目录+在线OJ 华为OD机试真题题库【E卷+A卷+B卷+C卷+D卷】目录,Python实现。 阅读详情

剑指 Offer 16. 数值的整数次方

 

class Solution {
public:
    double myPow(double x, int n) {
        double ans = 1.0;
        char flag = '+';
        long long b = n;
        if (b < 0) {
            flag = '-';
            b = -b;
        }
        while (b) {
            if (b % 2 == 1) {
                ans = ans * x;
            }
            x = x * x;
            b >>= 1;
        }
        if (flag == '-') ans = 1 / ans;
        return ans;
    }
};

剑指 Offer 17. 打印从1到最大的n位数

 

class Solution { 
public:
   vector<int> printNumbers(int n) {
       vector<int> result;
       if (n){
           for (int i = 1, max = pow(10, n); i < max; i++){
               result.push_back(i);
          }
      }

       return result;
  }
};

2026华为OD机试(JavaScript)真题【E卷+A卷+B卷+C卷+D卷】目录+在线OJ 华为OD机试真题题库【E卷+A卷+B卷+C卷+D卷】目录,JavaScript实现。 阅读详情

相关推荐

2026华为OD机试(C++)真题【E卷+A卷+B卷+C卷+D卷】目录+在线OJ

华为OD机试真题题库【E卷+A卷+B卷+C卷+D卷】目录,C++实现。

MISAYAONE的博客 20万+

LeetCode 3884.双端字符匹配:半次遍历

LeetCode 3884.双端字符匹配:半次遍历 给你一个长度为 n 的字符串 s,其中只包含小写英文字母。 返回最小的下标 i,使得 s[i] == s[n - i - 1]。 如果不存在这样的下标,返回 -1。

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

2026华为OD机试(JAVA&Go)真题【E卷+A卷+B卷+C卷+D卷】目录+在线OJ

华为OD机试真题题库【E卷+A卷+B卷+C卷+D卷】目录,Java实现。

MISAYAONE的博客 34万+

【LeetCode 热题 100】142. 环形链表 II|哈希表、快慢指针(Python)

【LeetCode 热题 100】【142. 环形链表 II】|哈希表、快慢指针(Python)

weixin_70673823的博客 345

2026华为OD机试(C语言)真题【E卷+A卷+B卷+C卷+D卷】目录+在线OJ

华为OD机试真题题库【E卷+A卷+B卷+C卷+D卷】目录,C语言实现。

MISAYAONE的博客 11万+

2026华为OD机考新系统真题 + 双机位C卷 + 往年真题 - 题库目录分值说明 + 考点说明+在线OJ

2026年4月1日起,华为OD机试正式切换至新系统模式!采用力扣模式,无需自己写输入! 难度大幅度降低。正在备考华为OD机试的同学,优先刷新系统机试真题,可大幅提升通过率。 新系统考题考点与旧版一致,无需重新适应。本专栏所有算法题均配有详细思路解析,并提供C语言、JS、C++、Python、Go、Java多语言源码实现。订阅后私信即可开通专属OJ刷题权限,高效备考一次上岸!

算法大师! 45万+

LeetCode Hot 100 -- (141.环形链表) 思路与总结

本文详解链表环检测问题,先介绍暴力法:用HashSet记录访问过的节点,时间复杂度O(n),空间O(n)。强调必须存节点而非值,否则会误判(如[1,1,1])。随后提出优化方案——快慢指针:慢指针走1步,快指针走2步,若有环则必相遇;若无环,快指针先达末尾。关键点:循环条件需检查fast和fast.next,且先移动再比较。总结:遇环、中点、倒数第k个等题型,优先考虑快慢指针,同一工具可多场景复用。

NGEFF的博客 183

【信息科学与工程学】计算机科学与自动化——第八十六篇 各类应用上云计算 01

数字孪生:核心是实时性不等式(Δ<Δt)与带宽-精度权衡。数学上归结为带约束的非线性优化。预测性维护:从物理退化方程(Paris 定律)出发,结合贝叶斯推断,云端训练用深度时序模型,边缘推理用轻量模型。机器人协同:本质是多商品流 + 动态障碍物,需用图论(冲突检测)+ 最优控制(轨迹平滑)。工业视觉:延迟由四个环节组成,需用排队论分析流水线瓶颈,量化感知是降低延迟的关键。液压/气动系统上云(涉及流体力学、热力学、控制)机械臂力控/阻抗控制上云(涉及动力学、力/位混合控制)

weixin_49199313的博客 222

LeetCode 1798. 你能构造出连续值的最大数目

该解法通过贪心策略求解最多连续凑出的金额。初始化count=1,表示可凑出0。遍历排序后的硬币,若当前硬币值x ≤ count,则可将原范围[0, count-1]扩展为[0, count-1+x],更新count += x;否则无法凑出count,直接返回。时间复杂度O(n log n),空间复杂度O(1)。

Shaoxingzong的博客 192

【信息科学与工程学】【通信工程】第七十七篇 城域网+FTTR/FTTB/FTTC/FTTO的数学分析01

总带宽 Btotal​需考虑各业务带宽 Bi​及统计复用性(按80%计算):Btotal​=0.8∑i=1n​Bi​​。调度延迟 Di​=ri​li​​,其中 li​为包长。:dtdN2​​=hνp​APp​σap​​(Nt​−N2​)−τN2​​−hνs​APs​σes​​N2​,N2=上能级粒子数,N_t=总Er³⁺浓度,σ_ap/σ_es=吸收/发射截面,τ=荧光寿命(≈10ms),A=纤芯面积。调度分数 Scorej​=w1​umax​−umin​umax​−uj​​+w2​mmax​mj​​。

weixin_49199313的博客 460

从拧螺丝到精密装配:三菱伺服电机扭矩控制在工业自动化中的实战解析

本文深入解析三菱伺服电机扭矩控制在工业自动化中的实战应用,重点介绍MR-J4系列伺服系统的高精度扭矩响应技术。从螺丝紧固到精密装配,详细讲解扭矩控制模式的选择、硬件配置、参数设置及典型故障排查方案,帮助工程师提升生产效率和产品质量。

weixin_29186249的博客 478

【LeetCode】 525. 连续数组

并在该累加值出现的时候记录当前元素的位置,使用map来保存,并初始化sum=0的元素位置为-1,这样在计算子数组长度的时候可以直接使用当前的下标位置减去之前元素和的下标位置。2、解题:题目要求找到一个子数组,其中元素0和1的数量相同,可以转换一下题目目标,将元素0元素转换成数字-1,这样所求的子数组的和就是0,和上一个题目相同的问题了。1、审题:输入一个数组,数组的元素值只有0或者1,现在要寻找一个子数组要求其中元素0和元素1的个数相同,并返回最长子数组的长度。

Tim_10的博客 195

CAPL编程入门:从零开始掌握汽车通信脚本语言

本文详细介绍了CAPL编程的基础知识,从开发环境搭建到核心语法精要,再到总线通信实战和高级调试技巧。CAPL作为汽车通信脚本语言,专为CAN、LIN等网络协议设计,帮助工程师高效完成车载网络测试。通过实战案例和性能优化建议,读者可以快速掌握CAPL编程技能。

s1t2u3的博客 990

【LeetCode 热题 100】206. 反转链表|链表、迭代、递归(Python)

【LeetCode 热题 100】【206. 反转链表】|链表、迭代、递归(Python)

weixin_70673823的博客 307

SOC Boot学习(二)——JTAG Debug介绍

JTAG(Joint Test Action Group ,联合测试行动小组 ) 是一种国际标准测试协议,主要用于芯片内部测试及对系统进行仿真、调试。JTAG 技术是一种嵌入式调试技术,它在芯片内部封装了专门的测试电路 TAP ( Test Access Port ,测试访问口),通过专用的 JTAG 测试工具对内部节点进行测试。如今大多数比较复杂的器件都支持 JTAG 协议,如 ARM 、 DSP 、 FPGA 器件等。

yttt的博客 1619

创客学院嵌入式驱动开发——学习资料汇总

1.创客学院知识巩固-01C语言回顾_C/C++_Set_Mode的博客-CSDN博客https://blog.csdn.net/Set_Mode/article/details/94431050 2.创客学院知识巩固-02数据结构_Set_Mode的博客-CSDN博客https://blog.csdn.net/Set_Mode/article/details/94431087 3.创客学院知...

snaking616 5124

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

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

2401_88612756的博客 283

ESP32、MicroPython、天问ASR-PRO,串口发送数据并播报

天问ASRPRO语音芯片内置脑神经网络处理器,支持DNN、TDNN、RNN等神经网络及卷积运算硬件运算,非软件运算,支持语音识别、声纹识别、语音增强、语音检测、单麦克风降噪增强、单麦克风回声消除、360度全方位拾音等功能。ASR-PRO可以图形化编程,降低开发难度,对小白友好。之前使用ASRPRO与ESP32进行过语音控制,这次由于一个项目需要对ESP处理过后的数据进行播报,就想到利用该模块。以下程序主要为测试代码,并非实际项目,仅供参考学习(若有错误,欢迎指正)。二者通过串口通信,波特率为9600。

weak_student的博客 5966

LeetCode 3561.移除相邻字符:栈(相邻相消)

LeetCode 3561.移除相邻字符:栈(相邻相消)

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

深度学习在移动开发中的应用:实时姿态估计实战

我们将使用TensorFlow Lite框架,结合专为移动端优化的MoveNet模型,实现一个能够在主流Android设备上达到30FPS的多人姿态跟踪解决方案,并深入探讨其优化技巧和实际应用场景。特别是3D姿态估计、多人长期跟踪等前沿技术的发展,将进一步推动移动端姿态估计技术的应用深度和广度。在下一篇文章中,我们将探讨深度学习在移动端的另一个创新应用:实时手势识别,包括如何在资源受限的环境中实现复杂手势的实时识别,以及这项技术在AR/VR交互、智能家居控制等场景中的应用。第四部分:典型应用场景实现。

Programming Talk 331

C#构建高精度预测模型:从数据预处理到模型部署的实战指南

【代码】C#构建高精度预测模型:从数据预处理到模型部署的实战指南。

墨夶的博客 1271

【LeetCode 热题 100】48. 旋转图像|数组、矩阵、原地算法(Python)

【LeetCode 热题 100】【48. 旋转图像】|数组、矩阵、原地算法(Python)

weixin_70673823的博客 936

微信小程序 - 最新详细实现“全局实时监听页面发生跳转“ 当页面跳转后立即捕捉并触发某个操作或调用处理函数,小程序整个项目无时无刻只要路由发生变化改变了就能监听,时刻检测页面URL变化(获取路由数据)

微信小程序,vue2,vue3,监听路由,如何监听路由发生变化,如何watch监听路由,怎么全局监听页面发生变化,实现当页面路由发生变化时执行一个函数,当路由变化时执行一些操作执行一段代码,怎么监听路由变化时触发一个函数,监听页面变化,页面间的跳转如何监听,页面跳转时怎么拿到路由及参数,页面路由变化时拿到参数和url,使用watch监听路由变化,页面跳转后怎么触发事件,怎么监听页面跳转,监听页面跳转并拿到路由url路径,小程序怎么全局定义一个专门监听路由的函数,小程序怎么无时无刻实时监听路由页面跳转,监听当

🏆 前端领域优质创作者 4488

哈希表----LeetCode 49. 字母异位词分组(图解+代码)

利用哈希表解决字母异位词分组问题,核心思想是将字符串排序后作为Key,相同字符组成的字符串排序结果一致,可归为同一组。通过HashMap<String, List<String>>存储排序后的字符串及其对应的原始字符串列表,遍历输入数组,对每个字符串排序并作为Key,若Key不存在则创建新List,最终返回map.values()转换为List<List<String>>。时间复杂度O(n·k log k),空间复杂度O(n·k)。

jianglin_78的博客 179

inori mmd 7z

楪祈的模型资源....................................................................................................................................................................................................................

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

【LeetCode 热题 100】240. 搜索二维矩阵 II|矩阵、二分查找、Z 字形查找(Python)

【LeetCode 热题 100】【240. 搜索二维矩阵 II】|矩阵、二分查找、Z 字形查找(Python)

weixin_70673823的博客 533

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

LeetCode 1201.丑数 III:二分查找+鸽巢原理(+最小公倍数)

LeetCode 1201.丑数 III:二分查找+鸽巢原理(+最小公倍数)

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

深度学习工具包 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")

上一篇: AC算法每日打卡-剪绳子、汉明重量
下一篇: AC算法每日打卡-删除链表的节点-正则表达式匹配
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值