摘要: 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-08-02 21:11 irun 阅读(130) 评论(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-02 20:08 irun 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 217 - Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any value appears a... 阅读全文
posted @ 2015-08-02 15:00 irun 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9 to 4 / \ 7 2 / \ / \9 6 3 1Notice:Google: 90% of our engineers... 阅读全文
posted @ 2015-08-02 14:16 irun 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 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-02 13:56 irun 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 232 - Implement Queue using StacksImplement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- R... 阅读全文
posted @ 2015-08-02 13:11 irun 阅读(139) 评论(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"].My Soluti... 阅读全文
posted @ 2015-07-29 23:40 irun 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Description:Count the number of prime numbers less than a non-negative number,n.Hint:Let's start with aisPrimefunction. To determine if a number is pr... 阅读全文
posted @ 2015-07-28 23:02 irun 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of two.Solution:一个整数如果是2的整数次方,那么它的二进制表示中有且只有一位是1,而其他所有位都是0。把这个整数与这个整数减去1之后进行与运算,那么这个整... 阅读全文
posted @ 2015-07-27 23:04 irun 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 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-27 22:49 irun 阅读(117) 评论(0) 推荐(0) 编辑