随笔分类 -  leetcode

摘要:标题:Palindrome Partitioning通过率:26.3%难度:中等Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible pali... 阅读全文
posted @ 2015-03-16 15:29 pku_smile 阅读(212) 评论(0) 推荐(0)
摘要:标题:Combinations通过率:30.5%难度:中等Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution... 阅读全文
posted @ 2015-03-16 15:22 pku_smile 阅读(154) 评论(0) 推荐(0)
摘要:标题:Binary Tree Zigzag Level Order Traversal通过率:26.5%难度:中等Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from le... 阅读全文
posted @ 2015-03-14 13:57 pku_smile 阅读(164) 评论(0) 推荐(0)
摘要:标题:Populating Next Right Pointers in Each Node II通过率:31.7%难度:难Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tr... 阅读全文
posted @ 2015-03-13 12:20 pku_smile 阅读(164) 评论(0) 推荐(0)
摘要:标题:Populating Next Right Pointers in Each Node通过率:36.1%难度:中等Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *r... 阅读全文
posted @ 2015-03-13 12:18 pku_smile 阅读(156) 评论(0) 推荐(0)
摘要:标题:Remove Duplicates from Sorted Array II通过率:30.7%难度:中等ollow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given ... 阅读全文
posted @ 2015-03-12 22:40 pku_smile 阅读(157) 评论(0) 推荐(0)
摘要:标题:Flatten Binary Tree to Linked List通过率:28.7%难度:中等Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ ... 阅读全文
posted @ 2015-03-12 22:32 pku_smile 阅读(136) 评论(0) 推荐(0)
摘要:标题:Swap Nodes in Pairs通过率:32.5难度:中等Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should retu... 阅读全文
posted @ 2015-03-12 22:24 pku_smile 阅读(151) 评论(0) 推荐(0)
摘要:标题:Construct Binary Tree from Preorder and Inorder Traversal通过率:26.5难度: 中等Given preorder and inorder traversal of a tree, construct the binary tree.No... 阅读全文
posted @ 2015-03-11 22:03 pku_smile 阅读(152) 评论(0) 推荐(0)
摘要:标题:Number of 1 Bits通过率:40.0%难度: 简单Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming ... 阅读全文
posted @ 2015-03-11 20:29 pku_smile 阅读(143) 评论(0) 推荐(0)
摘要:标题:Reverse Words in a String通过率: 14.8% 难度: 中等Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "... 阅读全文
posted @ 2015-03-11 20:24 pku_smile 阅读(139) 评论(0) 推荐(0)
摘要:标题:Add Two Numbers通过率:22.6%难度:中等You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each ... 阅读全文
posted @ 2015-03-08 20:18 pku_smile 阅读(118) 评论(0) 推荐(0)
摘要:标题:Reverse Bits通过率:27.6%难度:简单Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as0000001010010... 阅读全文
posted @ 2015-03-08 19:42 pku_smile 阅读(172) 评论(0) 推荐(0)
摘要:标题:Edit Distance通过率:26.1%难度:难Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counte... 阅读全文
posted @ 2015-03-08 19:39 pku_smile 阅读(124) 评论(0) 推荐(0)
摘要:标题:Rotate Image通过率:31.7%难度:中等You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this... 阅读全文
posted @ 2015-03-07 16:13 pku_smile 阅读(134) 评论(0) 推荐(0)
摘要:标题:Spiral Matrix通过率:20.8%难度:中等Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the f... 阅读全文
posted @ 2015-03-07 16:03 pku_smile 阅读(135) 评论(0) 推荐(0)
摘要:标题:Sort Colors通过率:32.5%难度:中等Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the... 阅读全文
posted @ 2015-03-06 11:20 pku_smile 阅读(121) 评论(0) 推荐(0)
摘要:标题:Container With Most Water通过率:31.9%难度:中等Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines... 阅读全文
posted @ 2015-03-06 11:11 pku_smile 阅读(138) 评论(0) 推荐(0)
摘要:标题:Minimum Path Sum通过率:31.7%难度:中等Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of a... 阅读全文
posted @ 2015-03-06 11:02 pku_smile 阅读(152) 评论(0) 推荐(0)
摘要:标题:Unique Paths II通过率:28%难度:中等Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be... 阅读全文
posted @ 2015-03-05 11:35 pku_smile 阅读(135) 评论(0) 推荐(0)