随笔分类 -  LeetCode

上一页 1 2 3 4 5 6 7 下一页

Leetcode: LRU Cache 解题报告
摘要:LRU CacheDesign and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get... 阅读全文

posted @ 2014-11-21 17:44 Yu's Garden 阅读(2472) 评论(0) 推荐(0) 编辑

LeetCode: Maximal Rectangle 解题报告
摘要:Maximal RectangleGiven a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.Show TagsHave yo... 阅读全文

posted @ 2014-11-19 08:29 Yu's Garden 阅读(1078) 评论(0) 推荐(0) 编辑

LeetCode: Min Stack 解题报告
摘要:Min Stack My SubmissionsQuestionSolutionDesign a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Pu... 阅读全文

posted @ 2014-11-18 21:25 Yu's Garden 阅读(3685) 评论(0) 推荐(0) 编辑

LeetCode: Restore IP Addresses 解题报告
摘要:Restore IP AddressesMy SubmissionsQuestionSolutionGiven a string containing only digits, restore it by returning all possible valid IP address combina... 阅读全文

posted @ 2014-11-18 20:35 Yu's Garden 阅读(1958) 评论(2) 推荐(0) 编辑

LeetCode: Longest Common Prefix 解题报告
摘要:Longest Common Prefix Total Accepted: 24665 Total Submissions: 92370My SubmissionsQuestionSolutionWrite a function to find the longest common prefix s... 阅读全文

posted @ 2014-11-18 19:47 Yu's Garden 阅读(492) 评论(0) 推荐(0) 编辑

LeetCode: Regular Expression Matching 解题报告
摘要:Regular Expression Matching My Submissions Question Solution Implement regular expression matching with support for '.' and '*'. '.' Matches any singl 阅读全文

posted @ 2014-11-18 13:32 Yu's Garden 阅读(4305) 评论(0) 推荐(1) 编辑

LeetCode: solveSudoku 解题报告
摘要:Sudoku SolverWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that th... 阅读全文

posted @ 2014-11-01 20:54 Yu's Garden 阅读(1621) 评论(0) 推荐(0) 编辑

LeetCode: Valid Sudoku 解题报告
摘要:Valid SudokuDetermine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are... 阅读全文

posted @ 2014-11-01 19:15 Yu's Garden 阅读(1898) 评论(0) 推荐(0) 编辑

LeetCode: Anagrams 解题报告
摘要:AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.思路:建Hashtable,用排序过的string作为ke... 阅读全文

posted @ 2014-11-01 17:39 Yu's Garden 阅读(1622) 评论(0) 推荐(0) 编辑

LeetCode: Valid Number 解题报告
摘要:Valid NumberValidate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intend... 阅读全文

posted @ 2014-10-29 19:29 Yu's Garden 阅读(1123) 评论(0) 推荐(1) 编辑

LeetCode: Trapping Rain Water 解题报告
摘要:https://oj.leetcode.com/problems/trapping-rain-water/Trapping Rain WaterGiven n non-negative integers representing an elevation map where the width of... 阅读全文

posted @ 2014-10-28 17:27 Yu's Garden 阅读(691) 评论(0) 推荐(0) 编辑

LeetCode: Container With Most Water 解题报告
摘要:Container With Most WaterGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are draw... 阅读全文

posted @ 2014-10-28 16:49 Yu's Garden 阅读(1298) 评论(0) 推荐(0) 编辑

LeetCode: Add Binary 解题报告
摘要:Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".SOLUTION:指针指到两个字符串的末尾,不断往前推进,用carr... 阅读全文

posted @ 2014-10-26 21:56 Yu's Garden 阅读(571) 评论(0) 推荐(1) 编辑

LeetCode: Merge Intervals 解题报告
摘要:Merge IntervalsGiven 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,1... 阅读全文

posted @ 2014-10-26 20:45 Yu's Garden 阅读(663) 评论(0) 推荐(0) 编辑

LeetCode: Longest Consecutive Sequence 解题报告
摘要:Longest Consecutive SequenceGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, ... 阅读全文

posted @ 2014-10-26 11:16 Yu's Garden 阅读(1213) 评论(0) 推荐(0) 编辑

LeetCode: Rotate Image 解题报告
摘要:Rotate ImageYou 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?SOL... 阅读全文

posted @ 2014-10-25 21:08 Yu's Garden 阅读(684) 评论(0) 推荐(1) 编辑

LeetCode: Divide Two Integers 解题报告
摘要:Divide Two IntegersDivide two integers without using multiplication, division and mod operator.SOLUTION 11. 基本思想是不断地减掉除数,直到为0为止。但是这样会太慢。2. 我们可以使用2分法来加... 阅读全文

posted @ 2014-10-24 20:15 Yu's Garden 阅读(3235) 评论(1) 推荐(0) 编辑

LeetCode 新题: Find Minimum in Rotated Sorted Array II 解题报告-二分法模板解法
摘要:Find Minimum in Rotated Sorted Array II Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-... 阅读全文

posted @ 2014-10-24 19:37 Yu's Garden 阅读(1840) 评论(0) 推荐(0) 编辑

LeetCode 新题: Find Minimum in Rotated Sorted Array 解题报告-二分法模板解法
摘要:Find Minimum in Rotated Sorted ArrayQuestion SolutionSuppose a sorted array is rotated at some pivot unknown to youbeforehand.(i.e., 0 1 2 4 5 6 7 mig... 阅读全文

posted @ 2014-10-24 18:37 Yu's Garden 阅读(2552) 评论(0) 推荐(0) 编辑

LeetCode: Candy 解题报告
摘要:CandyThere are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the followin... 阅读全文

posted @ 2014-10-24 18:08 Yu's Garden 阅读(997) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 下一页

导航