随笔分类 -  LeetCode

摘要:问题描述: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... 阅读全文
posted @ 2015-03-21 21:35 学而~ 阅读(141) 评论(0) 推荐(0)
摘要:问题描述Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3]... 阅读全文
posted @ 2015-03-21 20:45 学而~ 阅读(117) 评论(0) 推荐(0)
摘要:问题描述:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space ... 阅读全文
posted @ 2015-03-21 20:24 学而~ 阅读(137) 评论(0) 推荐(0)
摘要:问题描述:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the t... 阅读全文
posted @ 2015-03-21 16:49 学而~ 阅读(195) 评论(0) 推荐(0)
摘要:问题描述Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space... 阅读全文
posted @ 2015-03-21 14:34 学而~ 阅读(208) 评论(0) 推荐(0)
摘要:Clarification:What constitutes a word?A sequence of non-space characters constitutes a word.Could the input string contain leading or trailing spaces?... 阅读全文
posted @ 2014-11-26 19:28 学而~ 阅读(416) 评论(0) 推荐(0)
摘要:Question:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close... 阅读全文
posted @ 2014-11-19 09:25 学而~ 阅读(161) 评论(0) 推荐(0)