随笔分类 -  leedcode

1 2 3 4 5 ··· 12 下一页
摘要:Given two stringssandt, write a function to determine iftis an anagram ofs.For example,s= "anagram",t= "nagaram", return true.s= "rat",t= "car", retur... 阅读全文
posted @ 2015-08-09 00:11 ~每天进步一点点~ 阅读(165) 评论(0) 推荐(0)
摘要:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. Th... 阅读全文
posted @ 2015-08-09 00:00 ~每天进步一点点~ 阅读(207) 评论(0) 推荐(0)
摘要:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted in asc... 阅读全文
posted @ 2015-08-08 23:36 ~每天进步一点点~ 阅读(243) 评论(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-08-08 20:51 ~每天进步一点点~ 阅读(201) 评论(0) 推荐(0)
摘要: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-08-08 20:13 ~每天进步一点点~ 阅读(138) 评论(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-08 19:48 ~每天进步一点点~ 阅读(109) 评论(0) 推荐(0)
摘要:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest ... 阅读全文
posted @ 2015-08-08 19:41 ~每天进步一点点~ 阅读(224) 评论(0) 推荐(0)
摘要:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedia: ... 阅读全文
posted @ 2015-08-08 18:34 ~每天进步一点点~ 阅读(250) 评论(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?/** * Definition for singly-linked l... 阅读全文
posted @ 2015-08-08 18:04 ~每天进步一点点~ 阅读(111) 评论(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,Return 6... 阅读全文
posted @ 2015-08-08 17:32 ~每天进步一点点~ 阅读(107) 评论(0) 推荐(1)
摘要: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 front o... 阅读全文
posted @ 2015-08-08 16:55 ~每天进步一点点~ 阅读(117) 评论(0) 推荐(0)
摘要:Given an integer, write a function to determine if it is a power of two.public class Solution { //注意0和负数都返回false!!! /*public boolean isP... 阅读全文
posted @ 2015-08-08 16:38 ~每天进步一点点~ 阅读(189) 评论(0) 推荐(0)
摘要:Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota... 阅读全文
posted @ 2015-08-08 16:15 ~每天进步一点点~ 阅读(102) 评论(0) 推荐(0)
摘要:Given an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm should run in linear time and in O(1) space.public... 阅读全文
posted @ 2015-08-08 15:54 ~每天进步一点点~ 阅读(153) 评论(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"].public cl... 阅读全文
posted @ 2015-08-08 15:16 ~每天进步一点点~ 阅读(126) 评论(0) 推荐(0)
摘要:Implement a basic calculator to evaluate a simple expression string.The expression string contains onlynon-negativeintegers,+,-,*,/operators and empty... 阅读全文
posted @ 2015-08-08 14:54 ~每天进步一点点~ 阅读(489) 评论(0) 推荐(0)
摘要:Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1/** * Definition for a binary tree node... 阅读全文
posted @ 2015-08-08 14:16 ~每天进步一点点~ 阅读(93) 评论(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.top()... 阅读全文
posted @ 2015-08-08 14:04 ~每天进步一点点~ 阅读(129) 评论(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-08-08 13:17 ~每天进步一点点~ 阅读(211) 评论(0) 推荐(0)
摘要:Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corner as shown ... 阅读全文
posted @ 2015-08-07 23:22 ~每天进步一点点~ 阅读(112) 评论(0) 推荐(0)

1 2 3 4 5 ··· 12 下一页