- 博客(7)
- 收藏
- 关注
转载 C++string类常用函数
C++string类常用函数 转载自http://www.cppblog.com/lmlf001/archive/2006/04/19/5883.html string类的构造函数: string(const char *s); //用c字符串s初始化 string(int n,char c); //用n个字符c初始化 此外,string类还支持默认构造函数和复制构造函数,如
2017-05-17 09:12:59 333
原创 leetcode上面难度hard题
N-Queens N皇后问题,输出全部解 判断函数 bool isvalid(int row,int col,int N,vector &record)//判断是否能够放置 { for(int i=0;i<N;i++) { if(record[i] == col || abs(i-row) == abs(record[i]-col))
2017-05-15 21:38:49 1152
原创 Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to reac
2017-05-11 19:59:09 227
原创 leetcode没做出来看答案的题
暴露出一个很严重的问题就是对stl的应用并不是非常得熟练 49. Group Anagrams Given an array of strings, group anagrams together.For example, given: [“eat”, “tea”, “tan”, “ate”, “nat”, “bat”], Return:[ [“ate”, “eat”,”tea”],
2017-05-08 22:03:56 4795
原创 刷leetcode过程中记录难度题,自己做法及最优做法
leetcode 41. First Missing Positive Given an unsorted integer array, find the first missing positive integer.For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2.Your algorithm should run in
2017-05-05 19:23:07 427
原创 平衡二叉树的实现
转载自http://www.cppblog.com/cxiaojia/archive/2012/08/20/187776.html 但是由于原文的代码有错,评论区很多人表示代码有误,跑不通 我自己手打了一遍,并进行了完善,自己测试插入和删除都无误,查找很简单就没写。 第一步树的节点 这里相比于二叉排序树多了高度信息,来维护平衡性//平衡二叉查找树节点 template<class T> cl
2017-04-19 09:18:36 317
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人