10 2014 档案

Remove Duplicates from Sorted List I&&II
摘要:Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1-> 阅读全文

posted @ 2014-10-07 23:39 bug睡的略爽 阅读(192) 评论(0) 推荐(0)

Word Search
摘要: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 "adjac 阅读全文

posted @ 2014-10-07 20:47 bug睡的略爽 阅读(299) 评论(0) 推荐(0)

Combinations
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is: [ [2,4], [3,4 阅读全文

posted @ 2014-10-07 16:48 bug睡的略爽 阅读(172) 评论(0) 推荐(0)

Search a 2D Matrix
摘要:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f 阅读全文

posted @ 2014-10-07 11:47 bug睡的略爽 阅读(170) 评论(0) 推荐(0)

Set Matrix Zeroes
摘要:Given a m x n matrix, 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 sp 阅读全文

posted @ 2014-10-07 10:49 bug睡的略爽 阅读(129) 评论(0) 推荐(0)

Add Binary
摘要:Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 类似模拟十进制加法 阅读全文

posted @ 2014-10-06 21:57 bug睡的略爽 阅读(154) 评论(0) 推荐(0)

Minimum Path Sum
摘要: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. 阅读全文

posted @ 2014-10-06 19:22 bug睡的略爽 阅读(143) 评论(0) 推荐(0)

Unique Paths I&&II
摘要:Unique Paths 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 r 阅读全文

posted @ 2014-10-06 19:07 bug睡的略爽 阅读(143) 评论(0) 推荐(0)

Insert Interval
摘要:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文

posted @ 2014-10-06 18:05 bug睡的略爽 阅读(125) 评论(0) 推荐(0)

Merge Intervals
摘要:Given 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,18]. 合并重复区间 先让区 阅读全文

posted @ 2014-10-06 16:32 bug睡的略爽 阅读(121) 评论(0) 推荐(0)

N-Queens I&&II
摘要: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 @ 2014-10-06 15:26 bug睡的略爽 阅读(191) 评论(0) 推荐(0)

Anagrams
摘要:Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. For example: Input: ["tea","and","a 阅读全文

posted @ 2014-10-06 10:15 bug睡的略爽 阅读(119) 评论(0) 推荐(0)

Multiply Strings
摘要:Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-neg 阅读全文

posted @ 2014-10-05 17:15 bug睡的略爽 阅读(133) 评论(0) 推荐(0)

Combination Sum I&&II
摘要:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeat 阅读全文

posted @ 2014-10-05 15:23 bug睡的略爽 阅读(143) 评论(0) 推荐(0)

Search for a Range
摘要:Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the or 阅读全文

posted @ 2014-10-05 14:53 bug睡的略爽 阅读(168) 评论(0) 推荐(0)

Divide Two Integers
摘要:Divide two integers without using multiplication, division and mod operator. 方法一:暴力破解,不断用被除数减去除数,直至出现负数停止,铁定超时。 方法二:对方法一的改进,每次寻找 满足2k-1 * 除数 <= 被除数 < 阅读全文

posted @ 2014-10-01 23:24 bug睡的略爽 阅读(142) 评论(0) 推荐(0)

Remove Duplicates from Sorted Array I&&II
摘要:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo 阅读全文

posted @ 2014-10-01 17:06 bug睡的略爽 阅读(102) 评论(0) 推荐(0)

Reverse Nodes in k-Group
摘要:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then l 阅读全文

posted @ 2014-10-01 16:57 bug睡的略爽 阅读(186) 评论(0) 推荐(0)

Swap Nodes in Pairs
摘要:Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Your a 阅读全文

posted @ 2014-10-01 11:38 bug睡的略爽 阅读(161) 评论(0) 推荐(0)

Merge k Sorted Lists
摘要:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 方法一:暴力破解,1和2合并,合并后再和3合并,合并后再和4合并。。。如此下去一直将所有链表节点全部合 阅读全文

posted @ 2014-10-01 11:10 bug睡的略爽 阅读(165) 评论(0) 推荐(0)

导航