51
Dev开发社区
首页
文章
问答
工具
搜索
登录
注册
#path
NSIndexPath等结构体的比较
1.NSIndexPath的比较方式,需要将结构体内部的属性一一对比。比如,if((indexPath.section==self.selectIndexPath.section)&&(indexPath.row==self.selectIndexPath.row)){ [cellsetBtnSele...
代码星球
·
2020-10-22
NSIndexPath
结构
比较
leetcode 257. Binary Tree Paths
自己写的一个代码,注意这里判断是否是根节点前,应该把当前节点的value值push_back到res中/***Definitionforabinarytreenode.*structTreeNode{*intval;*TreeNode*left;*TreeNode*right;*TreeNode(intx)...
代码星球
·
2020-10-13
leetcode
257.
Binary
Tree
Paths
leetcode 576. Out of Boundary Paths 、688. Knight Probability in Chessboard
576.OutofBoundaryPaths 给你一个棋盘,并放一个东西在一个起始位置,上、下、左、右移动,移动n次,一共有多少种可能移出这个棋盘https://www.cnblogs.com/grandyang/p/6927921.htmldp表示上一次移动,所有位置的路径数;t表示的是当前移动,所有位置的...
代码星球
·
2020-10-13
leetcode
576.
Out
of
Boundary
leetcode 329. Longest Increasing Path in a Matrix
329.LongestIncreasingPathinaMatrixhttps://www.cnblogs.com/grandyang/p/5148030.html这个题是在二维数组中找递增序列的最长长度。因为使用dfs都是从当前位置进行搜索,所以每次dp计算的值是以当前为起点的最长长度。这里使用了一个二维数组记录每个...
代码星球
·
2020-10-13
leetcode
329.
Longest
Increasing
Path
leetcode 62. Unique Paths 、63. Unique Paths II
62.UniquePathsclassSolution{public:intuniquePaths(intm,intn){if(m<=0||n<=0)return0;vector<vector<int>>dp(m,vector<int>(n));dp[0][0]=1;fo...
代码星球
·
2020-10-13
Unique
Paths
leetcode
II
leetcode 124. Binary Tree Maximum Path Sum 、543. Diameter of Binary Tree(直径)
124.BinaryTreeMaximumPathSumhttps://www.cnblogs.com/grandyang/p/4280120.html如果你要计算加上当前节点的最大path和,这个节点的左右子树必定是纯左右树(即没有拐点),用另一个参数保留整个二叉树的最大path和,然后计算每一个以当前节点为拐点的路...
代码星球
·
2020-10-13
Binary
Tree
leetcode
124.
Maximum
leetcode 112. Path Sum 、 113. Path Sum II 、437. Path Sum III
112.PathSum自己的一个错误写法:classSolution{public:boolhasPathSum(TreeNode*root,intsum){if(root==NULL)returnfalse;intvalue=0;returnhasPathSum(root,sum,value);}boolhasPat...
代码星球
·
2020-10-13
Path
Sum
leetcode
112.
113.
leetcode64. Minimum Path Sum
这个题是从左上角到右下角的路径和最小,实际就是一道dp题。第一种写法是只初始化(0,0)位置,第二种写法则是把第一行、第一列都初始化了。个人更喜欢第二种写法,简单一点。dp的右下角的值就为最终的值第一种写法:classSolution{public:intminPathSum(vector<vector<i...
代码星球
·
2020-10-13
leetcode64.
Minimum
Path
Sum
Unique Paths II
注意一个容易犯的错误:判断obstacleGrid是否为1时,else那部分不能少。因为如果不加,就会默认把那些值设置为0。classSolution{public:intuniquePathsWithObstacles(vector<vector<int>>&obstacleGrid)...
代码星球
·
2020-10-13
Unique
Paths
II
62. Unique Paths
初始化(0,0)classSolution{public:intuniquePaths(intm,intn){vector<vector<int>>result(m,vector<int>(n));result[0][0]=1;for(inti=0;i<m;i++)...
代码星球
·
2020-10-13
Unique
Paths
64. Minimum Path Sum
只初始化(0,0)classSolution{public:intminPathSum(vector<vector<int>>&grid){intheight=grid.size();intwidth=grid[0].size();vector<vector<in...
代码星球
·
2020-10-13
Minimum
Path
Sum
eclipse中,项目有红叉之- The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
1.Thesuperclass"javax.servlet.http.HttpServlet"wasnotfoundontheJavaBuildPath2.原因:确实servlet-api.jar3.导入servlet-api.jar,其中一种方法:项目右击->build path->config...
代码星球
·
2020-10-02
eclipse
项目有
红叉
The
superclass
Golang 无法下载依赖解决方案 unrecognized import path "golang.org/x/net
golangModules依赖管理工具使用:https://blog.csdn.net/weixin_40165163/article/details/90112861Golang无法下载依赖解决方案今天本来想写一下爬虫程序的,所以就用到了"github.com/PuerkitoBio/goquery"这个框架,但是在...
代码星球
·
2020-10-02
Golang
无法
下载
依赖
解决方案
从gopath到go mod的一次尝试
windows下的尝试:gomod初尝试下载官方包1.11(及其以上版本将会自动支持gomod)默认GO111MODULE=auto(auto是指如果在gopath下不启用mod)gomodhelp查看帮助gomodinit<项目模块名称>初始化模块,会在项目根目录下生成go.mod文件。gomodtidy...
代码星球
·
2020-10-02
gopath
go
mod
一次
尝试
告别GOPATH,快速使用 go mod(Golang包管理工具)
如果你还在使用GOPATH模式来开发Golang程序,那么你可以参考本文来告别GOPATH,并带给你一个方便的包管理工具。关于gomod的说明和简单使用,可以参考:1、Go1.1.1新功能module的介绍及使用2、IntroductiontoGoModules3、Go1.11Modules官方说明文档使用gomod管...
代码星球
·
2020-10-02
告别
GOPATH
快速
使用
go
首页
上一页
...
16
17
18
19
20
...
下一页
尾页
按字母分类:
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
其他