随笔分类 -  Leetcode

上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 19 下一页
摘要:Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv... 阅读全文
posted @ 2015-09-11 04:59 amazingzoe 阅读(137) 评论(0) 推荐(0)
摘要:Given an arraynums, there is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumbers ... 阅读全文
posted @ 2015-09-11 01:26 amazingzoe 阅读(126) 评论(0) 推荐(0)
摘要:You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality c... 阅读全文
posted @ 2015-09-10 05:02 amazingzoe 阅读(100) 评论(0) 推荐(0)
摘要:Given a positive integern, find the least number of perfect square numbers (for example,1, 4, 9, 16, ...) which sum ton.For example, givenn=12, return... 阅读全文
posted @ 2015-09-10 04:35 amazingzoe 阅读(125) 评论(0) 推荐(0)
摘要:I. Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3... 阅读全文
posted @ 2015-09-09 03:06 amazingzoe 阅读(137) 评论(0) 推荐(0)
摘要:Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo... 阅读全文
posted @ 2015-09-05 21:05 amazingzoe 阅读(166) 评论(0) 推荐(0)
摘要:Given two words (beginWordandendWord), and a dictionary, find the length of shortest transformation sequence frombeginWordtoendWord, such that:Only on... 阅读全文
posted @ 2015-09-03 13:03 amazingzoe 阅读(123) 评论(0) 推荐(0)
摘要:Given an array ofnpositive integers and a positive integers, find the minimal length of a subarray of which the sum ≥s. If there isn't one, return 0 i... 阅读全文
posted @ 2015-09-03 03:46 amazingzoe 阅读(102) 评论(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 @ 2015-09-03 01:34 amazingzoe 阅读(135) 评论(0) 推荐(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?Analyse: Obtain the elements first, ... 阅读全文
posted @ 2015-09-02 03:15 amazingzoe 阅读(128) 评论(0) 推荐(0)
摘要:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文
posted @ 2015-09-02 02:39 amazingzoe 阅读(130) 评论(0) 推荐(0)
摘要:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat... 阅读全文
posted @ 2015-09-02 00:32 amazingzoe 阅读(111) 评论(0) 推荐(0)
摘要:Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac 阅读全文
posted @ 2015-09-01 21:48 amazingzoe 阅读(189) 评论(0) 推荐(0)
摘要:Given an integer, write a function to determine if it is a power of two.Analyse:***Notice that if a number is a power of 2, then the highest binary di... 阅读全文
posted @ 2015-08-29 06:10 amazingzoe 阅读(162) 评论(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 is1 -> 2 -> 3 -> ... 阅读全文
posted @ 2015-08-29 05:55 amazingzoe 阅读(106) 评论(0) 推荐(0)
摘要:Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ... 阅读全文
posted @ 2015-08-27 08:15 amazingzoe 阅读(119) 评论(0) 推荐(0)
摘要:Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->... 阅读全文
posted @ 2015-08-25 13:50 amazingzoe 阅读(164) 评论(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 @ 2015-08-25 06:29 amazingzoe 阅读(148) 评论(0) 推荐(0)
摘要:Given a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such possibl... 阅读全文
posted @ 2015-08-25 05:41 amazingzoe 阅读(127) 评论(0) 推荐(0)
摘要:Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl... 阅读全文
posted @ 2015-08-23 22:39 amazingzoe 阅读(121) 评论(0) 推荐(0)

上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 19 下一页