摘要: 题目: 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 @ 2017-05-07 22:15 Vincent丶丶 阅读(158) 评论(0) 推荐(0)
摘要: 题目: Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers s 阅读全文
posted @ 2017-05-07 21:34 Vincent丶丶 阅读(189) 评论(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 @ 2017-05-07 21:33 Vincent丶丶 阅读(194) 评论(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 @ 2017-05-07 21:32 Vincent丶丶 阅读(207) 评论(0) 推荐(0)
摘要: 题目: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that 阅读全文
posted @ 2017-05-07 21:30 Vincent丶丶 阅读(172) 评论(0) 推荐(0)
摘要: 题目: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For 阅读全文
posted @ 2017-05-07 21:29 Vincent丶丶 阅读(144) 评论(0) 推荐(0)
摘要: 题目: 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 sort 阅读全文
posted @ 2017-05-07 21:28 Vincent丶丶 阅读(173) 评论(0) 推荐(0)
摘要: 题目: Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators 阅读全文
posted @ 2017-05-07 21:27 Vincent丶丶 阅读(222) 评论(0) 推荐(0)
摘要: 题目: Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between t 阅读全文
posted @ 2017-05-07 21:26 Vincent丶丶 阅读(200) 评论(0) 推荐(0)
摘要: 题目: Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the bal 阅读全文
posted @ 2017-05-07 21:25 Vincent丶丶 阅读(382) 评论(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 @ 2017-05-07 21:24 Vincent丶丶 阅读(185) 评论(0) 推荐(0)
摘要: 题目: 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 a 阅读全文
posted @ 2017-05-07 21:23 Vincent丶丶 阅读(194) 评论(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 @ 2017-05-07 21:21 Vincent丶丶 阅读(189) 评论(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 @ 2017-05-07 21:20 Vincent丶丶 阅读(162) 评论(0) 推荐(0)
摘要: 题目: 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 yo 阅读全文
posted @ 2017-05-07 21:19 Vincent丶丶 阅读(211) 评论(0) 推荐(0)
摘要: 题目: Write an efficient algorithm that searches for a value in an m x n matrix, return the occurrence of it. This matrix has the following properties: 阅读全文
posted @ 2017-05-07 21:18 Vincent丶丶 阅读(173) 评论(0) 推荐(0)
摘要: 题目: 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 sort 阅读全文
posted @ 2017-05-07 21:18 Vincent丶丶 阅读(212) 评论(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 @ 2017-05-07 21:15 Vincent丶丶 阅读(206) 评论(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). Find the minimum elem 阅读全文
posted @ 2017-05-07 21:08 Vincent丶丶 阅读(232) 评论(0) 推荐(0)
摘要: 题目: There is an integer array which has the following features: The numbers in adjacent positions are different. A[0] < A[1] && A[A.length - 2] > A[A. 阅读全文
posted @ 2017-05-07 21:06 Vincent丶丶 阅读(243) 评论(0) 推荐(0)
摘要: 题目: The code base version is an integer start from 1 to n. One day, someone committed a bad version in the code case, so it caused this version and th 阅读全文
posted @ 2017-05-07 20:15 Vincent丶丶 阅读(178) 评论(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 @ 2017-05-07 16:09 Vincent丶丶 阅读(152) 评论(0) 推荐(0)
摘要: 模板:(通用模板,推荐) 给定一个排序的整数数组(升序)和一个要查找的整数target,用O(logn)的时间查找到target第一次出现的下标(从0开始),如果target不存在于数组中,返回-1。 若将条件改为查找target最后一次出现的下标(从0开始),那么程序将发生改变,循环中如果 arr 阅读全文
posted @ 2017-05-07 13:03 Vincent丶丶 阅读(1416) 评论(0) 推荐(0)