摘要: 题目连接https://leetcode.com/problems/implement-trie-prefix-tree/Implement Trie (Prefix Tree)DescriptionImplement a trie with insert, search, and startsWi... 阅读全文
posted @ 2015-12-04 22:33 GadyPu 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/course-schedule-ii/Course Schedule IIDescriptionThere are a total of n courses you have to take, labeled from 0 to n... 阅读全文
posted @ 2015-12-04 22:29 GadyPu 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/kth-largest-element-in-an-array/Kth Largest Element in an ArrayDescriptionFind the kth largest element in an unsorte... 阅读全文
posted @ 2015-12-04 22:25 GadyPu 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/basic-calculator/Basic CalculatorDescriptionImplement a basic calculator to evaluate a simple expression string.The ... 阅读全文
posted @ 2015-12-04 22:21 GadyPu 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/power-of-two/Power of TwoDescriptionGiven an integer, write a function to determine if it is a power of two.水一发pytho... 阅读全文
posted @ 2015-12-04 22:18 GadyPu 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/同上, 用二叉树的性质要快一些,懒得改了。。/** * Definition for a binary tree node. * stru... 阅读全文
posted @ 2015-12-04 22:14 GadyPu 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/Common Ancestor of a Binary TreeDescriptionGiven a binary tree, find the low... 阅读全文
posted @ 2015-12-04 22:11 GadyPu 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/delete-node-in-a-linked-list/Delete Node in a Linked ListDescriptionWrite a function to delete a node (except the ta... 阅读全文
posted @ 2015-12-04 22:03 GadyPu 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/search-a-2d-matrix-ii/Search a 2D Matrix IIDescriptionWrite an efficient algorithm that searches for a value in an m... 阅读全文
posted @ 2015-12-04 22:00 GadyPu 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/valid-anagram/Valid AnagramDescriptionGiven two strings s and t, write a function to determine if t is an anagram of... 阅读全文
posted @ 2015-12-04 21:55 GadyPu 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/add-digits/Add DigitsDescriptionGiven a non-negative integer num, repeatedly add all its digits until the result has... 阅读全文
posted @ 2015-12-04 21:50 GadyPu 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/single-number-iii/Single Number IIIDescriptionGiven an array of numbers nums, in which exactly two elements appear o... 阅读全文
posted @ 2015-12-04 21:47 GadyPu 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/ugly-number/Ugly NumberDescriptionWrite a program to check whether a given number is an ugly number.Ugly numbers are... 阅读全文
posted @ 2015-12-04 21:44 GadyPu 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/ugly-number-ii/Ugly Number IIDescriptionWrite a program to find the $n_{th}$ ugly number.Ugly numbers are positive n... 阅读全文
posted @ 2015-12-04 21:41 GadyPu 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/missing-number/Missing NumberDescriptionGiven an array containing n distinct numbers taken from$ 0, 1, 2, ..., n$, f... 阅读全文
posted @ 2015-12-04 21:38 GadyPu 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/find-the-duplicate-number/Find the Duplicate NumberDescriptionGiven an array nums containing n + 1 integers where ea... 阅读全文
posted @ 2015-12-04 21:34 GadyPu 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/word-pattern/Word PatternDescriptionGiven a pattern and a string str, find if str follows the same pattern.Here foll... 阅读全文
posted @ 2015-12-04 21:30 GadyPu 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题目连接https://leetcode.com/problems/count-and-say/Count and SayDescriptionThe count-and-say sequence is the sequence of integers beginning as follows:1,... 阅读全文
posted @ 2015-12-04 21:22 GadyPu 阅读(142) 评论(0) 推荐(0) 编辑