随笔分类 -  ~~Leetcode~~

摘要:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega... 阅读全文
posted @ 2014-06-29 16:14 OpenSoucre 阅读(132) 评论(0) 推荐(0)
摘要:Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe... 阅读全文
posted @ 2014-06-29 15:21 OpenSoucre 阅读(179) 评论(0) 推荐(0)
摘要:Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histog... 阅读全文
posted @ 2014-06-26 23:57 OpenSoucre 阅读(205) 评论(0) 推荐(0)
摘要:Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A s... 阅读全文
posted @ 2014-06-26 22:55 OpenSoucre 阅读(190) 评论(0) 推荐(0)
摘要: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 le... 阅读全文
posted @ 2014-06-26 22:16 OpenSoucre 阅读(153) 评论(0) 推荐(0)
摘要:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth... 阅读全文
posted @ 2014-06-26 21:43 OpenSoucre 阅读(149) 评论(0) 推荐(0)
摘要:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文
posted @ 2014-06-26 00:23 OpenSoucre 阅读(194) 评论(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,−1,2,1,... 阅读全文
posted @ 2014-06-25 23:38 OpenSoucre 阅读(116) 评论(0) 推荐(0)
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.时间复杂度O(n^3),最大全1子矩阵,利用直方图求解,可以参考对... 阅读全文
posted @ 2014-06-25 23:10 OpenSoucre 阅读(145) 评论(0) 推荐(0)
摘要:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each number ... 阅读全文
posted @ 2014-06-25 22:10 OpenSoucre 阅读(170) 评论(0) 推荐(0)
摘要:Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated num... 阅读全文
posted @ 2014-06-25 21:58 OpenSoucre 阅读(148) 评论(0) 推荐(0)
摘要:Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri... 阅读全文
posted @ 2014-06-25 21:40 OpenSoucre 阅读(154) 评论(0) 推荐(0)
摘要:Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".class Solution {public: string addBinary(str... 阅读全文
posted @ 2014-06-25 21:07 OpenSoucre 阅读(171) 评论(0) 推荐(0)
摘要:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"tw... 阅读全文
posted @ 2014-06-24 22:41 OpenSoucre 阅读(144) 评论(0) 推荐(0)
摘要:Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ... 阅读全文
posted @ 2014-06-24 22:21 OpenSoucre 阅读(154) 评论(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 telephon... 阅读全文
posted @ 2014-06-24 21:51 OpenSoucre 阅读(167) 评论(0) 推荐(0)
摘要:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a... 阅读全文
posted @ 2014-06-24 20:35 OpenSoucre 阅读(103) 评论(0) 推荐(0)
摘要:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie... 阅读全文
posted @ 2014-06-24 20:13 OpenSoucre 阅读(160) 评论(0) 推荐(0)
摘要:Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL.先算出链表... 阅读全文
posted @ 2014-06-23 20:56 OpenSoucre 阅读(132) 评论(0) 推荐(0)
摘要:Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.class Solution {public: ... 阅读全文
posted @ 2014-06-23 20:20 OpenSoucre 阅读(145) 评论(0) 推荐(0)