摘要: Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... Notice Please complete the problem in-place. 阅读全文
posted @ 2016-07-12 23:56 北叶青藤 阅读(275) 评论(0) 推荐(0) 编辑
摘要: Check if two binary trees are identical. Identical means the two binary trees have the same structure and every identical position has the same value. 阅读全文
posted @ 2016-07-12 07:23 北叶青藤 阅读(249) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return all root-to-leaf paths. Example Given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: [ "1->2->5", "1 阅读全文
posted @ 2016-07-12 07:21 北叶青藤 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2016-07-12 06:49 北叶青藤 阅读(426) 评论(0) 推荐(0) 编辑
摘要: Factory is a design pattern in common usage. Implement a ShapeFactory that can generate correct shape. You can assume that we have only tree different 阅读全文
posted @ 2016-07-12 06:37 北叶青藤 阅读(502) 评论(0) 推荐(0) 编辑
摘要: A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded messag 阅读全文
posted @ 2016-07-12 02:45 北叶青藤 阅读(223) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example Given n = 12, retu 阅读全文
posted @ 2016-07-12 02:04 北叶青藤 阅读(242) 评论(0) 推荐(0) 编辑
摘要: House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constrain 阅读全文
posted @ 2016-07-12 00:26 北叶青藤 阅读(229) 评论(0) 推荐(0) 编辑