随笔分类 -  leetcode

摘要:1.题目描述 Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endp... 阅读全文
posted @ 2013-09-21 17:14 曾见绝美的阳光 阅读(356) 评论(0) 推荐(0)
摘要:1.题目描述 Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element... 阅读全文
posted @ 2013-09-21 15:52 曾见绝美的阳光 阅读(311) 评论(0) 推荐(0)
摘要:1.题目描述 Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be ... 阅读全文
posted @ 2013-09-19 12:51 曾见绝美的阳光 阅读(249) 评论(0) 推荐(0)
摘要:1.题目描述 The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all ... 阅读全文
posted @ 2013-09-18 22:37 曾见绝美的阳光 阅读(323) 评论(0) 推荐(0)
摘要:1.题目描述Givenasetofcandidatenumbers(C)andatargetnumber(T),findalluniquecombinationsinCwherethecandidatenumberssumstoT.ThesamerepeatednumbermaybechosenfromCunlimitednumberoftimes.Note:Allnumbers(includingtarget)willbepositiveintegers.Elementsinacombination(a1,a2,。。。,ak)mustbeinnon-descendingorder.(ie,a 阅读全文
posted @ 2013-08-28 19:53 曾见绝美的阳光 阅读(382) 评论(0) 推荐(0)
摘要:1.题目描述 Given an array of non-negative integers, you are initially positioned at the first index of the array. Eac... 阅读全文
posted @ 2013-08-27 22:21 曾见绝美的阳光 阅读(477) 评论(0) 推荐(0)
摘要:1.题目描述 Given an array of non-negative integers, you are initially positioned at the first index of the array. Eac... 阅读全文
posted @ 2013-08-27 21:26 曾见绝美的阳光 阅读(249) 评论(0) 推荐(0)
摘要:1.题目描述 Implement int sqrt(int x). Compute and return the square root of x. 2.解法分析... 阅读全文
posted @ 2013-08-27 15:33 曾见绝美的阳光 阅读(187) 评论(0) 推荐(0)
摘要:1.题目描述 Given a number represented as an array of digits, plus one to the number. 2.解法分析 不要被常规思路限制住,常规思路会遍历整个数组... 阅读全文
posted @ 2013-08-27 11:54 曾见绝美的阳光 阅读(357) 评论(0) 推荐(0)
摘要:1.题目描述 Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2... 阅读全文
posted @ 2013-08-27 00:45 曾见绝美的阳光 阅读(568) 评论(0) 推荐(0)
摘要:1.题目描述 Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). ... 阅读全文
posted @ 2013-08-27 00:01 曾见绝美的阳光 阅读(246) 评论(0) 推荐(0)
摘要:1.题目描述 Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, ... 阅读全文
posted @ 2013-08-25 13:41 曾见绝美的阳光 阅读(244) 评论(0) 推荐(1)
摘要:1.题目描述Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hold additional elements from B. The number of elements initialized in A and B are m and n respectively.2.解法分析这道题是归并排序的变种,我们知道,归并那一步应该是要有一个O(N+M)的辅助数组的,由于题目中说可以假设A有足够的空间来容 阅读全文
posted @ 2013-08-25 13:02 曾见绝美的阳光 阅读(270) 评论(0) 推荐(0)
摘要:1.题目描述 Given an unsorted integer array, find the first missing positive integer. For example, Given ... 阅读全文
posted @ 2013-08-25 00:26 曾见绝美的阳光 阅读(249) 评论(0) 推荐(0)
摘要:1.题目描述 Divide two integers without using multiplication, division and mod operator. 2.解法分析 不用乘除求模运算,一个很容易让人想到的就是用... 阅读全文
posted @ 2013-08-24 23:09 曾见绝美的阳光 阅读(513) 评论(0) 推荐(0)
摘要:1.题目描述 Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if needle is ... 阅读全文
posted @ 2013-08-24 00:09 曾见绝美的阳光 阅读(257) 评论(0) 推荐(0)
摘要:1.题目描述 Given an array and a value, remove all instances of that value in place and return the new length. The ord... 阅读全文
posted @ 2013-08-23 00:14 曾见绝美的阳光 阅读(208) 评论(0) 推荐(0)
摘要:1.题目描述 Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. ... 阅读全文
posted @ 2013-08-23 00:01 曾见绝美的阳光 阅读(171) 评论(0) 推荐(0)
摘要:1.题目描述 Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1-... 阅读全文
posted @ 2013-08-22 23:40 曾见绝美的阳光 阅读(269) 评论(0) 推荐(0)
摘要:1.题目描述 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 2.解法分析 ... 阅读全文
posted @ 2013-08-22 23:14 曾见绝美的阳光 阅读(240) 评论(0) 推荐(0)