自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(38)
  • 资源 (1)
  • 收藏
  • 关注

原创 Leetcode NO.94 Binary Tree Inorder Traversal

本题题目要求如下:Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Re

2015-02-27 14:20:52 374

原创 Leetcode NO.75 Sort Colors

本题题目要求如下:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will us

2015-02-26 09:47:28 633

原创 Leetcode NO.172 Factorial Trailing Zeroes

本题题目要求如下:Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.应该说这算是leetcode里面最简单的一道题了。。基本就是我天朝小学数学的水平。。。。数多少个0其实本质

2015-02-26 07:52:14 330

原创 Leetcode NO.17 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.

2015-02-25 12:36:32 352

原创 Leetcode NO.107 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

2015-02-25 11:41:26 361

原创 Leetcode NO.189 Rotate Array

本题题目要求如下: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

2015-02-25 08:00:47 529

原创 Stanford - Algorithms: Design and Analysis, Part 1 - Week 3 Assignment: Contraction

本题的题目要求如下:Download the text file here. (Right click and save link as)The file contains the adjacency list representation of a simple undirected graph. There are 200 vertices labeled 1 to 200.

2015-02-22 11:29:09 1605

原创 Leetcode NO.110 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 n

2015-02-22 06:51:50 586

原创 Leetcode NO.46 Permutations

题目要求如下:Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].本题

2015-02-20 14:37:32 556

原创 Leetcode NO.47 Permutations II

本题题目要求如下:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[1,1,2], [1,2,1],

2015-02-20 14:07:43 377

原创 Leetcode NO.58 Length of Last Word

本题题目要求如下:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.

2015-02-20 12:05:45 357

原创 Leetcode NO.65 Valid Number

本题题目要求如下:Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statemen

2015-02-20 11:26:38 394

原创 Leetcode NO.9 Palindrome Number

本题题目要求如下:Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinki

2015-02-20 10:01:23 360

原创 Leetcode NO.119 Pascal's Triangle II

本题题目要求如下:Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space?

2015-02-17 14:32:26 394

原创 Leetcode NO.118 Pascal's Triangle

本题题目要求如下:Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]本题就是考vector操作

2015-02-17 07:22:26 315

原创 Leetcode NO.128 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 seque

2015-02-17 06:56:21 358

原创 Leetcode NO.62 Unique Paths

本题题目要求如下:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is tryin

2015-02-17 04:37:15 395

原创 Leetcode NO.96 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

2015-02-17 03:50:51 369

原创 Leetcode NO.72 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 permitt

2015-02-16 13:58:13 489

原创 Leetcode NO.88 Merge Sorted Array

本题题目要求如下:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional

2015-02-13 11:48:39 413

原创 Leetcode NO.41 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) time an

2015-02-13 11:06:41 402

原创 Leetcode NO.66 Plus One

本题题目要求如下:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.这是一道简单题

2015-02-12 08:27:39 410

原创 Leetcode NO.26 Remove Duplicates from Sorted Array

本题题目要求如下:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do thi

2015-02-11 11:06:27 491

原创 Leetcode NO.112 Path Sum

本题题目要求如下:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binar

2015-02-10 09:36:36 403

原创 Leetcode NO.21 Merge Two Sorted Lists

本题题目要求如下:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.这题的算法没有什么好讲的,纯粹是考基本功,就是用linkedlist实现merges

2015-02-09 14:01:04 376

原创 Stanford - Algorithms: Design and Analysis, Part 1 - Week 2 Assignment: QuickSort

本次作业分三道题,但是基本都是差不多的,就是quicksort,题目要求如下:Question 1GENERAL DIRECTIONS:Download the text file here. The file contains all of the integers between 1 and 10,000 (inclusive, with no repeat

2015-02-09 11:35:26 3448

原创 Leetcode NO.90 Subsets II

本道题题目要求如下:Given a collection of integers that might contain duplicates, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must n

2015-02-08 07:00:01 426

原创 Leetcode NO.70 Climbing Stairs

题目要求如下:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?本题也是第二次做,不过这次更加了解

2015-02-07 10:06:45 377

原创 Leetcode NO.63 Unique Paths II

题目要求如下:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectiv

2015-02-07 08:07:01 459

原创 Leetcode NO.171 Excel Sheet Column Number

题目要求如下:Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3

2015-02-06 01:23:13 337

原创 Leetcode NO.39 Combination Sum

本题的题目要求如下:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from 

2015-02-06 01:04:36 450

原创 Leetcode NO.83 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.这是我第二次做这道

2015-02-05 12:17:18 350

原创 Leetcode NO.100 Same Tree

本题题目要求如下:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value

2015-02-04 01:43:01 317

原创 Leetcode NO.77 Combinations

题目要求如下:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3

2015-02-04 00:53:03 382

原创 Leetcode NO.104 Maximum Depth of Binary Tree

题目要求如下:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.本题应该算是Leetcode里面最简单的题之一

2015-02-03 01:45:25 389

原创 Leetcode NO.113 Path Sum II

本题题目要求如下:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5

2015-02-03 01:13:46 402

原创 Leetcode NO.27 Remove Element

本题要求如下:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new

2015-02-02 06:02:51 313

原创 Leetcode NO.59 Spiral Matrix II

本题题目要求如下:Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ],

2015-02-02 05:25:26 449

Algorithm in C++, Part 1 - Part 4

这本书是我们上课时用的教材,质量应该还算不错吧,因为没有看完,只是看上课需要的部分,所以无权评价全部东西。但是本书以及本书作者还是比较有名的,学算法的肯定都知道的。MOOC上讲课的普林斯顿大牛 相比较于传说中经典的Intro to Algorithm,真本书更侧重于算法的C++实现,而非理论,对于纯CS的学生,可以绕道。。但是对于工程类专业,这本书应该是更好的选择。 P.S.如果谁有part 5图论,跟我联系下,求分享。。。另外,如果确实是跟我积分一样少的穷人,联系我,给个邮箱,我发给你。。

2014-02-23

空空如也

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

TA关注的人

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