
有疑问
文章平均质量分 71
ljffdream
这个作者很懒,什么都没留下…
展开
-
【Leetcode】Largest Ractangular
【题目】Largest Rectangle in Histogram Total Accepted: 42804 Total Submissions: 188970My SubmissionsQuestion Solution Given n non-negative integers representing the histogram转载 2015-09-02 11:02:12 · 304 阅读 · 0 评论 -
【Leetcode】Set matrix zeros
【题目】【思路】My idea is simple: store states of each row in the first of that row, and store states of each column in the first of that column. Because the state of row0 and the state of column0转载 2015-09-01 23:10:47 · 354 阅读 · 0 评论 -
【Leetcode】maximum Rangtangle in 2D matrix
【题目】Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.【思路】只能说不明觉厉:The DP solution proceeds row by row, starting f转载 2015-09-02 11:10:29 · 328 阅读 · 0 评论 -
【Leetcode】Jump Game 1,2
【题目】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 maximum jump length at that position.You转载 2015-08-26 10:27:45 · 302 阅读 · 0 评论 -
【Leetcode】Gas Station
【题目】There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from sta转载 2015-07-21 21:00:23 · 275 阅读 · 0 评论 -
【Leetcode】Rain trapping
【题目】 Given n non-negative integers representing anelevation map where the width of each bar is 1, compute how much water it isable to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1转载 2015-08-25 22:18:54 · 356 阅读 · 0 评论 -
【Leetcode】Search for a range
【题目】【思路】The problem can be simply broken down as two binary searches for the begining and end of the range, respectively:First let's find the left boundary of the range. We ini转载 2015-08-23 21:09:39 · 292 阅读 · 0 评论 -
[Leetcode]Number of Island
[题目]Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You ma转载 2015-07-07 09:55:24 · 289 阅读 · 0 评论 -
【Leetcode】Sort List in O(nlogn) O(1)space
【题目】【思路】First of all, allow me to explain the meaning of strict O(1) auxiliary space complexity.It means the maximum number of memory used by the program, except the memory taken by th转载 2015-07-27 20:42:43 · 321 阅读 · 0 评论 -
【Leetcode】Factorial Trailing Zeroes
【题目】Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.Credits:Special thanks to @ts for adding this problem an转载 2015-07-04 22:55:21 · 372 阅读 · 0 评论 -
【Leetcode】Delete Node in a LinkedList
【题目】Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node转载 2015-07-26 16:47:59 · 298 阅读 · 0 评论 -
[Leetcode]Happy Number
[题目]Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the s转载 2015-07-01 13:29:44 · 318 阅读 · 0 评论 -
[Leetcode]Median of two sorted array
[题目]There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).[分析][code转载 2015-06-11 09:59:15 · 618 阅读 · 0 评论 -
[Leetcode]Word Break
Given a string s and a dictionary of words dict, determine ifs can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet",转载 2015-06-10 10:40:27 · 299 阅读 · 0 评论 -
【Leetcode】number of 1 bits
【题目】Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 00000000原创 2015-04-08 09:58:32 · 379 阅读 · 0 评论 -
【Leetcode】Find peak numbers
【题目】A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multipl原创 2015-04-08 10:35:46 · 384 阅读 · 0 评论 -
[Leetcode]Word Search
[timu]Given 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 horizontal转载 2015-09-02 07:51:04 · 288 阅读 · 0 评论