自定义博客皮肤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)
  • 资源 (4)
  • 收藏
  • 关注

转载 Valid Number

class Solution {public: bool isNumber(const char *s) { int transition[9][6] = { -1, 0, 3, 1, 2, -1, // next states for state 0 -1, 8, -1, 1, 4, 5,

2014-02-27 07:51:07 414

原创 Minimum Path Sum

DP:class Solution {public: int minPathSum(vector > &grid) { int m=grid.size(); if (!m) return 0; int n=grid[0].size(); vector > res(grid); for (int i=n-2

2014-02-27 06:40:34 336

原创 Path Sum

Root to leaf sum.I:class Solution {public: bool hasPathSum(TreeNode *root, int sum) { if (!root) return false; if ((!root->left) && (!root->right) && root->val==sum) return tr

2014-02-15 14:48:09 355

原创 Binary Tree Maximum Path Sum

Solve it recursively. Given that the value of nodes could be negative, there are 4 situations:1) root node only,2) root node + left child3) root node +right child4) root node + left chil

2014-02-15 14:06:09 315

原创 Permutation Sequence

这个题,看了别人的代码,还改了半天,过两天要再写一遍。。555。。。class Solution {public: const int fact[10]={1,1,2,6,24,120,720,5040,40320,362880}; string getPermutation(int n, int k) { if (nfact[n]) return "";

2014-02-15 03:49:30 285

原创 Merge Intervals & Insert Interval

/** * Definition for an interval. * struct Interval { * int start; * int end; * Interval() : start(0), end(0) {} * Interval(int s, int e) : start(s), end(e) {} * }; */ bool co

2014-02-13 12:13:50 343

原创 Spiral Matrix

class Solution {public: vector spiralOrder(vector > &matrix) { vector res; if (matrix.size()==0) return res; int sx=0, sy=0, ex=matrix[0].size()-1, ey=matrix.size()-1;

2014-02-12 13:58:55 316

原创 Wildcard Matching

Recursion may cause exceed time limited.class Solution {public: bool isMatch(const char *s, const char *p) { if (*p == '*'){//return true; while(*p == '*') ++p;

2014-02-12 03:17:58 357

原创 N-Queens

class Solution {public: bool isValid (vector &board, int r, int c) { for (int i=0; i<board.size(); i++) { if (i!=r && board[i][c]=='Q') return false; if (i!=c && b

2014-02-12 02:48:37 356

原创 Anagrams

The words made up by same characters should be in the group. The code cited below uses vector as the second of the map. It's cool!vector anagrams(vector &strs) { vector cc; map > dict;

2014-02-12 01:43:24 303

原创 Multiply Strings

class Solution {public: string multiply(string num1, string num2) { if (num1=="0" || num2=="0") return "0"; string res=""; vector > product(num2.size()); int n=num

2014-02-09 11:51:05 344

原创 Add Binary

Traverse backwardsclass Solution {public: string addBinary(string a, string b) { string res=""; int c=0; int i=a.size()-1, j=b.size()-1; while (i>=0||j>=0||c) {

2014-02-09 10:41:44 306

原创 Rotate Image

class Solution {public: void rotate(vector > &matrix) { int i=0, j=0, n=matrix.size(); while(j<n/2) { for (i=0; i<n-2*j-1; i++) { int temp=matrix[i+j][

2014-02-09 09:59:11 337

原创 2/7/14, 40min

OS:1: The difference between process and thread? Can multiple threads/processes share memory? How does synchronization between threads work?2: Where are local variables stored in memory? Ans: Stac

2014-02-08 04:50:02 415

原创 Permutations

class Solution {public: void dfs(vector > &res, int pos, vector &num) { if (pos==num.size()-1) { res.push_back(num); } for (int i=pos; i<num.size(); i++) {

2014-02-07 04:27:41 378

原创 Secret decoder

Your task is to decode messages that were encoded with substitution ciphers. In a substitution cipher, all occurrences of a character are replaced by a different character. For example, in a cipher th

2014-02-06 14:33:39 733

原创 Trapping Rain Water

The amount one element can gather is the difference between it and the shortest one of the highest on both sides. so we calculate the highest one on both sides for each element, taking O(n) time and O

2014-02-04 10:31:55 396

原创 First Missing Positive

To reorder the array so that all the positive elements are on their position, that is, the first element is 1, the second is 2, and so on so forth. Then the first element which A[i]!=i+1 is the one sh

2014-02-04 09:56:54 337

原创 Count and Say

class Solution {public: string num(int count) { string ret=""; while (count) { ret = char(count%10+'0') + ret; count/=10; } return ret;

2014-02-01 08:59:19 413

Cracking the Coding Interview

important book for coding interview, concluding interview suggestions, questions and solutions

2013-01-17

Distributed and Cloud Computing

By Kai Hwang Required book for course EE532 Famous reference in this area

2013-01-17

8086汇编语言指令表

8086汇编语言指令表 包括伪指令 中断向量号等

2011-03-15

汇编语言的学生信息管理系统

汇编语言的学生管理系统,可输入并显示学生姓名 班级 学号 成绩,对成绩进行排序,求平均值

2011-03-15

空空如也

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

TA关注的人

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