自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(57)
  • 资源 (4)
  • 收藏
  • 关注

原创 Sort 中 compare 函数的改写

sort是STL中的函数, 最常见的用法是将数组按照di

2014-10-29 22:01:43 1798

原创 leetcode Longest Common Prefix

代码class Solution {public: string longestCommonPrefix(vector &strs) { string result = ""; int n = strs.size(); if(n==0) return result; for(in

2014-10-29 21:21:17 335

原创 leetcode 3Sum Closest

代码class Solution {public: int threeSumClosest(vector &num, int target) { int res = 0; int size = num.size(); sort(num.begin(), num.end()); int minDi

2014-10-29 21:09:40 317

原创 leetcode 3Sum

参考代码class Solution {public: vector > threeSum(vector &num) { vector > res; vector temp; int size = num.size(); if(size<3) return res;

2014-10-29 20:13:00 425

原创 leetcode Two Sum

此题新建一个含有两个变量的结构体,代码

2014-10-29 19:43:48 404

原创 leetcode String to Integer (atoi)

此题思路很简单,但需要注意一些特殊情况,例如kong'g

2014-10-29 18:57:17 401

原创 leetcode Integer to Roman

代码class Solution {public: string intToRoman(int num) { if(num3999) return ""; int digit = 1000; vector digits; while(digit>0)

2014-10-29 17:01:32 285

原创 leetcode

利用动态规划参考 代码class Solution {public: string longestPalindrome(string s) { int length = s.length(); if(length<=1) return s; bool flag[length][lengt

2014-10-29 16:24:23 301

原创 leetcode Longest Substring Without Repeating Characters

此题can代码class Solution {public: int lengthOfLongestSubstring(string s) { int res = 0; int size = s.length(); if(size==0) return res;

2014-10-29 15:58:07 285

原创 leetcode Generate Parentheses

采用递归算法代码class Solution {public: vector generateParenthesis(int n) { string tempResult; vector result; generateParenthesisHelper(result, tempResult, n, n);

2014-10-29 12:58:44 381

原创 leetcode Add Two Numbers

此题是链表中的两数相加,注意细节方法,每一个链表中的数zhi'you

2014-10-29 12:37:43 408

原创 streamstring用法介绍

使用streamstring做string与int之间的转换头文件为

2014-10-27 21:04:57 5003

原创 leetcode Count and Say

代码class Solution {public: string countAndSay(int n) { string s = ""; if(n==0) return s; for(int i = 1; i <= n; ++i) s = countAn

2014-10-27 20:43:04 406

原创 leetcode Valid Parentheses

代码class Solution {public: bool isValid(string s) { int length = s.length(); if(length==0) return true; stack brackets; for(int i =

2014-10-27 20:05:02 309

原创 leetcode Swap Nodes in Pairs

解决此题方法,每次选取两个node改变ta'e

2014-10-27 19:51:39 379

原创 leetcode Remove Nth Node From End of List

根据题目要求, 可以设置两个指针,slow和fast,fast先走n步,

2014-10-27 19:23:34 346

原创 leetcode Palindrome Number

分别计算首位和末位,比较是否相同,若存在不相同,则返回false;

2014-10-27 18:24:57 276

原创 leetcode Container With Most Water

首先想到的方法是两层循环,分别计算取最大值,时间复杂度O(n)

2014-10-27 16:44:56 368

原创 leetcode Find Minimum in Rotated Sorted Array II

参考http://blog.csdn.net/linhuanmars/article/details/40449299代码class Solution {public: int findMin(vector &num) { if(num.size()==0) return 0; int l =

2014-10-25 22:34:47 289

原创 leetcode Find Minimum in Rotated Sorted Array

典型的二分查找类型,ci'ti'xu'yao

2014-10-25 21:41:43 367

原创 leetcode Search in Rotated Sorted Array II

此题参考 http://blog.csdn.net/linhuanmars/article/details/20588511

2014-10-25 20:51:15 314

原创 leetcode Search in Rotated Sorted Array

此题同样需要二分法来解决, 但是在pan'duan

2014-10-25 20:10:28 356

原创 leetcode Search for a Range

题目要求O(lgn)的时间复杂度,可知需要利用二分法来解决代码

2014-10-25 19:34:00 310

原创 leetcode Next Permutation

代码class Solution {public: void nextPermutation(vector &num) { int length = num.size()-1; while(length>0) { if(num[length-1] < nu

2014-10-25 18:59:12 305

原创 leetcode Implement strStr()

strStr() 函数实现的功能为

2014-10-25 16:47:48 274

原创 leetcode Sudoku Solver

参考代码class Solution {public: void solveSudoku(vector > &board) { for(int i = 0; i < 9; ++i) for(int j = 0; j < 9; ++j) { if(board[i][j]

2014-10-22 20:09:38 267

原创 leetcode Valid Sudoku

此题参考 http://www.cnblogs.com/TenosDoIt/p/3800485.html

2014-10-22 19:46:38 360

原创 leetcode Multiply Strings

代码class Solution {private: int shiftLeftNum;public: string multiply(string num1, string num2) { string res; int len1 = num1.length(); int len2 = num2.length(

2014-10-22 19:13:00 343

原创 leetcode N-Queens

任然是NP问题,解决此类问题主要思想就是

2014-10-21 22:08:16 349

原创 leetcode Combination Sum VS Combination Sum II

利用递归进行ombination Sum VS Combination Sum II 两题解法十分相似, 区别仅在于是否可以

2014-10-21 19:58:14 374

原创 leetcode Trapping Rain Water

分别找到每一个bar左右最高的

2014-10-21 18:51:41 327

原创 VS2012+Opencv246 配置

首先下载opencv并解压,解压的路径设为 D:

2014-10-20 21:54:36 1376

原创 VS2012+OpenCV246 读入图片并修改像素值

代码#includeusing namespace cv;int main(){ IplImage* srcImage = cvLoadImage("HEVCStructureInfo#13.png"); if(srcImage==NULL) return -1; IplImage* dstImage ; dstImage = cvCloneImage(src

2014-10-20 21:36:14 874

原创 leetcode Remove Element

class Solution {public:int removeElement(int A[], int n, int elem) {if(n==0)return 0;for(int i = n-1; i>=0; --i){if(elem==A[i]){for(int j = i; j {A[j] = A[j+1];}n--;}}

2014-10-15 21:23:34 263

原创 leetcode Anagrams

刚开始没有理解这一题的意思,本t

2014-10-15 20:56:48 359

原创 leetcode Pow(x,n)

此题需要注意的是n的tclass Solution {public: double pow(double x, int n) { if(n==0) return 1; if(n==1) return x; double temp = pow(x, abs(n/2));

2014-10-15 20:32:44 292

原创 leetcode Rotate Image

可以将图片看成二维矩阵,

2014-10-15 19:51:34 243

原创 leetcode Permutations II

参考博客http://www.cnblogs.com/tenosdoit/p/3662644.html

2014-10-15 19:38:32 369

原创 leetcode Permutations

利用递归算法代码

2014-10-15 17:27:07 297

原创 知识点总结(补充版)

1,printf 函数计算参数时是从右向左

2014-10-15 12:31:48 378

BDBRvsBDPSNR计算Excel

BDBRvsBDPSNR计算 Excel形式

2015-01-19

数字图像处理软件

此软件实现了一些经典的图像处理放法 包括 中值均值滤波 傅里叶变换 图像细化 添加高斯椒盐噪声 腐蚀膨胀 代码注释较为详细

2014-06-17

Qt Creator快速入门 代码

Qt Creator 快速入门 代码 每章都有,很详细。

2014-01-17

Qt及Qt Quick开发实战精解代码

Qt及Qt Quick开发实战精解代码 很详细

2014-01-17

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除