自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(127)
  • 资源 (11)
  • 收藏
  • 关注

原创 Leetcode 之 Interleaving String

原题:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbba

2013-12-31 17:42:29 685

原创 LeetCode 之 Set Matrix Zeroes

原题:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution

2013-12-31 00:19:27 726

原创 c++ 字符串

c++中的字符串有多种表示方法,先把char[]和char*总结一下char* str1 = "abcd" 一般这种,书上都会说后面自动加了一个null和char str1[]="abcd"一样,以及char str1[]={'a','b','c','d','\0'}一样,如果char str1[]={'a','b','c','d'}就缺了一个null既然char* str1="abcd"

2013-12-30 01:16:02 754

原创 c++ int 的范围

c++的int一般是4个字节,这个可以用sizeof(int)来判断int 用补码表示,补码表示中负数比正数多一个,最大值为2147483647 最小的数为 -2147483648,那么为什么为多一个数呢,就是0的表示,只有+0才是正常的,-0被移做最小的那个int了。符号为0为正,1为负,所以正数的最大值为11111111111,那么当这个最大的数加一有神马情况呢?就是变成了000000

2013-12-30 00:07:07 17696 1

原创 leetCode 之 String to Integer (atoi)

原题:Implement atoi to convert a string to an integer.题目很好理解,就是把一个字符串转成一个int,主要是有这么几种情况要考虑:1 正负号2 空格3 字母  123a44,这种,就返回123;a123,就返回04 溢出   int保存的范围是 -2147483648   ~  2147483647

2013-12-29 21:39:13 688

原创 LeetCode 之 Longest Substring Without Repeating Characters

i原题:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is

2013-12-29 00:52:48 596

原创 LeetCode 之 Triangle

原题:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3

2013-12-27 23:37:33 662

原创 LeetCode 之 Distinct Subsequences

原题:Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (c

2013-12-27 00:14:04 653

原创 LeetCode 之 Partition List

原题:Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes i

2013-12-26 13:48:02 597

原创 LeetCode 之 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 O(n)>

2013-12-26 00:23:33 643

原创 LeetCode 之 Edit Distance

原题:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted

2013-12-24 00:20:20 621

原创 LeetCode 之 Letter Combinations of a Phone Number

Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.这个题其实就是一个深度搜索,假如

2013-12-19 16:26:08 600

原创 LeetCode 之 Recover Binary Search Tree

原题:Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pretty straight forward. Could

2013-12-18 15:18:49 713

原创 LeetCode 之 Longest Consecutive Sequence

原题:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is

2013-12-18 13:00:28 572

原创 LeetCode 之 Reorder List

原题:Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reord

2013-12-14 23:55:51 566

原创 leetCode 之 Longest Common Prefix

原题:Write a function to find the longest common prefix string amongst an array of strings.找所有字符串的公共前缀,很简单,只要挨个比较就行了,就是长度不一样的时候,要判断一样,否则会出错。另外,注意c++string的操作,在string后添加一个字符用push_back就行,这个和vector

2013-12-12 11:25:49 549

原创 LeetCode之Construct Binary Tree from Preorder and Inorder Traversal

这个题和由中序和后序构建二叉树基本一样,看看就行了。。。。LeetCode 之 Construct Binary Tree from Inorder and Postorder Traversal代码(136ms):class Solution {public: TreeNode *buildTree(vector &preorder, vector &inorder) {

2013-12-12 09:45:50 76

原创 LeetCode 之 Construct Binary Tree from Inorder and Postorder Traversal

原题:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.这个题其实不算难,就是在边界判断的时候较麻烦对每个中序遍历inOrder和后续遍历

2013-12-12 00:05:24 745

原创 LeetCode 之 Max Points on a Line

原题:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.做这个题首先需要注意特殊情况,一是两个点相同,二是x相同,y不同,即斜率无穷大,double可以用std::numeric_limits::infinity()表示解题思路:

2013-12-10 16:29:33 683

原创 LeetCode 之 Add Binary

这个题还是比较简单的,就是需要代码的简洁,用两个index分别指向两个字符串,用一个carry保存进位,由于index需要判断出界,开始准备用好几种情况分别讨论,后来发现只判断两个index是否同时越界,如果有一个没越另一个越了,就让另一个为'0'就行。同时注意char和int的转化,由于string中的char只可能是'0'或'1',用char减去'0'就得到最后转化后的int值。另外对st

2013-12-09 16:10:09 619

原创 LeetCode 之 Word Break

原题:Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict

2013-12-08 16:57:27 623

原创 LeetCode 之 Word Ladder

原题:Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach intermediate wor

2013-12-07 22:28:55 890

原创 LeetCode 之 Convert Sorted Array to Binary Search Tree

原题:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.把一个有序数组转成搜索树,很简单,数组中间的当root,左半边作为root->left;右半边作为root->right。这个就是在做的时候遇到了一个问题,就是指针的传递,由于c++中

2013-12-06 16:47:00 542

原创 LeetCode 之 Symmetric Tree

原题:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3

2013-12-05 22:54:24 606

原创 LeetCode 之 Remove Duplicates from Sorted List

原题:Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.本题就是要删除所有的重复的数

2013-12-05 19:54:21 859

原创 LeetCode 之 Balanced Binary Tree

原题:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node ne

2013-12-05 17:41:58 652

原创 LeetCode 之 Unique Binary Search Trees

原题:Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2

2013-12-04 15:03:41 593

原创 LeetCode 之 Median of Two Sorted Arrays

原题:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).这个题是求两个有序数组的中间数,其实这个中间数,如果是奇数,

2013-12-01 03:24:43 897

原创 LeetCode 之 Decode Ways

原题:A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine

2013-11-29 00:35:48 796

原创 leetCode 之 Subsets

原题:Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For

2013-11-22 01:43:17 790

原创 LeetCode 之 Gas Station

原题:There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from stat

2013-11-21 23:28:33 938

原创 Leetcode 之 Reverse Linked List II

原题:Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note:Given m, n sati

2013-11-18 23:58:03 1370 1

原创 LeetCode 之 Count and Say

原题:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read

2013-11-17 02:00:45 1335

原创 LeetCode 之 Binary Tree Postorder Traversal

原题:Given a binary tree, return the postorder traversal of its nodes' values.二叉树后序遍历,可以看看先序和中序直接上代码(20ms):class Solution {public: vector postorderTraversal(TreeNode *root) { // IMP

2013-11-16 22:08:32 797

原创 LeetCode 之 Binary Tree Level Order Traversal II

原题:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,#,

2013-11-16 20:16:09 765

原创 LeetCode 之 Binary Tree Inorder Traversal

原题:Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3},return [1,3,2].二叉树的中序遍历,废话不说,和先序遍历几乎一样代码(24ms):class Solution {pu

2013-11-16 20:01:20 775

原创 LeetCode 之 Binary Tree Preorder Traversal

原题:Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3},return [1,2,3].二叉树的先序遍历,用递归很简单代码(20ms):class Solution {

2013-11-16 19:36:09 791

原创 LeetCode 之 Binary Tree Level Order Traversal

原题:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).这个题其实就是二叉树的层次遍历,跟前边的这个题基本类似Populating Next Right Pointers in Each Node

2013-11-16 17:24:21 867

原创 LeetCode 之 Best Time to Buy and Sell Stock II

原题Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie,

2013-11-16 15:38:02 819

原创 LeetCode 之 Sum Root to Leaf Numbers

原题:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Fi

2013-11-15 17:05:57 819

大象thinking in UML

经典的UML学习书籍,内容完整,清晰,是中文扫描版的

2012-05-22

hs0038B数据手册

hs0038B数据手册 英文的 需要的朋友下吧

2011-06-09

java c++ 笔试面试题目

自己收集的招聘时的笔试面试题,对找工作很有利啊

2009-11-06

天下没有难学的linux

学习linux的入门书籍,从安装开始,手把手教学阿

2009-10-31

Virsual C++ 高级界面制作百例

Virsual C++ 制作高级界面的例子,很实用,对界面制作很有启发

2009-09-26

opencv-index

opencv的使用说明,很好很强大,适合opencv初学者

2009-09-26

天大的C++ 和数据结构的ppt

天大很好的ppt,C++和数据结构,其中c++是外教教的

2009-09-25

masm615 Inter汇编

这是Inter汇编语言的附带光盘,其中有masm615的安装程序,希望对大家有帮组

2009-09-23

用汇编语言写的五子棋

这是用汇编自己写的一个五子棋,最好用masm615编译

2009-09-23

空空如也

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

TA关注的人

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