- 博客(96)
- 资源 (3)
- 收藏
- 关注
原创 [LeetCode] - Min Stack O(1)最小栈
Min Stack Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the s
2014-11-13 13:34:31
1638
原创 [九度1512 剑指offer7] 用两个栈实现队列
题目1512:用两个栈实现队列题目描述:用两个栈来实现一个队列,完成队列的Push和Pop操作。队列中的元素为int类型。输入:每个输入文件包含一个测试样例。对于每个测试样例,第一行输入一个n(1接下来的n行,每行输入一个队列操作:1. PUSH X 向队列中push一个整数x(x>=0)2. POP 从队列中pop一个数。
2014-08-31 14:22:20
803
原创 [九度 1510 剑指offer]—替换空格 数组插入逆向移动
题目:http://ac.jobdu.com/problem.php?pid=1510
2014-08-22 16:22:24
670
原创 [九度—剑指offer]—二维数组查找
题目描述:在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。输入:输入可能包含多个测试样例,对于每个测试案例,输入的第一行为两个整数m和n(1输入的第二行包括一个整数t(1接下来的m行,每行有n个数,代表题目所给出的m行n列的矩阵(矩阵如题目描述所示,每一
2014-08-20 15:27:59
767
原创 [LeetCode]-Palindrome Number 判断整数回文
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 y
2014-08-17 15:38:58
694
原创 [LeetCode]-Spiral Matrix I&II 螺旋矩阵
Spiral Matrix Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5,
2014-08-17 11:16:15
845
原创 [LeetCode]-Pascal's Triangle I&II 杨辉三角问题
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(
2014-08-16 15:26:03
824
原创 [LeetCode]—Word Search
Word SearchGiven 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
2014-08-15 21:58:07
640
原创 [LeetCode]-Generate Parentheses N个括号所有的组合数
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-15 15:31:32
1173
原创 [LeetCode]-Letter Combinations of a Phone Number 电话键盘的字符串组合
Letter Combinations of a Phone Number
2014-08-15 11:37:28
729
原创 [LeetCode]-Combination Sum I&II 求相加和为target的集合
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 ch
2014-08-14 21:41:29
583
原创 [LeetCode]-Restore IP Addresses
Restore IP Addresses Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.1
2014-08-14 17:08:56
570
原创 [LeetCode]—Palindrome Partitioning II 回文分割,求最小分割数
Palindrome Partitioning II 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.
2014-08-13 14:38:48
1143
原创 [LeetCode]-Surrounded Regions 找被包围的点
Surrounded Regions Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.Fo
2014-08-13 10:17:52
968
原创 [LeetCode]—Word Ladder 单词递推
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 timeEa
2014-07-10 16:28:51
880
原创 [LeetCode]—Permutations II 求全排列(有重复值)
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
2014-07-10 11:55:16
1091
原创 [LeetCode]—Permutations 求全排列
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
2014-07-10 10:59:28
749
原创 [LeetCode]—Subsets II 求数组子集(有重复值)
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 m
2014-07-10 09:57:03
1289
原创 [LeetCode]—Subsets 求数组子集
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 subse
2014-07-09 16:11:42
1221
原创 [LeetCode]—Search Insert Position 有序数组中找目标插入的位置
Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may a
2014-07-09 11:15:56
946
原创 [LeetCode]—Search a 2D Matrix 有序二维矩阵中查找目标值
Search a 2D Matrix Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to ri
2014-07-09 11:12:32
987
原创 [LeetCode]—Largest Rectangle in Histogram 求直方图最大填充矩形面积
Largest Rectangle in Histogram
2014-07-08 16:44:51
876
原创 [LeetCode]—Longest Valid Parentheses 最长括号匹配
Longest Valid Parentheses Longest Valid Parentheses
2014-07-07 19:20:23
677
原创 [LeetCode]—Simplify Path 简化路径表达式
Simplify Path Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"
2014-07-05 22:40:58
719
[Python]—Linux Server 系统监控程序
2014-07-14
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人