本博客rss订阅地址: http://feed.cnblogs.com/blog/u/147990/rss

随笔分类 -  LeetCode

摘要:题目链接Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique lo... 阅读全文
posted @ 2014-04-19 23:56 tenos 阅读(18932) 评论(3) 推荐(2) 编辑
摘要:题目链接There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should... 阅读全文
posted @ 2014-04-19 16:18 tenos 阅读(2348) 评论(0) 推荐(0) 编辑
摘要:题目链接Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.合并k个有序的链表,我们假设每个链表的平均长度是n。这一题需要用到合并两个有序的链表子过程算法1... 阅读全文
posted @ 2014-04-18 14:33 tenos 阅读(7550) 评论(0) 推荐(1) 编辑
摘要:题目链接Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.1为了操作... 阅读全文
posted @ 2014-04-18 13:33 tenos 阅读(1326) 评论(0) 推荐(0) 编辑
摘要:题目链接Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. Afte... 阅读全文
posted @ 2014-04-15 22:28 tenos 阅读(912) 评论(0) 推荐(0) 编辑
摘要:PermutationsGiven a collection of numbers, return all possible permutations.For example, [1,2,3] have the following permutations: [1,2,3], [1,3,2]... 阅读全文
posted @ 2014-04-13 19:49 tenos 阅读(9013) 评论(0) 推荐(1) 编辑
摘要:3Sum ClosestGiven an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution.For example, given array S = {-1 2 1 -4}, and target = 1. The sum that is clo... 阅读全文
posted @ 2014-04-07 00:21 tenos 阅读(10396) 评论(0) 推荐(1) 编辑
摘要:题目链接Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the tw... 阅读全文
posted @ 2014-04-05 15:20 tenos 阅读(2510) 评论(0) 推荐(0) 编辑
摘要:题目链接Given two binary strings, return their sum (also a binary string).For example, a = "11" b = "1" Return "100".分析:简单的处理二进制求和和进位即可 本文地址class So... 阅读全文
posted @ 2013-12-15 15:22 tenos 阅读(582) 评论(0) 推荐(0) 编辑
摘要:题目链接Validate if a given string is numeric.Some examples: "0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true 本文地址Note... 阅读全文
posted @ 2013-12-15 15:18 tenos 阅读(1308) 评论(0) 推荐(0) 编辑
摘要:题目链接Given a number represented as an array of digits, plus one to the number分析:too simple 本文地址class Solution {public: vector plusOne(vector &digits... 阅读全文
posted @ 2013-12-15 14:58 tenos 阅读(619) 评论(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 s... 阅读全文
posted @ 2013-12-15 14:51 tenos 阅读(1943) 评论(0) 推荐(0) 编辑
摘要:题目链接Implement int sqrt(int x).Compute and return the square root of x.面试时需要考虑x是否小于0.分析:牛顿法,先假设一个初始解res(本文设为1),然后以抛物y = x^2-c(这里的c相当于题目中的x)上的点(res, res... 阅读全文
posted @ 2013-12-12 20:07 tenos 阅读(592) 评论(2) 推荐(0) 编辑
摘要:题目链接You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you... 阅读全文
posted @ 2013-12-09 14:25 tenos 阅读(1471) 评论(2) 推荐(1) 编辑
摘要:题目链接Given an absolute path for a file (Unix-style), simplify it.For example, path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c"Corner Ca... 阅读全文
posted @ 2013-12-09 14:14 tenos 阅读(1235) 评论(1) 推荐(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 ha... 阅读全文
posted @ 2013-12-09 14:08 tenos 阅读(967) 评论(0) 推荐(0) 编辑
摘要:题目链接Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space? A straight forward... 阅读全文
posted @ 2013-12-09 13:49 tenos 阅读(836) 评论(0) 推荐(0) 编辑
摘要:LeetCode:Search in Rotated Sorted ArraySuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5... 阅读全文
posted @ 2013-12-09 13:32 tenos 阅读(2055) 评论(0) 推荐(0) 编辑
摘要:题目链接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 sorte... 阅读全文
posted @ 2013-12-08 22:25 tenos 阅读(823) 评论(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 @ 2013-12-08 22:16 tenos 阅读(1129) 评论(0) 推荐(1) 编辑


本博客rss订阅地址: http://feed.cnblogs.com/blog/u/147990/rss

公益页面-寻找遗失儿童