- 博客(20)
- 资源 (16)
- 收藏
- 关注
原创 iOS开发——全局响应MotionEvent
遇到这样一个需求:应用无论处于哪个view controller,摇动手机,都能够出发某一方法。能够想到的思路就是用苹果封装好的“MotionEvent”,但是如果简单的把一下代码加到某一view controller中,那么只有在该view controller展示在前端时,摇动手机才会出发方法。- (BOOL)canBecomeFirstResponder {//默认是NO,所以得重写
2014-06-26 20:50:20 5677
原创 [LeetCode] Sum Root to Leaf Numbers
题目:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find
2014-06-17 22:22:40 850
原创 [LeetCode] Minimum Depth of Binary Tree
题目:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
2014-06-16 10:39:23 764
原创 [LeetCode] Remove Duplicates from Sorted Array II
题目:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is no
2014-06-16 09:46:19 758
原创 [LeetCode] Balanced Binary Tree
题目:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node ne
2014-06-15 11:22:55 783
原创 [LeetCode] Path Sum
题目:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree
2014-06-15 10:53:43 681
原创 [LeetCode] Container With Most Water
题目:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i,
2014-06-15 09:24:47 740
原创 [LeetCode] Linked List Cycle II
题目:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?解答:
2014-06-14 16:05:54 758
原创 [LeetCode] Minimum Path Sum
题目:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or
2014-06-14 14:35:30 693
原创 [LeetCode] Best Time to Buy and Sell Stock
题目:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of th
2014-06-14 08:59:01 1420
原创 [LeetCode] Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the
2014-06-12 23:30:50 664
原创 [LeetCode] Search a 2D Matrix
题目:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first intege
2014-06-10 18:30:39 658
原创 [LeetCode] Binary Tree Postorder Traversal [递归版]
题目:Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recurs
2014-06-10 15:54:03 582
原创 [LeetCode] Permutations
题目:Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].解答:
2014-06-10 14:43:13 618
原创 [LeetCode] Plus One
题目:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.解答
2014-06-08 16:41:39 1506
原创 [LeetCode] Rotate Image
题目:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?解答:class Solution {public: void rotat
2014-06-08 15:30:43 634
原创 [LeetCode] Generate Parentheses
题目:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(()
2014-06-07 16:32:08 646
原创 [LeetCode] Sort Colors
题目:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the
2014-06-04 08:37:37 634
原创 [LeetCode] Symmetric Tree
题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3
2014-06-03 16:20:00 759
原创 [LeetCode] Gray Code
题目:The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the seque
2014-06-03 08:49:19 794
WBS Chart pro 4.8
2012-01-04
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人