随笔分类 -  Leetcode

上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 19 下一页
摘要:Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the 阅读全文
posted @ 2016-02-02 01:31 amazingzoe 阅读(138) 评论(0) 推荐(0)
摘要:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For exam... 阅读全文
posted @ 2015-12-28 00:20 amazingzoe 阅读(152) 评论(0) 推荐(0)
摘要:Given an integer arraynums, find the sum of the elements between indicesiandj(i≤j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2)... 阅读全文
posted @ 2015-11-10 23:31 amazingzoe 阅读(142) 评论(0) 推荐(0)
摘要:According to theWikipedia's article: "TheGame of Life, also known simply asLife, is a cellular automaton devised by the British mathematician John Hor... 阅读全文
posted @ 2015-11-06 05:40 amazingzoe 阅读(190) 评论(0) 推荐(0)
摘要:Given an array containingndistinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.For example,Givennums=[0, 1, 3]retur... 阅读全文
posted @ 2015-11-02 02:45 amazingzoe 阅读(143) 评论(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"].Runtime: ... 阅读全文
posted @ 2015-10-30 00:29 amazingzoe 阅读(166) 评论(0) 推荐(0)
摘要:Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.For example, givenn... 阅读全文
posted @ 2015-10-19 11:27 amazingzoe 阅读(145) 评论(0) 推荐(0)
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is: [ [2,4], [3,4 阅读全文
posted @ 2015-10-13 05:06 amazingzoe 阅读(136) 评论(0) 推荐(0)
摘要:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm... 阅读全文
posted @ 2015-10-13 04:25 amazingzoe 阅读(161) 评论(0) 推荐(0)
摘要:Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1 阅读全文
posted @ 2015-10-13 02:20 amazingzoe 阅读(245) 评论(0) 推荐(0)
摘要:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston... 阅读全文
posted @ 2015-10-13 02:04 amazingzoe 阅读(132) 评论(0) 推荐(0)
摘要:Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Suppose a sort... 阅读全文
posted @ 2015-10-13 00:59 amazingzoe 阅读(131) 评论(0) 推荐(0)
摘要:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephon... 阅读全文
posted @ 2015-10-13 00:20 amazingzoe 阅读(192) 评论(0) 推荐(0)
摘要:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
posted @ 2015-10-12 23:36 amazingzoe 阅读(180) 评论(0) 推荐(0)
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.You m... 阅读全文
posted @ 2015-10-12 09:38 amazingzoe 阅读(106) 评论(0) 推荐(0)
摘要:Given an array of numbersnums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements t... 阅读全文
posted @ 2015-10-12 07:40 amazingzoe 阅读(138) 评论(0) 推荐(0)
摘要:The string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font fo... 阅读全文
posted @ 2015-10-12 07:04 amazingzoe 阅读(152) 评论(0) 推荐(0)
摘要:Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.Runtime: 40ms 1 /** 2 * Definition for a point. 3 *... 阅读全文
posted @ 2015-10-12 06:03 amazingzoe 阅读(150) 评论(0) 推荐(0)
摘要:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.Runtime: 8ms 1 class Solution { 2 public... 阅读全文
posted @ 2015-10-12 00:38 amazingzoe 阅读(134) 评论(0) 推荐(0)
摘要:Implement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), the plus+or minus... 阅读全文
posted @ 2015-10-08 11:12 amazingzoe 阅读(158) 评论(0) 推荐(0)

上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 19 下一页