leetcode
文章平均质量分 77
qingyujean
这个作者很懒,什么都没留下…
展开
-
Range Sum Query系列(Immutable,Mutable,2D - Immutable)
Range Sum Query - Immutable题目:难度(Easy)Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(原创 2016-05-23 20:14:55 · 474 阅读 · 0 评论 -
leetcode229. Majority Element II
题目描述(难度(Medium)):Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.Hint:How many majority element原创 2017-03-18 14:31:46 · 284 阅读 · 0 评论 -
leetcode62. Unique Paths
题目描述(难度:Medium):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原创 2017-03-14 13:46:45 · 257 阅读 · 0 评论 -
leetcode63. Unique Paths II
题目描述(难度:Medium):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 respecti原创 2017-03-14 13:47:41 · 242 阅读 · 0 评论 -
leetcode64. Minimum Path Sum
题目描述(难度:Medium):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原创 2017-03-14 13:48:20 · 354 阅读 · 0 评论 -
leetcode39. Combination Sum
题目描述(难度:Medium):Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number原创 2017-03-14 13:48:57 · 260 阅读 · 0 评论 -
leetcode40. Combination Sum II
题目描述(难度:Medium)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 number in C may only be used once i原创 2017-03-14 13:49:34 · 275 阅读 · 0 评论 -
leetcode216. Combination Sum III
题目描述(难度):Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Example 1:I原创 2017-03-14 13:50:38 · 258 阅读 · 0 评论 -
leetcode228. Summary Ranges
题目描述(难度(Medium)):Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].Tags: ArraySimilar Problems: (原创 2017-03-18 14:26:43 · 288 阅读 · 0 评论 -
leetcode笔记--Roman to Integer & Integer to Roman
Roman to Integer题目:难度(Easy)Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Tags: Math, String分析:罗马数字共有七个,即I(1),V(5),X(10),L(50),C(原创 2016-06-14 13:08:15 · 368 阅读 · 0 评论 -
leetcode笔记--Contains Duplicate I & II & III
Contains Duplicate题目:难度(Easy)Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should原创 2016-06-14 12:23:29 · 309 阅读 · 0 评论 -
leetcode笔记--Create Maximum Number
题目:难度(Hard)Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k <= m + n from digits of the two. The relative order of the digits from t原创 2016-05-21 19:59:52 · 487 阅读 · 0 评论 -
leetcode笔记--Remove Duplicate Letters
题目:难度(Hard)Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexico原创 2016-05-21 13:49:35 · 410 阅读 · 0 评论 -
leetcode笔记--Burst Balloons
题目:难度(Hard)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 balloons. If the you burst balloon i you原创 2016-05-23 13:34:08 · 347 阅读 · 0 评论 -
leetcode笔记--Best Time to Buy and Sell Stock with Cooldown
题目:难度(Medium)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 as many transactions as you lik原创 2016-05-23 15:29:41 · 690 阅读 · 1 评论 -
leetcode笔记--Minimum Depth of Binary Tree
Minimum Depth of Binary Tree题目:难度(Easy)Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf no原创 2016-06-10 19:06:15 · 335 阅读 · 0 评论 -
leetcode笔记--Move Zeroes
Move Zeroes题目:难度(Easy)Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0,原创 2016-06-11 14:00:10 · 323 阅读 · 0 评论 -
leetcode笔记--Intersection of Two Arrays I & II
Intersection of Two ArraysGiven two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result原创 2016-06-11 00:36:58 · 466 阅读 · 0 评论 -
leetcode笔记--Best Time to Buy and Sell Stock系列(I,II, III, IV)
Best Time to Buy and Sell Stock题目:难度(Easy)Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i原创 2016-05-23 16:11:40 · 728 阅读 · 0 评论 -
leetcode笔记--Valid Anagram
Valid Anagram题目:难度(Easy)Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return fa原创 2016-06-11 17:03:34 · 243 阅读 · 0 评论 -
leetcode笔记--Excel Sheet Column Title&Excel Sheet Column Number
Excel Sheet Column Title题目:难度(Easy)Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -原创 2016-06-11 16:20:53 · 325 阅读 · 0 评论 -
leetcode笔记--Majority Element I & II
Majority Element题目:难度(Easy)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 the array is non-原创 2016-06-13 22:30:11 · 426 阅读 · 0 评论