随笔分类 -  Leetcode刷题笔记

1 2 3 4 5 ··· 8 下一页
摘要:题目:Given a linked list, remove the nth node from the end of list and return its head. For example, Note:Given n will always be valid.Try to do this in 阅读全文
posted @ 2018-02-27 15:08 荒野第一快递员 阅读(203) 评论(0) 推荐(0)
摘要:题目:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three intege 阅读全文
posted @ 2018-02-27 12:29 荒野第一快递员 阅读(240) 评论(0) 推荐(0)
摘要:题目:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum 阅读全文
posted @ 2018-02-27 12:02 荒野第一快递员 阅读(190) 评论(0) 推荐(0)
摘要:题目: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 en 阅读全文
posted @ 2018-02-27 10:35 荒野第一快递员 阅读(216) 评论(0) 推荐(0)
摘要:转载至http://blog.csdn.net/hk2291976/article/details/51107778 问题介绍 这是个超级超级经典的分治算法!!这个问题大致是说,如何在给定的两个有序数组里面找其中的中值,或者变形问题,如何在2个有序数组数组中查找Top K的值(Top K的问题可以转 阅读全文
posted @ 2018-02-26 10:56 荒野第一快递员 阅读(221) 评论(0) 推荐(0)
摘要:题目:Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the l 阅读全文
posted @ 2018-02-26 10:03 荒野第一快递员 阅读(146) 评论(0) 推荐(0)
摘要:题目: Implement pow(x, n). Example 1: Example 2: 题意及分析:实现求x的n次方,使用分治法,复杂度降低到log2n 代码: 阅读全文
posted @ 2018-01-23 12:40 荒野第一快递员 阅读(226) 评论(0) 推荐(0)
摘要:题目: 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 m 阅读全文
posted @ 2018-01-23 09:41 荒野第一快递员 阅读(191) 评论(0) 推荐(0)
摘要:题目: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were in 阅读全文
posted @ 2018-01-18 10:23 荒野第一快递员 阅读(187) 评论(0) 推荐(0)
摘要:题目: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following matrix: [ 阅读全文
posted @ 2018-01-15 15:08 荒野第一快递员 阅读(294) 评论(0) 推荐(0)
摘要:题目: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example,Given n = 3, You should return the fol 阅读全文
posted @ 2018-01-15 14:39 荒野第一快递员 阅读(153) 评论(0) 推荐(0)
摘要:题目: Given a list, rotate the list to the right by k places, where k is non-negative. Example: 题意及分析:从右到左第n个点进行翻转链表。主要是要找到翻转点和翻转点前面一个点,然后将最后一个点的next设置为 阅读全文
posted @ 2018-01-10 09:20 荒野第一快递员 阅读(245) 评论(0) 推荐(0)
摘要:题目: Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 题意及分析:求两个用字符串表示 的二进制数的和。主要是判断每次相加的和是否大 阅读全文
posted @ 2018-01-09 09:02 荒野第一快递员 阅读(189) 评论(0) 推荐(0)
摘要:题目: Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true Note: It is intended for 阅读全文
posted @ 2018-01-08 19:47 荒野第一快递员 阅读(228) 评论(0) 推荐(0)
摘要:题目: Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any le 阅读全文
posted @ 2018-01-08 16:01 荒野第一快递员 阅读(389) 评论(0) 推荐(0)
摘要:题目: Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You 阅读全文
posted @ 2018-01-08 14:59 荒野第一快递员 阅读(452) 评论(0) 推荐(0)
摘要:题目: Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c" 题意及分析:给出一个un 阅读全文
posted @ 2017-12-22 11:00 荒野第一快递员 阅读(200) 评论(0) 推荐(0)
摘要:题目: Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You h 阅读全文
posted @ 2017-12-22 10:12 荒野第一快递员 阅读(301) 评论(0) 推荐(0)
摘要:题目: iven 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 阅读全文
posted @ 2017-12-21 14:37 荒野第一快递员 阅读(213) 评论(0) 推荐(0)
摘要:题目: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order r 阅读全文
posted @ 2017-12-21 09:37 荒野第一快递员 阅读(477) 评论(0) 推荐(0)

1 2 3 4 5 ··· 8 下一页