E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
ans
C/C++: 二叉树叶子节点的个数 & 二叉树深度的求解
num2来标记,如果有左子结点,那么在每个循环中num1置1;同理,若有右子结点,在每个循环中num2置1;综上,每个循环中只要num1和num2都是0的时候,说明没有子结点,则可以判断是叶子结点,最终答案
ans
王小呆QAQ
·
2023-11-01 13:45
c++
c语言
算法
LeetCode-------》每日算法题,二分查找
publicintsearchInsert(int[]nums,inttarget){intn=nums.length;intleft=0;intright=n-1;intans=0;while(left=target){
ans
三思守心
·
2023-11-01 10:12
java
算法
数据结构
leetcode
2419. 按位与最大的最长子数组
publicclassSolution{publicintLongestSubarray(int[]nums){intans=1,ansMaxVal=nums[0];intmaxVal=nums[0],len=
ans
紫菜(Nori)
·
2023-11-01 07:23
数据结构与算法
算法
leetcode
数据结构
力扣每日一题90:子集
示例1:输入:nums=[1,2,2]输出:[[],[1],[1,2],[1,2,2],[2],[2,2]]示例2:输入:nums=[0]输出:[[],[0]]提示:1>
ans
;vectortemp;voidbacktrack
暴力递归战士
·
2023-11-01 06:46
LeetCode每日一题
leetcode
算法
职场和发展
Python算法例3 检测2的幂次
3.代码实现#采用UTF-8编码格式#参数n是一个整数#返回True或者FalseclassSolution:defcheckPowerOf2(self,n):
ans
=1foriinrange(31):
北辰Charih
·
2023-11-01 05:40
Python算法
python
算法
开发语言
LeetCode刷题---最长回文子串
方法一:暴力破解classSolution{publicStringlongestPalindrome(Strings){if(s.length()maxLen){maxLen=j-i;
ans
=s.substring
肥大毛
·
2023-11-01 04:19
LeetCode刷题
leetcode
算法
职场和发展
LeetCode刷题---简单组(六)
爬楼梯解法一题目一69.x的平方根解法一classSolution(object):defmySqrt(self,x):""":typex:int:rtype:int"""ifx==0:return0
ans
小馒头学python
·
2023-11-01 02:15
LeetCode刷题
leetcode
算法
职场和发展
275. H 指数 II——二分查找
;intleft=0,right=n-1;intans=0;//初值为0可以处理一些特殊情况while(left=n-midif(citations[mid]>=n-mid){right=mid-1;
ans
The_Dan
·
2023-10-31 21:12
力扣每日刷题
排序算法
leetcode
二分查找
c++
代码随想录算法训练营第五十六天|1143.最长公共子序列 ● 1035.不相交的线 ● 53. 最大子序和 动态规划
strlen(text1);intlen2=strlen(text2);intdp[len1+1][len2+1];for(inti=0;iresult)result=count;if(countans)
ans
is_xiaotian
·
2023-10-31 13:49
代码随想录算法
动态规划
算法
c语言
leetcode
LeetCode 829.连续整数求和 每日一题
示例2:输入:n=9输出:3解释:9=4+5=2+3+4示例3:输入:n=15输出:4解释:15=8+7=4+5+6=1+2+3+4+5提示:10){sum-=t;t++;}if(sum==0)
ans
+
@小红花
·
2023-10-31 11:15
LeetCode
leetcode
算法
职场和发展
PTA | 浙大版《Python程序设计》题目集 | 题解汇总
0foriinrange(1,n+1):number=number*10+asum+=numberreturnsum6-2defprime(k):ifk==1:return0x=2whilex*x0:
ans
Sdchr28
·
2023-10-31 05:18
python
程序设计
字符串
四数之和-力扣18-java排序+双指针
b],nums[c],nums[d]](若两个四元组元素一一对应,则认为两个四元组重复):0>fourSum(int[]nums,inttarget){intlen=nums.length;List>
ans
TLJava^v^
·
2023-10-31 03:30
#
力扣-java
力扣
java
四数之和
排序
双指针
(3)检测2的幂次
2.问题示例n=4,返回True;n=5,返回False3.代码实现#参数num是一个整数#返回是True和FalseclassSolution:defcheckPowerOf2(self,num):
ans
彩虹直至黑白_Joon
·
2023-10-31 03:22
编写程序, 输入一个大于 2 的自然数, 然后输出小于该数字的所有素数组成的列表。
foriinrange(2,int(x**0.5)+1,1):ifx%i==0:returnFalsereturnTrueans=[]n=eval(input())foriinrange(2,n,1):ifgan(i):
ans
.a
夭辰
·
2023-10-30 22:16
python
02 数组 有序数组的平方+长度最小的子数组
第二天力扣977.有序数组的平方双指针法Python版本classSolution:defsortedSquares(self,nums:List[int])->List[int]:n=len(nums)
ans
一蓑烟雨6
·
2023-10-30 21:17
leetcode
算法
python
AcWing第 127 场周赛 - AcWing 5283. 牛棚入住+AcWing 5284. 构造矩阵 - 模拟+快速幂+数学
include#include#include#include#includeusingnamespacestd;constintN=1e5+10;#definede(x)cout>n>>a>>b;c=0;
ans
JYWsuperman
·
2023-10-30 20:23
算法/思维
基础刷题
#
算法
Speex的移植和简单使用
3A:声学回声消除(AEC)、背景噪声抑制(
ANS
)、自动增益控制(AGC)三种音频算法的合称个人尝试之后发现,背景噪声消除效果较好,AEC和AGC似乎没什么用。。一、sp
椰子~
·
2023-10-30 17:13
linux
音视频
leetcode 238. 除自身以外数组的乘积
classSolution{public:vectorproductExceptSelf(vector&nums){intans=1;vectorleft;left.push_back(
ans
);for
奋起的熊猫
·
2023-10-30 15:03
leetcode
leetcode
算法
Lucas定理
includeusingnamespacestd;#definelllonglongintt;llA[100010];llkpow(lla,intb,intp){llans=1,now=a;inti=b;while(i){if(i%2==1){
ans
xxslml
·
2023-10-30 13:18
每日一题 275. H 指数 II(中等,二分)
classSolution:defhIndex(self,citations:List[int])->int:iflen(citations)==0:return0l,r=0,citations[-1]
ans
eyvr
·
2023-10-30 13:33
用Python刷力扣
算法
python
leetcode
matlab中isnan函数
的情况:任何关于NaN的运算,加减法:(+inf)+(-inf)乘法:0*inf除法:0/0;inf/infRemainder(余数):rem(x,y),其中y为0或x为inf>>inf+(-inf)
ans
安安csdn
·
2023-10-30 12:19
matlab
matlab
isnan
leetcode47
include#include#includeusingnamespacestd;classSolution{vectorvis;public:voidbacktrace(vector&nums,vector>&
ans
Nahida_nora
·
2023-10-30 10:32
Leetcode
递归
算法
c++
leetcode
【题解】[GenshinOI Round 3 ]P9817 lmxcslD
所以先打了一个最傻的代码上去试试.voidsolve(){cin>>n>>k;cout>n>>k;intans=0;intnn=n;while(n){for(inti=n;i>=1;i--){if(get(i)){
ans
Bamboo_Day
·
2023-10-30 08:50
C++入门基础教程
刷题笔记
c++
算法
笔记
计算2的幂题解(两种方法)及变式
0≤n#includeintmain(){intn,
ans
;scanf("%d",&n);
ans
=
SpringPie812024
·
2023-10-30 08:44
水题
c++
「DP Rec.」[USACO21JAN] Uddered but not Herd G
正难则反,可以考虑将
Ans
\rmAnsAns转化为n−
Zillion X
·
2023-10-30 08:40
状压DP
第 369 场周赛 (3题,递归式动态规划)
第一题简单题,就不多写了classSolution:deffindKOr(self,nums:List[int],k:int)->int:
ans
=[0]*31forninnums:foriinrange
eyvr
·
2023-10-30 07:48
用Python刷力扣
动态规划
算法
leetcode
python
牛客题霸--进制转换
因为M进制的数第一位时M0M^0M0,第二位时M1M^1M1,第三位M2⋯M^2\cdotsM2⋯所以如果10进制的数n大于MkM^kMk(k是最大的,即n=0;--i)
ans
.push_back(tmp
mjt233
·
2023-10-30 02:29
c++
编程语言
leetcode
牛客题霸--斐波那契数列
intFibonacci(intn){if(n==0)return0;if(n==1)return1;intans=0;intn1=0;intn2=1;for(inti=2;i<=n;i++){
ans
lll_564
·
2023-10-30 02:58
枚举
leetcode
算法
后端
【算法题解】3. 颠倒二进制位
来自:leetcode解法一解题思路取n的最低位,赋值给
ans
的最低位(
ans
初始值位0)。然后n向后移动一位,
ans
向前移动一位,重复步骤1,直到取完n的所有位置。
i余数
·
2023-10-30 00:32
每周一道算法题
算法
leetcode
职场和发展
java
力扣每日一题2021-09-06二分查找
一行代码704.二分查找题目描述二分查找思路:一行代码classSolution:defsearch(self,nums:List[int],target:int)->int:returnansif(
ans
wcy1034036507
·
2023-10-30 00:09
leetcode每日一题
leetcode
LeetCode面试经典150题—03 删除有序数组中的重复项 Ⅱ
:publicstaticintremoveDuplicates(int[]nums){ intans=nums.length; Mapmap=newHashMap=3){
ans
Lauren_Blueblue
·
2023-10-29 23:12
LeetCode
leetcode
面试
算法
2317.操作后的最大异或和
答案让我们求异或和所以只要这一位有1答案的这一位就有1我们发现这就是一个按位或运算classSolution{public:intmaximumXOR(vector&nums){intans=0;for(auto&t:nums)
ans
灬德布罗意的猫灬
·
2023-10-29 22:15
思维
算法
leetcode
数据结构
洛谷 B2029 大象喝水 C++代码
includeusingnamespacestd;intmain(){inth,r;cin>>h>>r;doubleval;val=3.14*r*r*h;intans=20000/val;
ans
爱编程的小芒果
·
2023-10-29 22:33
洛谷题目讲解大全
c++
开发语言
动态规划19(Leetcode673最长递增子序列的个数)
有点绕代码:classSolution{publicintfindNumberOfLIS(int[]nums){intn=nums.length;intmaxLen=0,
ans
=0;int[]dp=newint
从月亮走向月亮7
·
2023-10-29 19:04
动态规划
算法
leetcode
车载音频项目
2017/12-2019年0月AGC、AEC、
ANS
、AFC算法的预研项目职责:1.负责这些算法的资料收集、仿真、
周南音频科技教育学院(AI湖湘学派)
·
2023-10-29 18:31
音频
蓝桥杯每日一题2023.10.28
60分解法:直接暴力循环每一个数进行比较#includeusingnamespacestd;constintN=2e5+10;typedeflonglongll;lln,a[N],b[N],c[N],
ans
Akct
·
2023-10-29 18:51
蓝桥杯
职场和发展
辽宁省赛总结
公式题:
ans
=∑n−ki=0C(n,i)∗yi∗(1−y)n−i一开始忘记加入组合数C(n,i),没有考虑到n个数是有标号的!
lshacm
·
2023-10-29 14:45
acm_模拟比赛
Matlab中数组的常见用法
MATLAB中的特殊数组zeros()函数是用来创建一个全零的数组例如zeros(5)MATLAB执行上面示例代码,得到以下结果-Trial>>zeros(5)
ans
=0000000000000000000000000ones
sdhdwyx
·
2023-10-29 05:27
Matlab
matlab
shell
【10.28模拟赛T3】区间和的和【数论】
n-i+1)i∗(n−i+1)次最后累加即可CODE:#include#include#includeusingnamespacestd;constlonglongp=1e9+7;longlongn,x,
ans
Ayane.
·
2023-10-29 03:40
比赛题解
数论
公式
【10.28模拟赛T4】最大异域和【数论异或】
i2i要么则后面的都可以为111可以选全部累加成2j2^j2j即可CODE:#include#include#includeusingnamespacestd;intn,a[105],cnt[105],
ans
Ayane.
·
2023-10-29 03:40
数论
比赛题解
异或
【10.28模拟赛T5】小B浇花【单调性】
分析:排序只要构造一个单调递增的序列即可去模拟天数即可也可以等差序列求和CODE:#include#include#includeusingnamespacestd;inta[50005],qwq,n,
ans
Ayane.
·
2023-10-29 03:40
比赛题解
单调队列/栈
单调
Educational Codeforces Round 3
105];intmain(){intn,m;cin>>n>>m;for(inti=1;i>a[i];intans=0;sort(a+1,a+1+n);for(inti=n;i;i--){m-=a[i],
ans
拧错位置的螺丝钉
·
2023-10-29 00:24
Codeforces
VP
Codeforces
最大公约数:AcWing 872. 最大公约数 欧拉函数:AcWing 873. 欧拉函数
;}intmain(){intt;scanf("%d",&t);while(t--){inta,b;scanf("%d%d",&a,&b);intans=gcd(a,b);printf("%d\n",
ans
三冬四夏会不会有点漫长
·
2023-10-28 17:57
算法竞赛
c++
算法
数据结构
数学
欧拉函数
约数
2023.3.4
1为0在一堆偶数个数中奇数个数的数,可用亦或^位运算符直接对二进制操作,usingnamespacestd;typedefunsignedlonglongll;intmain(){lln,a,b,c,
ans
开星超人
·
2023-10-28 11:48
apache
蓝桥杯双周赛算法心得——通关(哈希+小根堆)
3.把第1关的子节点放入队列4.从队列中取出元素5.挑战成功再把子元素丢入队列中6.
ans
++;3).算法步
晴天学长
·
2023-10-28 11:34
算法
算法
蓝桥杯
哈希算法
【LeetCode刷题笔记-25 204:计数质数】
public:boolisPrime(intx){for(inti=2;i*iisPrime(n,1);intans=0;for(inti=2;i
ans
空、白、
·
2023-10-28 09:32
算法
算法
leetcode
c++
Leetcode 18 三数之和
不过因为是三个数所以左侧是两个下标classSolution{publicList>threeSum(int[]nums){intn=nums.length;Arrays.sort(nums);List>
ans
rvlt1
·
2023-10-28 09:49
leetcode
算法
职场和发展
Uva 140 Bandwidth
='#'){intn=0;for(chartmp='A';tmpu,v;while(true){while(p"<<
ans
<
weixin_34370347
·
2023-10-28 08:43
UVA-140 Bandwidth
include#include#include#include#include#includeusingnamespacestd;constintINF=10000;intcnt,minb;inttemp[8],
ans
Tech_hysteria
·
2023-10-28 08:43
算法竞赛入门经典
区间类贪心的理解【雷达设备】
做好准备工作后就进行一下操作;用last记录上一个雷达的位置,初始化为负无穷,
ans
记录用了多少个雷
刘欢明
·
2023-10-28 07:55
贪心算法
算法
leetcode
上一页
12
13
14
15
16
17
18
19
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他