- 博客(12)
- 收藏
- 关注
原创 堆
堆是一种数组对象,维基百科。堆实现代码:#include#include#includeusing namespace std;int heap_size;inline int LEFT(int i){ return 2 * i + 1;}inline int RIGHT(int i){ return 2 * (i + 1);}void display(int a
2016-04-28 11:18:07 199
原创 leetcode80. Remove Duplicates from Sorted Array II
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3], Your function should return length = 5, with the first five
2016-04-27 22:50:46 256
原创 leetcode26.RemoveDuplicatesfromSortedArray
Given a sorted array, remove the duplicates in place such that each element appear onlyonce and return the new length.Do not allocate extra space for another array, you must do this in place with
2016-04-27 22:29:14 257
原创 笔试有感
好多东西似是而非,操作系统需要重新看看了,还有计算机网络,很多算法感觉还是写得时候很陌生,经验教训,还有一年,加油吧。while (cin >> n){}#include#includeusing namespace std;int main(){ string s; while (getline(cin,s)) { cout << s << endl; }
2016-04-25 21:19:35 197
原创 leetcode16.3SumClosest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly
2016-04-23 11:03:46 283
转载 SVM的几个好的博客地址
http://www.cnblogs.com/liqizhou/archive/2012/05/11/2495788.htmlhttp://blog.csdn.net/v_july_v/article/details/7624837
2016-04-22 18:33:30 366
原创 leetcode15.3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c)
2016-04-21 15:59:55 276
原创 leetcode12.IntegerToRoman&&RomanToInteger
1.Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.本题目主要讲解罗马数字与十进制数字的转化。第一个为给定一个十进制数字,转化为罗马数字。先了解一下罗马数字的格式。1~9: {"I", "II",
2016-04-21 14:41:17 298
原创 leetcode11.ContainerWithMostWater
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two
2016-04-20 11:12:54 285
原创 leetcode10.RegularExpressionMatching
'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input string (not partial).The function prototype should be:bool isMatch
2016-04-17 17:20:17 336
原创 leetcode5.LongestPalindromicSubstring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.解题思路:给定一个字符串,求这个字符
2016-04-14 19:45:12 333
原创 leetcode189.RotateArray
Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note:Try to come up as many solutions as you can, t
2016-04-07 15:41:35 274
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人