11 2015 档案

摘要:题目: This is a follow up of Shortest Word Distance. The only difference is now you are given the list of words and your method will be called repeatedl 阅读全文
posted @ 2015-11-30 11:51 YRB 阅读(944) 评论(0) 推荐(0) 编辑
摘要:题目: Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. For example,Assume that wor 阅读全文
posted @ 2015-11-30 10:16 YRB 阅读(594) 评论(0) 推荐(0) 编辑
摘要:题目: Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat", 阅读全文
posted @ 2015-11-30 07:37 YRB 阅读(1563) 评论(2) 推荐(0) 编辑
摘要:题目: Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators 阅读全文
posted @ 2015-11-30 07:14 YRB 阅读(2314) 评论(0) 推荐(0) 编辑
摘要:题目: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sort 阅读全文
posted @ 2015-11-29 23:31 YRB 阅读(1040) 评论(0) 推荐(0) 编辑
摘要:题目: Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k 阅读全文
posted @ 2015-11-29 12:31 YRB 阅读(855) 评论(0) 推荐(0) 编辑
摘要:题目: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums exc 阅读全文
posted @ 2015-11-29 08:42 YRB 阅读(410) 评论(0) 推荐(0) 编辑
摘要:题目: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 阅读全文
posted @ 2015-11-29 00:01 YRB 阅读(276) 评论(0) 推荐(0) 编辑
摘要:题目: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The l 阅读全文
posted @ 2015-11-28 23:56 YRB 阅读(2521) 评论(0) 推荐(0) 编辑
摘要:题目: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikip 阅读全文
posted @ 2015-11-28 22:30 YRB 阅读(1911) 评论(2) 推荐(0) 编辑
摘要:题目: Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time and O(1) space? 链接: http://leetcode.com/proble 阅读全文
posted @ 2015-11-28 11:07 YRB 阅读(244) 评论(0) 推荐(0) 编辑
摘要:题目:Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Retur... 阅读全文
posted @ 2015-11-28 10:40 YRB 阅读(662) 评论(0) 推荐(0) 编辑
摘要:题目: Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in f 阅读全文
posted @ 2015-11-27 12:35 YRB 阅读(737) 评论(0) 推荐(0) 编辑
摘要:题目: Given an integer, write a function to determine if it is a power of two. 链接: http://leetcode.com/problems/power-of-two/ 题解: 验证一个数是否是2的幂次,我们可以使用(n 阅读全文
posted @ 2015-11-27 11:43 YRB 阅读(239) 评论(0) 推荐(0) 编辑
摘要:题目: Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ B 阅读全文
posted @ 2015-11-26 22:43 YRB 阅读(2518) 评论(0) 推荐(0) 编辑
摘要:题目: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space 阅读全文
posted @ 2015-11-26 12:38 YRB 阅读(482) 评论(0) 推荐(0) 编辑
摘要:题目: Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. 链 阅读全文
posted @ 2015-11-26 04:57 YRB 阅读(332) 评论(0) 推荐(0) 编辑
摘要:题目:Implement a basic calculator to evaluate a simple expression string.The expression string contains onlynon-negativeintegers,+,-,*,/operators and em... 阅读全文
posted @ 2015-11-26 04:15 YRB 阅读(751) 评论(0) 推荐(0) 编辑
摘要:题目: Invert a binary tree. to Trivia:This problem was inspired by this original tweet by Max Howell: 链接: http://leetcode.com/problems/invert-binary-tre 阅读全文
posted @ 2015-11-25 12:36 YRB 阅读(564) 评论(0) 推荐(0) 编辑
摘要:题目: Implement the following operations of a stack using queues. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack 阅读全文
posted @ 2015-11-25 12:27 YRB 阅读(681) 评论(0) 推荐(0) 编辑
摘要:题目:Implement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), the plus+or mi... 阅读全文
posted @ 2015-11-25 07:26 YRB 阅读(707) 评论(0) 推荐(0) 编辑
摘要:题目: Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left corner and top right corner 阅读全文
posted @ 2015-11-25 04:17 YRB 阅读(406) 评论(0) 推荐(0) 编辑
摘要:题目: Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level 阅读全文
posted @ 2015-11-25 01:45 YRB 阅读(2054) 评论(0) 推荐(0) 编辑
摘要:题目: Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given the following 阅读全文
posted @ 2015-11-24 06:24 YRB 阅读(426) 评论(0) 推荐(0) 编辑
摘要:题目: Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums 阅读全文
posted @ 2015-11-24 05:38 YRB 阅读(918) 评论(1) 推荐(0) 编辑
摘要:题目: Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and 阅读全文
posted @ 2015-11-24 03:02 YRB 阅读(282) 评论(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 areg 阅读全文
posted @ 2015-11-24 00:07 YRB 阅读(1334) 评论(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 阅读全文
posted @ 2015-11-22 23:28 YRB 阅读(339) 评论(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 阅读全文
posted @ 2015-11-22 23:20 YRB 阅读(954) 评论(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 阅读全文
posted @ 2015-11-22 12:47 YRB 阅读(1392) 评论(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 ca... 阅读全文
posted @ 2015-11-21 03:49 YRB 阅读(1135) 评论(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 阅读全文
posted @ 2015-11-20 12:31 YRB 阅读(640) 评论(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 ad... 阅读全文
posted @ 2015-11-20 03:27 YRB 阅读(1385) 评论(0) 推荐(0) 编辑
摘要:题目: Design a data structure that supports the following two operations: search(word) can search a literal word or a regular expression string containi 阅读全文
posted @ 2015-11-20 01:34 YRB 阅读(1672) 评论(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 ha 阅读全文
posted @ 2015-11-19 13:09 YRB 阅读(1388) 评论(0) 推荐(0) 编辑
摘要:分硬币问题是一个很有意思的问题,一般可以用recursive或者dp来解决。Reference里面acm之家的文章分析得很好,下面我自己再重复一边这个过程。这道题也可以联想到其他dp过程。 题目很简单: 给定一堆硬币coins[], 数量管够,硬币有m种不同的面值,求组成 n 元钱有多少种不同的方法 阅读全文
posted @ 2015-11-06 05:17 YRB 阅读(826) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示