自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(101)
  • 资源 (7)
  • 收藏
  • 关注

原创 Split array into two equal sum subArray

@(leetcode)[数组|Google]ProblemA zero-indexed array A consisting of N integers is given. An equilibrium index of this array is any integer P such that 0 ≤ P < N and the sum of elements of lower indices i

2016-08-26 18:02:38 1392

原创 Line reconstruction by height

ProblemSuppose you have a line of n people in which the k-th person is described by a pair (h,t) , where h is the height of the k-th person and t is the number of people in front of k who have a height

2016-08-23 16:03:13 639

原创 Find number of subsets with equal sum

@(leetcode)[动态规划|Google]ProblemGiven a number N ( N > 1), gives a set S = [1,2,..., N]. Divide S in two subsets such that S1 ∪ S2 = S and S1 ∩ S2 = Ø and return the number of subsets with equal sum.Ex

2016-08-23 13:26:47 501

原创 The longest absolute path in file system

The longest absolute path in file system@(leetcode)[字符串|DFS|Google] The string "dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext" represents:dir subdir1 subdir2 file.exta directory dir contains an

2016-08-23 13:07:48 570

原创 Shortest substring containing three short strings

@(leetcode)[字符串, Google]ProblemGiven a long string s and short strings t1, t2, t3 (which can have different length) find the shortest substring of s which contains t1, t2 and t3.Example: s = "abcdefgh

2016-08-22 16:55:10 495

原创 Maximum traffic between city and its neighbors

@(leetcode)[图论|Google]ProblemYou are given a graph with no cycles, each node representing different cities and there are stadiums for baseball games in all cities. Each node contains a value representi

2016-08-22 16:54:17 620

原创 386. Lexicographical Numbers

ProblemGiven an integer n, return 1 - n in lexicographical order.For example, given 13, return:[1,10,11,12,13,2,3,4,5,6,7,8,9].Please optimize your algorithm to use less time and space. The input size

2016-08-21 16:28:49 1411

原创 384. Shuffle an Array

@(leetcode)[数组]ProblemShuffle a set of numbers without duplicates.Example: // Init an array with set 1, 2, and 3. int[] nums = {1,2,3}; Solution solution = new Solution(nums); // Shuffle the

2016-08-21 16:02:53 363

原创 38. Count and Say

ProblemThe count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ...1is read off as "one 1" or 11 11is read off as"two 1s"or21 21is read off as"one 2then

2016-08-21 16:01:57 302

原创 37. Sudoku Solver

ProblemWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character .You may assume that there will be only one unique solution. A sudoku puzzle…Solut

2016-08-21 16:01:08 315

原创 59. Spiral Matrix II

ProblemGiven 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 ], [ 8, 9,

2016-08-21 15:59:54 265

原创 Word Ladder II

Given two words (beginWord and endWord), and a dictionary’s word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:Only one letter can be changed at a time Each i

2016-08-21 15:58:47 357

原创 133. Clone Graph

# @(leetcode)[BFS, 图论]Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ’s undirected graph serialization: Nodes are labeled uniquely.We use # as a sepa

2016-08-21 15:55:35 298

原创 Unique Binary Search Trees II

Unique Binary Search Trees II@(leetcode)[枚举, DFS]Given an integer n, generate all structurally unique BST’s (binary search trees) that store values 1…n.For example, Given n = 3, your program should re

2016-08-21 15:54:36 908

原创 65. Valid Number

65. Valid NumberProblemValidate 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 statement t

2016-08-21 15:52:49 356

原创 Redis数据库实现

Redis服务器将所有数据库都保存在服务器状态redis.h/redisServer结构的db数组中,db数组的每一项都是一个redisDb结构,每个redisDb代表一个数据库。struct redisServer {     redisDb *db;     int dbnum;//该值是由服务器配置的database选项决定,默认值是16};

2016-07-08 17:36:26 383

原创 Redis 对象

Redis并没有直接使用这些基础数据结构实现键值对的数据库,而是基于这些数据结构创建一个对象系统。包括字符串对象,列表对象,哈希对象,集合对象和有序集合对象。     Redis中每个对象都由一个redisObject结构表示,该结构如下:typedef struct redisObject {     unsigned type:4;//类型,记录了对象的类型, 这个类型

2016-06-22 09:55:23 406

原创 Redis 数据结构

Redis 数据结构最近接触到了Redis的使用,借这个机会深入的了解一下Redis的实现和设计原理。下面先介绍一下Redis底层所用到的数据结构。Redis的实现几乎都是基于下面的几个数据结构之上的。1.SDS 结构struct sdshdr {     int len; // 记录数组中已经使用的字节数量,不算结尾的\0     int free;

2016-06-21 22:48:56 344

原创 算法乐趣--三只水桶等分水问题

有一个容积为8升的水桶里装满了水,另外还有一个容积为3升的空桶和一个容积为5升的空桶,如何利用这两个空桶等分8升水?附加条件是三个水桶都没有体积刻度,也不能使用其它辅助容器。        这是一道经典题目,一般人都可以在一分钟内给出答案,不过,很多人可能没有注意到这道题的答案不是唯一的。先来看看最常见的一个答案,也是目前已知最快的操作步骤,共需要7次倒水动作:bucket_sta

2016-01-22 17:19:01 9742

原创 二叉树的最小深度

1,题目要求,求一个二叉树的最小深度?int minHeight(TreeNode* root) { if(NULL == root) return 0; int left = minHeight(root->left); int right minHeight(root->right); if(left == 0 && right == 0)

2016-01-11 23:19:55 330

原创 Leetcode Distinct Subsequences

题目要求:

2014-08-19 14:31:32 551

原创 LeetCode Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1

2014-08-11 22:02:59 647

原创 Leetcode Trapping Rain Water

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1]

2014-08-10 16:12:04 418

原创 Leetcode(Search in Rotated Sorted Array II )

Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target is in the

2014-08-09 21:36:39 458

原创 Leetcode (Generate Parentheses )

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()

2014-08-09 17:18:50 448

原创 Leetcode(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 use the integers

2014-08-09 16:44:37 557

原创 LeetCode Search for a Range

题目要求:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is

2014-05-14 03:43:41 458

原创 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) time and us

2014-05-13 23:02:49 511

原创 LeetCode Best Time to Buy and Sell Stock III

题目要求: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 at most two transactions.Note

2014-05-13 04:43:58 693

原创 LeetCode Multiply Strings 大数相乘

题目要求:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.daima

2014-05-13 02:14:37 840

原创 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

2014-05-12 23:40:58 649

原创 LeetCode(Search in Rotated Sorted Array)

题目要求:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the

2014-04-25 05:15:37 511

原创 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.

2014-04-25 03:17:32 2452

原创 LeetCode(Validate Binary Search Tree) 判断一个二叉树是否是二叉搜索树

题目要求:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the no

2014-04-25 02:32:58 923

原创 LeetCode(Binary Tree Maximum Path Sum) 在二叉树中找出一条和最大的路径

题目要求:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 / \ 2 3R

2014-04-25 01:56:25 919

原创 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.

2014-04-23 10:40:06 544

原创 LeetCode(Palindrome partition 2) 求将一个字符串划分成回文子串 需要分成的段数最少是多少

题目要求:Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aa

2014-04-23 10:38:34 1490

原创 LeetCode(Minimum Path Sum) 找到路径中和最小的

题目要求:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down

2014-04-18 04:21:53 685

原创 LeetCode(Word Search)

题目要求:Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or

2014-04-18 01:26:15 509

原创 LeetCode(Add Two Number)

题目要求:

2014-04-17 03:01:35 522

数值分析典型题解析及自测题

本书是关于数值分析方法的一些习题,大家可以自测一下

2013-07-08

数值计算方法

这本书是关于数值计算方面比较好的资料。内容全面, 讲解透彻。值得学习

2013-07-08

latex 模板

一个自己一直在用的latex模板, 包括插入图片,插入表格,数学公式。但是不支持中文。

2013-04-27

c++编程规范

这是一本c++编程规范的书籍,包含一些在进行c++开发的时候应该注意的细节, 不管是变成新手还是变成老手都会受益匪浅

2013-02-27

高质量程序设计指南(第三版)

这是一本关于c++方面的编程指南, 不管对于c++新手还是老手,阅读次数都会受益匪浅。

2013-02-24

计算理论基础 课后答案

计算理论基础 课后习题的答案 (第二版)

2013-01-14

体系结构量化研究方法第四版课后答案

体系结构量化研究方法第四版课后答案 英文原版的答案

2013-01-10

空空如也

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

TA关注的人

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