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
Solution)
每日OJ题_位运算⑤_力扣371. 两整数之和
示例1:输入:a=1,b=2输出:3示例2:输入:a=2,b=3输出:5提示:-1000<=a,b<=1000class
Solution
{public:intgetSum(inta,intb){}};解析代码此题知识点就是异或运算为无进位相加
GR鲸鱼
·
2024-02-12 16:28
每日OJ题
leetcode
算法
c++
哈希
位图
位运算
力扣题: 全排列(python3版)
class
Solution
(object):defpermute(self,nums):""":typenums:List[int]:rtype:List[List[int]]"""iflen(nums
HAPPY酷
·
2024-02-12 15:44
python
算法
剪枝
leetcode
面试题50:第一个只出现一次的字符
在一个字符串(0<=字符串长度<=10000,全部由字母组成)中找到第一个只出现一次的字符,并返回它的位置,如果没有则返回-1(需要区分大小写).解题思路:#-*-coding:utf-8-*-class
Solution
小歪与大白兔
·
2024-02-12 15:05
C++ day49 买卖股票的最佳时机
prices[i]表示一支股票在第i天的价格,只能在某一天买入这支股票,并在之后的某一天卖出该股票,从而获得最大利润,返回该最大值,若不能获取利润,则返回0注意:股票只能买卖一次暴力解法(超时)class
Solution
人来茶热
·
2024-02-12 14:19
c++
算法
开发语言
Day45 买卖股票的最佳时机
暴力搜索:超时class
Solution
{public:intmaxProfit(vector&price
借我点钱
·
2024-02-12 14:16
算法
leetcode
数据结构
2/7 算法每日N题(二分+双指针)
第一题:class
Solution
{public:intsearch(vector&nums,inttarget){intleft=0,right=nums.size()-1;while(lefttarget
自身就是太阳
·
2024-02-12 13:30
算法
leetcode
数据结构
807. 保持城市天际线
class
Solution
{public:intmaxIncreaseKeepingSkyline(vector>&grid){intn=grid.size();vectorrowMaxHeights(
Python ml
·
2024-02-12 10:59
LeetCode
算法
java
数据结构
1345. 跳跃游戏 IV
class
Solution
{public:intminJumps(vector&arr){intn=arr.size();unordered_map>idxSameValue;for(inti=0;ivisitedIndex
Python ml
·
2024-02-12 10:59
LeetCode
游戏
算法
402. 移掉 K 位数字
class
Solution
{public:stringremoveKdigits(stringnum,intk){dequest;for(charc:num){while(!
Python ml
·
2024-02-12 10:28
LeetCode
算法
236. 二叉树的最近公共祖先
则返回它们的公共祖先;如果只存在一个,则返回存在的一个;如果p和q都不存在,则返回NULL然后就将查找pq是否存在某个子数下面(如排除了root->right)和查找公共祖先这两个功能缝合在一起了class
Solution
Python ml
·
2024-02-12 10:28
LeetCode
算法
数据结构
递归
71. 简化路径
class
Solution
{public:stringsimplifyPath(stringpath){dequest;inti=0,n=path.length();stringres;while(i<
Python ml
·
2024-02-12 10:58
LeetCode
算法
数据结构
23. 合并 K 个升序链表
新学的C++17的推导指引class
Solution
{public:ListNode*mergeKLists(vector&lists){lists.erase(remove_if(lists.begin
Python ml
·
2024-02-12 10:58
LeetCode
链表
数据结构
142. 环形链表 II
主要的两点:1.走a+nb步一定是在环入口2.第一次相遇时慢指针已经走了nb步(nb+a=a)在入口相遇class
Solution
{public:ListNode*detectCycle(ListNode
Python ml
·
2024-02-12 10:57
LeetCode
链表
算法
394. 字符串解码
递归class
Solution
{public:stringdfs(strings,int&start){stringres;intmulti_num=0;for(inti=start;imulti;stackpreString
Python ml
·
2024-02-12 10:27
LeetCode
算法
数据结构
76. 最小覆盖子串(滑动窗口板子)
class
Solution
{public:stringminWindow(strings,stringt){unordered_mapneed,window;for(charc:t)need[c]++;
Python ml
·
2024-02-12 10:27
LeetCode
算法
数据结构
55. 跳跃游戏
class
Solution
{public:boolcanJump(vector&nums){intlen=nums.size(),maxJump=0;for(inti=0;imaxJump){maxJump
Python ml
·
2024-02-12 10:57
LeetCode
游戏
算法
c++
leetCode 72. 编辑距离 hard 动态规划
添加链接描述#include#includeusingnamespacestd;class
Solution
{public:intminDistance(stringword1,stringword2){
Python ml
·
2024-02-12 10:56
LeetCode
c++
算法
动态规划
1306. 跳跃游戏 III
经过测试,两种写法耗时差距10倍,我也不知道原因是啥用访问次数的是更快的class
Solution
{public:intn;booldfs(vector&arr,intstart,vector&visited
Python ml
·
2024-02-12 10:55
LeetCode
游戏
算法
深度优先
221. 最大正方形
221.最大正方形题目链接:221.最大正方形代码如下://动态规划//参考官方leetcode题解class
Solution
{public:intmaximalSquare(vector>&matrix
咔咔咔的
·
2024-02-12 10:49
leetcode
c++
1277. 统计全为 1 的正方形子矩阵
1277.统计全为1的正方形子矩阵题目链接:1277.统计全为1的正方形子矩阵代码如下:class
Solution
{public:intcountSquares(vector>&matrix){if(matrix.size
咔咔咔的
·
2024-02-12 10:18
leetcode
c++
【力扣】刷题备忘录-动归-63. 不同路径 II
63.不同路径IIclass
Solution
{public:intuniquePathsWithObstacles(vector>&obstacleGrid){intm=obstacleGrid.size
Branton_Zhenyuan
·
2024-02-12 10:15
力扣备忘录
leetcode
算法
【力扣】刷题备忘录-动归-343. 整数拆分
343.整数拆分class
Solution
{public:intintegerBreak(intn){vectordp(n+1);dp[2]=1;for(inti=3;idp(n+1);dp[2]=1;
Branton_Zhenyuan
·
2024-02-12 10:15
力扣备忘录
c++
leetcode
【力扣】刷题备忘录-动归-96. 不同的二叉搜索树
class
Solution
{public:intnumTrees(intn){vectordp(n+1);dp[0]=1;for(inti=1;i<=n;i++){for(intj
Branton_Zhenyuan
·
2024-02-12 10:15
力扣备忘录
算法
c++
Day04 链表part02
while的终止条件,合理利用and进行判断,假如第一个成立会判断第二个2.删除链表的倒数第n-1个结点独立写出了需要遍历两次的代码,代码需要先确定链表的个数size,再利用size-n来循环class
Solution
临渊羡鱼的猫
·
2024-02-12 09:33
代码随想录一刷
链表
数据结构
【力扣每日一题】力扣236二叉树的最近公共祖先
思路分析代码实现publicclass
Solution
{publicTreeNodelowestCommonAncestor(Tre
写做四月一日的四月一日
·
2024-02-12 08:16
leetcode
算法
java
【力扣每日一题】力扣144二叉树的前序遍历
代码实现java实现java使用递归实现publicclass
Solution
{Listres=newArrayListpreorderTraversal(TreeNoderoot){if(root==
写做四月一日的四月一日
·
2024-02-12 08:16
leetcode
算法
java
c++
【力扣每日一题】力扣94二叉树的中序遍历
代码实现java实现java使用迭代方式实现publicclass
Solution
{publicListinorderTraversal(TreeNoderoot){Listres=newArrayListstack
写做四月一日的四月一日
·
2024-02-12 08:15
leetcode
算法
java
c++
力扣 第 383 场周赛 解题报告 | KMP
T1修改矩阵思路:模拟时间复杂度:O(mn)O(mn)O(mn)class
Solution
:defmodifiedMatrix(self,matrix:List[List[int]])->List[List
上烟雨心上尘
·
2024-02-12 07:19
题解
leetcode
算法
职场和发展
代码随想录算法训练营第四十七天(动态规划篇)| 416. 分割等和子集
416.分割等和子集题目链接:416.分割等和子集-力扣(LeetCode)思路回溯——超时首先想到之前的回溯算法,寻找数组中加和等于sum(nums)/2的子集,但对于大数组超时了:class
Solution
Huiwen_Z
·
2024-02-12 07:24
代码随想录训练营
算法
动态规划
python
leetcode
72. 编辑距离
72.编辑距离题目链接:72.编辑距离代码如下://动态规划//参考leetcode官方题解class
Solution
{public:intminDistance(stringword1,stringword2
咔咔咔的
·
2024-02-12 07:50
leetcode
c++
整数转罗马数字
V对应5,X对应10,L对应50,C对应100,D对应500,M对应1000示例:输入:1994输出:"MCMXCIV"解释:M=1000,CM=900,XC=90,IV=4.java代码:class
Solution
windUtterance
·
2024-02-12 06:18
ABC335C - Loong Tracking
problemlinkAbruteforce
solution
tothisproblemwouldbemodifyingallnnnbodypartswitheachmove.However,onemightnoticethatwedon
PYL2077
·
2024-02-12 05:57
AtCoder
题解
算法
AtCoder Beginner Contest 340C - Divide and Divide
problemlinkNaively,abruteforcerecursion
solution
beimplementedwithO(n)\mathcalO(n)O(n)complexity.intwork
PYL2077
·
2024-02-12 05:24
题解
AtCoder
算法
二叉树的遍历(递归/非递归)
前序class
Solution
{public:std::vectorvec;vectorpreorderTraversal(TreeNode*root){if(nullptr==root)returnvec
HVACoder
·
2024-02-12 04:30
算法
day2-数组part02| 977.有序数组的平方、 209.长度最小的子数组、 59.螺旋矩阵II
977.有序数组的平方思路数组平方后的最大值只可能在数组两端,不可能在中间设置双指针,比较两个指针所指值的大小,记录较大值,接着向中间移动这个指针结束条件:左右指针相背class
Solution
{public
dugindeep
·
2024-02-12 03:50
算法
leetcode
代码随想录算法训练营第28天 | 93.复原IP地址 78.子集 90.子集II
class
Solution
{public:vectorresult;boolisValid(strings,intstart,intend){if(star
纵使啰嗦始终关注
·
2024-02-12 03:18
算法
leetcode019(链表) 删除链表的倒数第N个节点
注意:题目的测试用例是没有空的头节点的,head直接指向第一个节点My
solution
publicclassSoluti
longls777
·
2024-02-12 03:41
力扣:455. 分发饼干
class
Solution
{publicintfindContentChildren(int[]g,int[]s){//计数的变量intsum=0;//排列胃口数
AnDanXingKo
·
2024-02-12 02:57
贪心
leetcode
算法
java
代码随想录算法训练营第二十九天 | 491.递增子序列、46.全排列、47.全排列 II
题解class
Solution
{public:vector>res;vectorpath;voidb
jjjj的笔记本
·
2024-02-12 01:46
算法
算法
leetcode
数据结构
代码随想录算法训练营补打卡 day29| 491.递增子序列、46.全排列、47.全排列 II
代码class
Solution
{List>results=newArrayList>();Listpath=newArrayList();publicList>findSubsequences(int[
qq_42591713
·
2024-02-12 01:46
算法
java
leetcode
算法随想录第五十一天打卡|309.最佳买卖股票时机含冷冻期, 714.买卖股票的最佳时机含手续费 ,总结
class
Solution
(object):defmaxProfit(self,prices):length
星曜366
·
2024-02-12 01:15
算法
[自我记录]随想录刷题第四十五天 | 300. 最长递增子序列, 674. 最长连续递增序列, 718. 最长重复子数组
代码随想录算法打卡第四十五天,新手自我记录一下刷题历程,仅为自我打卡使用.300.最长递增子序列class
Solution
{public:intlengthOfLIS(vector&nums){if(nums.size
快毕业的中狗
·
2024-02-12 01:15
刷题打卡自我记录
算法
leetcode
c++
算法随想录第五十二天打卡|300.最长递增子序列 , 674. 最长连续递增序列 , 718. 最长重复子数组
class
Solution
(object):defleng
星曜366
·
2024-02-12 01:14
算法
算法随想录第五十天打卡123.买卖股票的最佳时机III , 188.买卖股票的最佳时机IV
|LeetCode:123.买卖股票最佳时机III_哔哩哔哩_bilibili代码随想录class
Solution
(object):defmaxProfit(self,prices):iflen(prices
星曜366
·
2024-02-12 01:44
算法
子集型回溯和组合型回溯
枚举选哪个组合1.选或不选2.枚举选哪个回溯问题有两种思考方式,一种是对于给定集合的每个元素,你是选还是不选,另一种是每个位置必须选一个数,你挑一个选就行了.但这种挑选一定是有序的挑子集子集1,选或不选class
Solution
像风一样_
·
2024-02-12 00:57
深度优先
算法
leetcode
22.括号生成
每个位置只有两种状态,左括号或有括号,正好对应选与不选左括号两种情况,但要加约束条件,左括号的数量小于n,且有括号不能多于左括号(因为括号要配对,有括号多了,后面再加左括号也不能配对)class
Solution
像风一样_
·
2024-02-12 00:57
c++
算法
深度优先
详细介绍Python网络编程模块
,它是所有互联网协议的基础,其中ICMP(InternetControlMessageProtocol)、IGMP(InternetGroupManageProtocol)、ARP(AddressRe
solution
Protocol
hakesashou
·
2024-02-11 23:13
python基础知识
网络
面试题-01.01-判定字符是否唯一
Python3代码:class
Solution
:defisUnique(self,astr:str)->bool:#ans={}
阿凯被注册了
·
2024-02-11 23:22
Reverse Integer
reversedigitsofaninteger.Example1:Input:123Output:321Example2:Input:-123Output:-321Example3:Input:120Output:21intreserve除数模class
Solution
瞬铭
·
2024-02-11 23:31
力扣 6192.公因子的数目
运行结果:代码展示:class
Solution
{publicintcommonFactors(inta,intb){intsum=0;if(a<=b){for(inti=1;i<=a/2;i++){if
wsy`
·
2024-02-11 23:41
力扣
java
开发语言
上一页
4
5
6
7
8
9
10
11
下一页
按字母分类:
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
其他