随笔分类 - 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 ...
阅读全文
摘要: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...
阅读全文
摘要:Problem Definition:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring withoutre...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:Problem Definition:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty ce...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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 ...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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 ...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:Problem Definition:Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return[ [1], [1,1], [1,2,1]...
阅读全文

浙公网安备 33010602011771号