LeetCode Algorithm 0009 - Palindrome Number (Easy)

LeetCode Algorithm 0062 - Unique Paths (Medium) 0062 - Unique Paths (Medium) 阅读详情

LeetCode Algorithm 0009 - Palindrome Number (Easy)

Problem Link: https://leetcode.com/problems/palindrome-number/description/



Description

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.

Example 1:

Input: 121
Output: true

Example 2:

Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.

Example 3:

Input: 10
Output: false
Explanation: Reads 01 from right to left. Therefore it is not a palindrome.

Follow up:

Coud you solve it without converting the integer to a string?


Solution C++

#pragma once

#include "pch.h"

// Problem: https://leetcode.com/problems/palindrome-number/description/

namespace P9PalindromeNumber
{
    class Solution
    {
        public:
        bool isPalindrome(int x)
        {
            // 题目要求不能使用 `string`

            // minus or last num is zero.
            if (x < 0 || (x != 0 && x % 10 == 0))
            {
                return false;
            }

            // only one digit
            if (x < 10)
            {
                return true;
            }

            int reverseNum = 0;
            while (x > reverseNum)
            {
                reverseNum = reverseNum * 10 + x % 10;
                x /= 10;
            }

            return x == reverseNum || x == reverseNum / 10;
        }
    };
}


学习笔记:TF卡启动荔枝派Nano(全志F1C200S) 荔枝派Nano编译Kernel报错报错内容如下编译烧录 报错内容如下 No controllers found No ethernet found. 从这些报错我真没看从出啥问题,也是在网上找,说是没有找到flash,是因为淘宝买的板子更换了flash,需要在u-boot里面重新适配型号: 板子的型号为xt25f128,但是实际u-boot的配置里面不是需要重新更改: u-boot/arch/arm/dts/suniv-f1c100s-licheepi-nano.dts &spi0 { pin 阅读详情

相关推荐

详解从无人机倾斜实景三维建模→模型修复→成果网络发布展示分享全流程

1、倾斜实景三维建模软件:CC(Smart3D)软件2、实景三维模型网页在线发布展示、分享平台:图新地球网页端(Wish3D·Earth平台)图新地球网页端(Wish3D·Earth平台)是基于 WebGL技术研发的国产实景三维模型Web端发布展示平台,可实现TB级倾斜实景三维数据快速加载,支持多种格式的三维模型,如OSGB实景模型、OBJ人工模型、SKP人工模型、RVT格式BIM模型等,同时支持模型单体化、三维模型测量分析、水面特效、日照分析等特殊效果呈现,此外也可以根据您的需要进行本地化部署级功能定制。

GISWorld3D的博客 4389

LeetCode Algorithm Menu (算法目录)

这个目录是记录我刷 LeetCode 算法题的过程,其中代码使用的是C++,不定期更新。

DarkRabbit的专栏 612

从零部署DeepSeek V4 Flash:NVIDIA DGX Spark实战指南

GPU加速计算已成为现代人工智能基础设施的核心,其原理是通过并行处理架构大幅提升深度学习模型的训练与推理效率。在AI工程实践中,NVIDIA GPU凭借CUDA生态和专用驱动栈,为大规模语言模型部署提供了硬件基础。本文聚焦于企业级AI服务器部署场景,针对NVIDIA DGX Spark多节点系统的硬件初始化、驱动兼容性配置、容器化部署等关键环节,提供从系统层到应用层的完整解决方案。通过vLLM推理框架的实战配置,演示如何将DeepSeek V4 Flash模型高效部署于多GPU环境,涵盖Tensor Par

weixin_32296621的博客 406

LeetCode Algorithm 0041 - 0045

0041 - First Missing Positive (Hard) 0042 - Trapping Rain Water (Hard) 0043 - Multiply Strings (Medium) 0044 - Wildcard Matching (Hard) 0045 - Jump Game II (Hard)

DarkRabbit的专栏 441

WangEditor 5.0版本dangerouslyInsertHtml方法的正确使用方式

WangEditor 5.0版本dangerouslyInsertHtml方法的正确使用方式

yang1067155909的专栏 4301

OpenBCI脑电数据处理实战:用MNE库从Raw对象到可视化分析全流程

本文提供了使用MNE-Python库处理OpenBCI脑电数据的完整实战指南。从通过BrainFlow库获取原始数据流、创建核心的Raw对象,到进行工频滤波、带通滤波等关键预处理步骤,最后实现时域信号、功率谱密度及地形图等多种专业可视化分析,手把手教你完成脑机接口数据处理的全流程。

gin88的博客 381

LeetCode Algorithm 0036 - 0040

0036 - Valid Sudoku (Medium) 0037 - Sudoku Solver (Hard) 0038 - Count and Say (Easy) 0039 - Combination Sum (Medium) 0040 - Combination Sum II (Medium)

DarkRabbit的专栏 440

Shopee接口安全机制深度解析:从签名参数到稳定采集实战

本文深度解析了Shopee平台接口的安全机制,重点剖析了其核心签名参数`x-sap-ri`和`x-sap-sec`的动态生成逻辑。通过逆向分析与实战演示,文章提供了使用Python模拟签名算法、构建稳定数据采集方案的完整思路与代码框架,并探讨了应对密钥动态更新等长期运行挑战的策略。

weixin_29323049的博客 402

LeetCode Algorithm 0060 - Permutation Sequence (Medium)

0060 - Permutation Sequence (Medium),Related Topics: Math Backtracking

DarkRabbit的专栏 423

奇迹mu服务端DATA文件解析:从基础配置到高级玩法

本文深入解析奇迹MU服务端DATA文件的核心配置与高级玩法,涵盖基础设置、怪物AI系统、技能战斗机制、副本事件管理及物品商城定制。通过详细示例和实用技巧,帮助开发者掌握从经验倍率调整到动态事件触发的全方位配置方法,实现个性化的私服搭建与运营。

weixin_29254673的博客 549

CKA-题库-简洁参考答案-反复练习20遍-必过!!!

新版CKA考试已于2020年9月1日正式上线! 考试模式:线上考试 考试时间:2小时 认证有效期:3年 软件版本:Kubernetes v1.19 重考政策:可接受1次重考 经验水平:中級 题目数量:17题 题库量小:随机的题目重复率极高 考试时可打开两个浏览器Tab,一个是考试窗口,一个用来查阅官方文档](https://kubernetes.io/docs/) 01 Task - 英文 Create a new ClusterRole named deployment-clusterrole tha.

随笔记录-分享&记忆 7333

LeetCode Algorithm 0046 - 0050

0046 - Permutations (Medium) 0047 - Permutations II (Medium) 0048 - Rotate Image (Medium) 0049 - Group Anagrams (Medium) 0050 - Pow(x, n) (Medium)

DarkRabbit的专栏 390

论文阅读: SIGIR 2025 ID-Free Not Risk-Free: LLM-Powered Agents Unveil Risks in ID-Free Recommender Syste

咱们平时用的推荐系统(比如购物APP推商品、视频APP推剧),大多是“有ID”的——每个用户、每个商品都有个专属ID,系统靠这些ID记录你的浏览、购买历史,再给你推喜欢的东西。但这种方式有个大问题:新用户、新商品刚上线时没有ID历史数据,系统没法精准推荐,这就是“冷启动”难题。后来人们搞出了“无ID推荐系统”:不用ID了,改成直接分析商品的文字信息(比如商品标题、描述),靠大语言模型(LLM,类似ChatGPT的技术)把文字转成“语义代码”,再通过这些“代码”判断你可能喜欢什么。

CSPhD-winston的博客 982

LeetCode Algorithm 0059 - Spiral Matrix II (Medium)

0059 - Spiral Matrix II (Medium),Related Topics: Array

DarkRabbit的专栏 388

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

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

LeetCode Algorithm 0031 - 0035

0031 - Next Permutation (Medium) 0032 - Longest Valid Parentheses (Hard) 0033 - Search in Rotated Sorted Array (Medium) 0034 - Find First and Last Position of Element in Sorted Array (Medium) 0035 - Search Insert Position (Easy)

DarkRabbit的专栏 373

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

LeetCode Algorithm 0003 - Longest Substring Without Repeating Characters (Medium)

LeetCode Algorithm 0003 - Longest Substring Without Repeating Characters (Medium) Problem Link: https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ Descript...

DarkRabbit的专栏 368

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

LeetCode Algorithm 0006 - ZigZag Conversion (Medium)

LeetCode Algorithm 0006 - ZigZag Conversion (Medium) Problem Link: https://leetcode.com/problems/zigzag-conversion/description/

DarkRabbit的专栏 358

LeetCode Algorithm 0026 - 0030

0026 - Remove Duplicates from Sorted Array (Easy) 0027 - Remove Element (Easy) 0028 - Implement strStr() (Easy) 0029 - Divide Two Integers (Medium) 0030 - Substring with Concatenation of All Words (Hard)

DarkRabbit的专栏 345

LeetCode Algorithm 0021 - 0025

0021 - Merge Two Sorted Lists (Easy) 0022 - Generate Parentheses (Medium) 0023 - Merge k Sorted Lists (Hard) 0024 - Swap Nodes in Pairs (Medium) 0025 - Reverse Nodes in k-Group (Hard)

DarkRabbit的专栏 341

LeetCode Algorithm 0001 - Two Sum (Easy)

LeetCode Algorithm 0001 - Two Sum (Easy) Problem Link: https://leetcode.com/problems/two-sum/description/ Description Given an array of integers, return indices of the two numbers such that the...

DarkRabbit的专栏 326

LeetCode Algorithm 0011 - 0015

0011 - Container With Most Water (Medium) 0012 - Integer to Roman (Medium) 0013 - Roman to Integer (Easy) 0014 - Longest Common Prefix (Easy) 0015 - 3Sum (Medium)

DarkRabbit的专栏 325

LeetCode Algorithm 0007 - Reverse Integer (Easy)

LeetCode Algorithm 0007 - Reverse_Integer (Easy) Problem Link: https://leetcode.com/problems/reverse-integer/description/ 文章目录LeetCode Algorithm 0007 - Reverse_Integer (Easy)DescriptionSolution C++ ...

DarkRabbit的专栏 320

算法与机器学习校招简历怎么写?本硕完整流程与范文

写好一份算法与机器学习校招简历,核心不是堆砌热门模型名称,而是用一页纸证明你能把实际问题转化为可建模的任务,并讲清数据来源、基线对比、评估指标和工程落地细节。具体落地可以按“拆解岗位需求—分组写技能—用事实改写三类经历—核验论文比赛口径—针对性排版与防追问演练”五个环节依次完成。只要每段经历都有明确的参照系和个人分工,无论本科还是研究生,都能写出经得起面试官深挖的简历。本文更新于 2026 年 11 月。

几许的博客 261

【三年面试五年模拟】2026-11-08_米哈游AI大模型算法岗面经全解析

米哈游大模型算法岗面经全解析:逐题解析9个问题,覆盖Agent推理与工具调用、轨迹和记忆、奖励排障、DPO长度偏差、学习率退火、游戏GUI Agent评测、RoPE长度扩展及DPO/PPO对比,补充状态恢复、数值算例与实验设计。

Rocky Ding相信人工智能、数据科学、商业逻辑、金融工具、终身成长以及顺应时代的潮流会赋予我们超能力。 284

FA_排序算法-冒泡排序

(相等元素相对位置不变),像水里气泡往上浮。

eillot_qian的博客 334

【三年面试五年模拟】2026-10-21_零一万物知识图谱算法实习生一面面经全解析

一万字【三年面试五年模拟】2026-10-21_零一万物知识图谱算法实习生一面面经全解析

Rocky Ding相信人工智能、数据科学、商业逻辑、金融工具、终身成长以及顺应时代的潮流会赋予我们超能力。 585
上一篇: LeetCode Algorithm 0008 - String to Integer (atoi) (Medium)
下一篇: LeetCode Algorithm 0010 - Regular Expression Matching (Hard)
沙沙的兔子
博客等级 码龄17年 360粉丝 135原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值