摘要: 题目: Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true Note: It is intended for 阅读全文
posted @ 2015-04-17 23:58 YRB 阅读(528) 评论(0) 推荐(0)
摘要: 题目: 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 pa 阅读全文
posted @ 2015-04-17 23:57 YRB 阅读(296) 评论(0) 推荐(0)
摘要: 题目: 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 s 阅读全文
posted @ 2015-04-17 23:54 YRB 阅读(311) 评论(0) 推荐(0)
摘要: 题目: A robot is located at the top-left corner of a m x ngrid (marked 'Start' in the diagram below). The robot can only move either down or right at an 阅读全文
posted @ 2015-04-17 23:53 YRB 阅读(361) 评论(0) 推荐(0)
摘要: 题目: Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2 阅读全文
posted @ 2015-04-17 23:50 YRB 阅读(276) 评论(0) 推荐(0)
摘要: 题目: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequ 阅读全文
posted @ 2015-04-17 23:49 YRB 阅读(674) 评论(0) 推荐(0)
摘要: 题目: 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 fol 阅读全文
posted @ 2015-04-17 23:47 YRB 阅读(294) 评论(0) 推荐(0)
摘要: 题目: 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 阅读全文
posted @ 2015-04-17 23:45 YRB 阅读(187) 评论(0) 推荐(0)
摘要: 题目: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were in 阅读全文
posted @ 2015-04-17 23:44 YRB 阅读(498) 评论(0) 推荐(0)
摘要: 题目: Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. Given 阅读全文
posted @ 2015-04-17 23:42 YRB 阅读(652) 评论(0) 推荐(0)
摘要: 题目: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your m 阅读全文
posted @ 2015-04-17 23:41 YRB 阅读(336) 评论(0) 推荐(0)
摘要: 题目: Given a matrix of m x n elements (m rows, ncolumns), return all elements of the matrix in spiral order. For example,Given the following matrix: Yo 阅读全文
posted @ 2015-04-17 23:40 YRB 阅读(486) 评论(0) 推荐(0)
摘要: 题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,− 阅读全文
posted @ 2015-04-17 23:39 YRB 阅读(784) 评论(0) 推荐(0)
摘要: 题目: Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. Show Tags Show Simila 阅读全文
posted @ 2015-04-17 23:38 YRB 阅读(439) 评论(0) 推荐(0)
摘要: 题目: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return 阅读全文
posted @ 2015-04-17 23:37 YRB 阅读(734) 评论(0) 推荐(0)
摘要: 题目: Implement pow(x, n). 链接: http://leetcode.com/problems/powx-n/ 题解: 使用二分法求实数幂,假如不建立临时变量halfPow,直接return计算结果的话会超时,还没仔细研究为什么。 Time Complexity - O(logn 阅读全文
posted @ 2015-04-17 23:36 YRB 阅读(476) 评论(0) 推荐(0)
摘要: 题目: Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. Hide Tags Hash Table String Giv 阅读全文
posted @ 2015-04-17 23:32 YRB 阅读(351) 评论(0) 推荐(0)
摘要: 题目: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-place? 链接: http 阅读全文
posted @ 2015-04-17 23:31 YRB 阅读(497) 评论(0) 推荐(0)
摘要: 题目: Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example,[1,1,2] have the following uniqu 阅读全文
posted @ 2015-04-17 23:30 YRB 阅读(575) 评论(0) 推荐(0)
摘要: 题目: 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 阅读全文
posted @ 2015-04-17 23:28 YRB 阅读(1528) 评论(0) 推荐(0)
摘要: 题目: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your m 阅读全文
posted @ 2015-04-17 23:25 YRB 阅读(405) 评论(0) 推荐(0)
摘要: 题目: Implement wildcard pattern matching with support for '?' and '*'. 链接: http://leetcode.com/problems/wildcard-matching/ 题解: 这道题是一刷里放弃的6道题中第一道。看过<挑战程 阅读全文
posted @ 2015-04-17 23:24 YRB 阅读(819) 评论(0) 推荐(0)
摘要: 题目: Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non 阅读全文
posted @ 2015-04-17 23:23 YRB 阅读(870) 评论(0) 推荐(0)
摘要: 题目: 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 rain 阅读全文
posted @ 2015-04-17 23:22 YRB 阅读(422) 评论(0) 推荐(0)
摘要: 题目: 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 algorit 阅读全文
posted @ 2015-04-17 23:20 YRB 阅读(309) 评论(0) 推荐(0)
摘要: 题目: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each 阅读全文
posted @ 2015-04-17 23:19 YRB 阅读(464) 评论(0) 推荐(0)
摘要: 题目: 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 re 阅读全文
posted @ 2015-04-17 23:18 YRB 阅读(1749) 评论(0) 推荐(0)
摘要: 题目: 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 阅读全文
posted @ 2015-04-17 23:16 YRB 阅读(574) 评论(0) 推荐(0)
摘要: 题目:Write 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... 阅读全文
posted @ 2015-04-17 23:15 YRB 阅读(688) 评论(0) 推荐(0)
摘要: 题目: Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled 阅读全文
posted @ 2015-04-17 23:11 YRB 阅读(686) 评论(0) 推荐(0)
摘要: 题目: 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 i 阅读全文
posted @ 2015-04-17 23:09 YRB 阅读(248) 评论(0) 推荐(0)
摘要: 题目: 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 th 阅读全文
posted @ 2015-04-17 23:07 YRB 阅读(353) 评论(0) 推荐(0)
摘要: 题目: 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 targe 阅读全文
posted @ 2015-04-17 20:11 YRB 阅读(313) 评论(0) 推荐(0)
摘要: 题目: Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", th 阅读全文
posted @ 2015-04-17 16:08 YRB 阅读(468) 评论(0) 推荐(0)
摘要: 题目: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not po 阅读全文
posted @ 2015-04-17 16:06 YRB 阅读(504) 评论(0) 推荐(0)
摘要: 题目: You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a c 阅读全文
posted @ 2015-04-17 15:53 YRB 阅读(450) 评论(0) 推荐(0)
摘要: 题目: Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 链接: http://leetcode.com/problems/d 阅读全文
posted @ 2015-04-17 15:51 YRB 阅读(1086) 评论(0) 推荐(0)
摘要: 题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Update (2014-11-02):The... 阅读全文
posted @ 2015-04-17 15:30 YRB 阅读(651) 评论(0) 推荐(0)
摘要: 题目: 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' 阅读全文
posted @ 2015-04-17 15:29 YRB 阅读(319) 评论(0) 推荐(0)
摘要: 题目: 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 spac 阅读全文
posted @ 2015-04-17 15:00 YRB 阅读(234) 评论(0) 推荐(0)
摘要: 题目: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k th 阅读全文
posted @ 2015-04-17 14:27 YRB 阅读(486) 评论(0) 推荐(0)
摘要: 题目: Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Yo 阅读全文
posted @ 2015-04-17 14:26 YRB 阅读(693) 评论(0) 推荐(0)
摘要: 题目:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.链接:http://leetcode.com/problems/merge-k-sorted-list... 阅读全文
posted @ 2015-04-17 14:08 YRB 阅读(706) 评论(0) 推荐(0)
摘要: 题目: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set i 阅读全文
posted @ 2015-04-17 13:13 YRB 阅读(1106) 评论(0) 推荐(0)
摘要: 题目: 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. 链接:  阅读全文
posted @ 2015-04-17 13:12 YRB 阅读(461) 评论(0) 推荐(0)
摘要: 题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in 阅读全文
posted @ 2015-04-17 12:25 YRB 阅读(302) 评论(0) 推荐(0)
摘要: 题目: Given a linked list, remove the nth node from the end of list and return its head. For example, Note:Given n will always be valid.Try to do this i 阅读全文
posted @ 2015-04-17 12:06 YRB 阅读(328) 评论(0) 推荐(0)
摘要: 题目: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array 阅读全文
posted @ 2015-04-17 10:38 YRB 阅读(1367) 评论(0) 推荐(0)
摘要: 题目: Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the tel 阅读全文
posted @ 2015-04-17 00:17 YRB 阅读(2114) 评论(1) 推荐(0)