随笔分类 -  Leetcode

上一页 1 ··· 3 4 5 6 7 8 下一页
摘要:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni... 阅读全文
posted @ 2014-10-17 14:10 Phoebe815 阅读(135) 评论(0) 推荐(0)
摘要:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1... 阅读全文
posted @ 2014-10-16 15:25 Phoebe815 阅读(147) 评论(0) 推荐(0)
摘要:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a... 阅读全文
posted @ 2014-10-16 13:56 Phoebe815 阅读(113) 评论(0) 推荐(0)
摘要:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a... 阅读全文
posted @ 2014-10-16 12:52 Phoebe815 阅读(123) 评论(0) 推荐(0)
摘要:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie... 阅读全文
posted @ 2014-10-16 06:30 Phoebe815 阅读(133) 评论(0) 推荐(0)
摘要:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an... 阅读全文
posted @ 2014-10-16 06:12 Phoebe815 阅读(127) 评论(0) 推荐(0)
摘要:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about this?Here are som... 阅读全文
posted @ 2014-10-16 06:11 Phoebe815 阅读(103) 评论(0) 推荐(0)
摘要:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文
posted @ 2014-10-16 05:03 Phoebe815 阅读(122) 评论(0) 推荐(0)
摘要:Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity... 阅读全文
posted @ 2014-10-16 04:55 Phoebe815 阅读(131) 评论(0) 推荐(0)
摘要:Given two words (startandend), and a dictionary, find all shortest transformation sequence(s) fromstarttoend, such that:Only one letter can be changed... 阅读全文
posted @ 2014-10-13 16:10 Phoebe815 阅读(157) 评论(0) 推荐(0)
摘要:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo... 阅读全文
posted @ 2014-10-12 15:38 Phoebe815 阅读(155) 评论(0) 推荐(0)
摘要:Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are labeled uniq... 阅读全文
posted @ 2014-10-12 07:35 Phoebe815 阅读(122) 评论(0) 推荐(0)
摘要:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu... 阅读全文
posted @ 2014-10-11 14:11 Phoebe815 阅读(191) 评论(0) 推荐(0)
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy ... 阅读全文
posted @ 2014-10-09 15:39 Phoebe815 阅读(115) 评论(0) 推荐(0)
摘要:Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of characters (including the e... 阅读全文
posted @ 2014-10-02 13:49 Phoebe815 阅读(204) 评论(0) 推荐(0)
摘要:You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenati... 阅读全文
posted @ 2014-10-01 14:57 Phoebe815 阅读(182) 评论(0) 推荐(0)
摘要:Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa... 阅读全文
posted @ 2014-09-30 14:23 Phoebe815 阅读(194) 评论(0) 推荐(0)
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the... 阅读全文
posted @ 2014-09-29 01:00 Phoebe815 阅读(196) 评论(0) 推荐(0)
摘要:The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie... 阅读全文
posted @ 2014-09-28 04:14 Phoebe815 阅读(184) 评论(0) 推荐(0)
摘要:Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"click to show corner cas... 阅读全文
posted @ 2014-09-27 15:25 Phoebe815 阅读(180) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7 8 下一页