随笔分类 -  LeetCode

摘要:Problem Definition:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai).n vertical lines are drawn such ... 阅读全文
posted @ 2015-07-28 21:17 曾可爱 阅读(125) 评论(0) 推荐(0)
摘要:Problem Definition: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... 阅读全文
posted @ 2015-07-28 15:59 曾可爱 阅读(124) 评论(0) 推荐(0)
摘要:Problem Definition:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring withoutre... 阅读全文
posted @ 2015-07-27 20:13 曾可爱 阅读(135) 评论(0) 推荐(0)
摘要:Problem Definition:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return in... 阅读全文
posted @ 2015-07-27 14:39 曾可爱 阅读(101) 评论(0) 推荐(0)
摘要:Problem Definition:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be chan... 阅读全文
posted @ 2015-07-24 21:17 曾可爱 阅读(133) 评论(0) 推荐(0)
摘要:Problem Definition:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty ce... 阅读全文
posted @ 2015-07-24 20:18 曾可爱 阅读(138) 评论(0) 推荐(0)
摘要:Problem Definition:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Solutio... 阅读全文
posted @ 2015-07-24 20:13 曾可爱 阅读(100) 评论(0) 推荐(0)
摘要:Problem Definition:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the strin... 阅读全文
posted @ 2015-07-23 22:14 曾可爱 阅读(105) 评论(0) 推荐(0)
摘要:Problem Definition:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most sign... 阅读全文
posted @ 2015-07-23 21:13 曾可爱 阅读(132) 评论(0) 推荐(0)
摘要:Problem Definition:Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100".Solution: crack it in a ... 阅读全文
posted @ 2015-07-23 20:15 曾可爱 阅读(130) 评论(0) 推荐(0)
摘要:Problem Definition: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 distin... 阅读全文
posted @ 2015-07-23 19:25 曾可爱 阅读(116) 评论(0) 推荐(0)
摘要:Problem Definition:Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.G... 阅读全文
posted @ 2015-07-23 17:02 曾可爱 阅读(88) 评论(0) 推荐(0)
摘要:Problem Definiton:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enou... 阅读全文
posted @ 2015-07-23 11:08 曾可爱 阅读(115) 评论(0) 推荐(0)
摘要:Problem Definition:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symm... 阅读全文
posted @ 2015-07-23 10:40 曾可爱 阅读(186) 评论(0) 推荐(0)
摘要:Problem Definition:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:G... 阅读全文
posted @ 2015-07-22 14:42 曾可爱 阅读(108) 评论(0) 推荐(0)
摘要:Problem Definition:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as abinary tree ... 阅读全文
posted @ 2015-07-21 21:39 曾可爱 阅读(107) 评论(0) 推荐(0)
摘要:Problem Definition:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node dow... 阅读全文
posted @ 2015-07-21 20:19 曾可爱 阅读(101) 评论(0) 推荐(0)
摘要:Problem Definition:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equa... 阅读全文
posted @ 2015-07-21 20:17 曾可爱 阅读(131) 评论(0) 推荐(0)
摘要:Problem Definition:Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1].Note:Could you optimize yo... 阅读全文
posted @ 2015-07-21 20:13 曾可爱 阅读(97) 评论(0) 推荐(0)
摘要:Problem Definition:Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return[ [1], [1,1], [1,2,1]... 阅读全文
posted @ 2015-07-21 20:11 曾可爱 阅读(92) 评论(0) 推荐(0)