自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 资源 (2)
  • 收藏
  • 关注

原创 Remove Duplicates from Sorted Array

题目明确指出了对空间复杂度的限制,而且还隐含了对时间复杂度的限制。

2014-04-10 15:44:16 394

原创 Set Matrix Zeroes

class Solution {public: void setZeroes(vector > &matrix) { int rows = matrix.size(); if(rows == 0) return; int cols = matrix[0].size(); vector rowLabel(row

2014-04-10 14:56:58 504

原创 Partition List

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *pa

2014-04-10 10:23:11 539

原创 Search a 2D Matrix

class Solution {public: bool searchMatrix(vector > &matrix, int target) { int rowNum = insertPosition(matrix, target); if(rowNum == -1) return true; else r

2014-04-09 16:49:08 644

原创 Balanced Binary Tree

/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Soluti

2014-04-09 15:51:33 425

原创 Pow(x, n)

class Solution {public: double pow(double x, int n) { if(n == 0) return 1; if(n < 0) { if(isEven(n)) return pow(x * x, n/2); el

2014-04-09 10:02:16 350

原创 Climbing Stairs

class Solution {public: int climbStairs(int n) { if(n == 0) return 0; if(n == 1) return 1; if(n == 2) return 2; return climbStairs(n - 1) +

2014-04-08 22:44:43 415

原创 Rotate Image

class Solution {public: void rotate(vector > &matrix) { int n = matrix.size(); vector > newMatrix(n, vector(n, 1)); for(int i = 0; i < n; i++) { for(in

2014-04-08 22:16:16 493

原创 Swap Nodes in Pairs

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *sw

2014-04-08 20:32:14 365

原创 Unique Paths

class Solution {public: int uniquePaths(int m, int n) { if(m == 0 || n == 0) return 0; if(m == 1 || n == 1) return 1; return uniquePaths(m - 1, n) + unique

2014-04-08 17:09:09 406

原创 Convert Sorted Array to Binary Search Tree

/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Soluti

2014-04-08 14:00:42 400

原创 Remove Duplicates from Sorted List

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *de

2014-04-08 09:51:19 428

原创 Gray Code

关于格雷码的求解主要有两类方法,一类s

2014-04-08 09:06:46 531

原创 Merge Sorted Array

class Solution {public: void merge(int A[], int m, int B[], int n) { if(n == 0) return; if(m == 0) { for(int i = 0; i < n; i++) {

2014-04-07 15:23:58 499

原创 Leetcode Maximum Subarray

class Solution { public: int maxSubArray(int A[], int n) { int thisSum = 0; int maxSum = INT_MIN; for(int i = 0; i < n; i++) { if(thisSum < 0) thi

2014-04-04 17:48:43 412

原创 Merge Two Sorted Lists

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *mergeTwoLists(ListNode *l1,

2014-04-04 15:24:22 397

转载 typedef 和 define的区别

typedef和#define的用法与区别 一、typedef的用法在C/C++语言中,typedef常用来定义一个标识符及关键字的别名,它是语言编译过程的一部分,但它并不实际分配内存空间,实例像:typedef    int       INT;typedef    int       ARRAY[10];typedef   (int*)   pINT;typedef

2013-10-23 15:20:04 412

转载 VIM命令退出

注意:这些命令前面都有一个冒号:当编辑完文档,准备退出Vi返回到shell时,能够使用以下几种方法之一。在命令模式中,连按两次大写字母Z,若当前编辑的文档曾被修改过,则Vi保存该文档后退出,返回到shell;若当前编辑的文档没被修改过,则Vi直接退出, 返回到shell。在末行模式下,输入命令 :wVi保存当前编辑文档,但并不退出,而是继续等待用户输入命令。

2013-10-09 10:05:12 394

原创 linux实用快捷键

[tab][tab] 接在一串命令的第二个字后面,则为命令补全[tab] 接在一串指令的第二个字后面,则为档案补齐 [Ctrl]-c中断当前程序执行 [Ctrl]-d键盘输入结束,也可替代exit 退出terminal

2013-09-05 16:26:40 387

effective c++ (中文第三版带书签)

effective c++的影印版,内容完整,且相当清晰,自己添加的书签,很好用哦!

2012-12-01

ogre 官网示例程序大全

官网上可运行的例子,包含了源代码以及相关的资源文件。希望可以对初学者有所帮助

2012-04-03

空空如也

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

TA关注的人

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