摘要: Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer... 阅读全文
posted @ 2015-08-02 21:56 irun 阅读(120) 评论(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-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) 编辑