07 2015 档案

238. Product of Array Except Self
摘要: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-07-31 07:14 shini 阅读(120) 评论(0) 推荐(0)

235. Lowest Common Ancestor of a Binary Search Tree
摘要: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-07-31 04:58 shini 阅读(126) 评论(0) 推荐(0)

234. Palindrome Linked List
摘要: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?先找到链表中点,将第二部分反转,然后比较两部分链表的值。/** * De... 阅读全文

posted @ 2015-07-31 00:56 shini 阅读(168) 评论(0) 推荐(0)

232. Implement Queue using Stacks
摘要: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-07-11 06:43 shini 阅读(106) 评论(0) 推荐(0)

231. Power of Two
摘要:Given an integer, write a function to determine if it is a power of two.Credits:Special thanks to@jianchao.li.fighterfor adding this problem and creat... 阅读全文

posted @ 2015-07-11 06:35 shini 阅读(214) 评论(0) 推荐(0)

58. Length of Last Word
摘要:Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe... 阅读全文

posted @ 2015-07-01 11:00 shini 阅读(173) 评论(0) 推荐(0)

导航