摘要: Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such that nums[i] = nums[j] an... 阅读全文
posted @ 2015-06-09 21:34 TonyLuis 阅读(174) 评论(0) 推荐(0) 编辑
摘要: A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are give... 阅读全文
posted @ 2015-06-09 21:33 TonyLuis 阅读(816) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr... 阅读全文
posted @ 2015-06-09 21:32 TonyLuis 阅读(246) 评论(0) 推荐(0) 编辑
摘要: Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be ... 阅读全文
posted @ 2015-06-09 21:30 TonyLuis 阅读(259) 评论(0) 推荐(0) 编辑
摘要: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For examp... 阅读全文
posted @ 2015-06-09 21:28 TonyLuis 阅读(208) 评论(0) 推荐(0) 编辑
摘要: Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can f... 阅读全文
posted @ 2015-06-09 20:45 TonyLuis 阅读(328) 评论(0) 推荐(0) 编辑
摘要: Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that... 阅读全文
posted @ 2015-06-09 20:27 TonyLuis 阅读(623) 评论(0) 推荐(0) 编辑
摘要: Given a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjac... 阅读全文
posted @ 2015-06-09 19:58 TonyLuis 阅读(477) 评论(0) 推荐(0) 编辑
摘要: Design a data structure that supports the following two operations:void addWord(word)bool search(word)search(word) can search a literal word or a regu... 阅读全文
posted @ 2015-06-09 19:05 TonyLuis 阅读(235) 评论(0) 推荐(0) 编辑
摘要: There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to... 阅读全文
posted @ 2015-06-09 18:23 TonyLuis 阅读(318) 评论(0) 推荐(0) 编辑
摘要: Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return... 阅读全文
posted @ 2015-06-09 17:19 TonyLuis 阅读(503) 评论(0) 推荐(0) 编辑
摘要: Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z.解题思路:参考百度百科:Tri... 阅读全文
posted @ 2015-06-09 16:58 TonyLuis 阅读(1469) 评论(0) 推荐(0) 编辑