随笔分类 -  leetcode

1 2 3 4 5 ··· 7 下一页
摘要:1、LCS 2、CSD: 1、s1.length==0,return s2.length; 2、s2.length==0,return s1.length; 3、if s1.charat(i)==s2.charat(j),res[i][j]=res[i-1][j-1] else res[i][j]= 阅读全文
posted @ 2016-08-07 17:55 pku_smile 阅读(225) 评论(0) 推荐(0)
摘要:One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, 阅读全文
posted @ 2016-02-02 11:02 pku_smile 阅读(139) 评论(0) 推荐(0)
摘要:标题:Bitwise AND of Numbers Range通过率:25.7%难度:中等Given a range [m, n] where 0 >=1 9 n>>=110 offset+=111 return m<<offset 阅读全文
posted @ 2015-04-23 16:53 pku_smile 阅读(204) 评论(0) 推荐(0)
摘要:标题:Remove Linked List Elements通过率:30.5%难度:简单Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 -->... 阅读全文
posted @ 2015-04-23 15:53 pku_smile 阅读(128) 评论(0) 推荐(0)
摘要:标题:Happy Number通过率:34.3%难度:简单Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Start... 阅读全文
posted @ 2015-04-23 15:33 pku_smile 阅读(114) 评论(0) 推荐(0)
摘要:标题:Rotate List通过率:21.8%难度:中等Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,ret... 阅读全文
posted @ 2015-04-17 10:55 pku_smile 阅读(186) 评论(0) 推荐(0)
摘要:标题:Gas Station通过率:25.7%难度:中等There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimite... 阅读全文
posted @ 2015-04-15 21:23 pku_smile 阅读(173) 评论(0) 推荐(0)
摘要:标题:Reverse Linked List II通过率:26.2%难度:中等Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m=... 阅读全文
posted @ 2015-04-13 10:29 pku_smile 阅读(195) 评论(0) 推荐(0)
摘要:标题:Clone Graph通过率:23.7%难度:中等OJ's undirected graph serialization:Nodes are labeled uniquely.We use#as a separator for each node, and,as a separator for... 阅读全文
posted @ 2015-04-12 15:40 pku_smile 阅读(160) 评论(0) 推荐(0)
摘要:标题:Anagrams通过率:24.3%难度:中等Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.leetcode没有表述... 阅读全文
posted @ 2015-04-10 10:21 pku_smile 阅读(139) 评论(0) 推荐(0)
摘要:标题:Simplify Path通过率:20.1%难度:中等Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", ... 阅读全文
posted @ 2015-04-09 21:27 pku_smile 阅读(203) 评论(0) 推荐(0)
摘要:标题:Number of Islands通过率:22.8%难度:中等Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and... 阅读全文
posted @ 2015-04-09 15:52 pku_smile 阅读(273) 评论(0) 推荐(0)
摘要:标题:3Sum Closest通过率:27.0%难度:中等Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum... 阅读全文
posted @ 2015-04-08 19:28 pku_smile 阅读(134) 评论(0) 推荐(0)
摘要:标题:4Sum通过率:21.4%难度:中等Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array wh... 阅读全文
posted @ 2015-04-08 19:25 pku_smile 阅读(141) 评论(0) 推荐(0)
摘要:标题:3Sum通过率: 16.9%难度:中等Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the s... 阅读全文
posted @ 2015-04-08 19:16 pku_smile 阅读(158) 评论(0) 推荐(0)
摘要:标题:Binary Tree Right Side View通过率:27.9%难度:中等Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you c... 阅读全文
posted @ 2015-04-06 15:16 pku_smile 阅读(207) 评论(0) 推荐(0)
摘要:题目:Word Break通过率:22.6%难度:中等Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more ... 阅读全文
posted @ 2015-04-03 22:32 pku_smile 阅读(141) 评论(0) 推荐(0)
摘要:标题:House Robber通过率:27.5%难度:简单You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, th... 阅读全文
posted @ 2015-04-03 21:03 pku_smile 阅读(229) 评论(0) 推荐(0)
摘要:标题:Construct Binary Tree from Inorder and Postorder Traversal通过率:26.7%难度:中等Given inorder and postorder traversal of a tree, construct the binary tree.... 阅读全文
posted @ 2015-04-02 15:51 pku_smile 阅读(149) 评论(0) 推荐(0)
摘要:标题:Triangle通过率:27.1%难度:中等Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.F... 阅读全文
posted @ 2015-03-30 19:31 pku_smile 阅读(160) 评论(0) 推荐(0)

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