- 博客(40)
- 收藏
- 关注
原创 [LeetCode]19. Remove Nth Node From End of List
19. Remove Nth Node From End of List Given a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After removing the seco
2016-04-17 22:28:59 536
原创 [LeetCode]61. Rotate List
61. Rotate List Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.分析链表旋转问题,不像数组容易知道数组长度,链表只
2016-04-17 21:22:36 439
原创 [LeetCode]82. Remove Duplicates from Sorted List II
82. Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2->3->3
2016-04-17 20:26:40 430
原创 [LeetCode]80. Remove Duplicates from Sorted Array II
80. Remove Duplicates from Sorted Array II Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given sorted array nums = [1,1,1,2,2,3],Your functio
2016-04-17 17:36:50 409
原创 [LeetCode]83. Remove Duplicates from Sorted List
83. Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return
2016-04-17 17:30:34 446
原创 [LeetCode]86. Partition List
86. Partition List Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of
2016-04-17 17:09:31 368
原创 [LeetCode] 92. Reverse Linked List II
92. Reverse Linked List II Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note:Given
2016-04-17 16:14:49 543
原创 [LeetCode]206. Reverse Linked List
206. Reverse Linked List Reverse a singly linked list. A linked list can be reversed either iteratively or recursively. Could you implement both?分析翻转链表可以通过迭代方式也可以通过递归方式。递归方式主要是确定递归退出条件,当head为空时返回空,当
2016-04-17 14:10:44 431
原创 [LeetCode]2. Add Two Numbers
2. Add Two Numbers You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and
2016-04-17 13:23:53 404
原创 [LeetCode]137. Single Number II
137. Single Number II Given an array of integers, every element appears three times except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you impl
2016-04-17 12:09:16 458
原创 [LeetCode]136. Single Number
136. Single Number Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it
2016-04-17 11:28:38 494
原创 [LeetCode]135. Candy
135. Candy There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements: Each child must have
2016-04-17 11:15:16 383
原创 [LeetCode]134. Gas Station
134. Gas Station here are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel fro
2016-04-17 10:33:58 469
原创 [LeetCode]73. Set Matrix Zeroes
73. Set Matrix Zeroes Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight forward solution using O(mn) space i
2016-04-17 09:59:27 581
原创 [LeetCode]89. Gray Code
89. 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 t
2016-04-17 00:57:55 496
原创 [LeetCode]70. Climbing Stairs
70. Climbing Stairs You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?分析题目要求给出爬到
2016-04-16 23:29:47 354
原创 [LeetCode]66. Plus One
66. 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.分析一个非负整数的
2016-04-16 23:00:03 439
原创 [LeetCode]48. Rotate Image
48. 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?分析题目要求将一个n x n 的二维矩阵进行顺时针90度旋转,直接思
2016-04-16 22:41:02 373
原创 [LeetCode]189. Rotate Array
189. Rotate Array Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].分析题目需要旋转一个数组,使得右边的k个元素不变序的搬到数组头部。
2016-04-16 21:30:40 544
原创 [LeetCode]42. Trapping Rain Water
42. Trapping Rain Water Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1
2016-04-16 19:53:12 553
原创 [LeetCode]36. Valid Sudoku
36. Valid Sudoku Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’. Note:
2016-04-15 09:24:06 351
原创 [LeetCode]60. Permutation Sequence
60. Permutation Sequence The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123"
2016-04-15 00:21:30 514
原创 [LeetCode]282. Expression Add Operators
282. Expression Add Operators Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between the digits so they evalu
2016-04-13 01:29:08 699
原创 [LeetCode]27. Remove Element
27. Remove Element Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you must do this in place with
2016-04-13 01:16:47 551
原创 [LeetCode]31. Next Permutation
31. Next Permutation Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it
2016-04-13 01:05:44 448
原创 [LeetCode]128. Longest Consecutive Sequence
128. Longest Consecutive Sequence Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive
2016-04-10 22:51:05 307
原创 [LeetCode]4. Median of Two Sorted Arrays
4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n
2016-04-10 22:35:20 336
原创 [LeetCode]16. 3Sum Closest
16. 3Sum Closest Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input
2016-04-10 22:04:57 399
原创 [LeetCode]81. Search in Rotated Sorted Array II
81. Search in Rotated Sorted Array II Follow up for “Search in Rotated Sorted Array”: What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a function
2016-04-10 21:43:16 466
原创 [LeetCode]33. Search in Rotated Sorted Array
Search in Rotated Sorted Array Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target value to search.
2016-04-10 20:00:21 388
原创 [LeetCode]259. 3Sum Smaller
259. 3Sum Smaller Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition nums[i] + nums[j] + nums[k] < target.
2016-04-10 01:45:28 1141
原创 [LeetCode]1. Two Sum
Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution.Example:Given nums
2016-04-09 23:15:50 494
原创 [LeetCode]15. 3Sum
3Sum Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
2016-04-09 22:33:14 413
原创 JSPatch源码剖析(一)
项目中使用到了JSPatch来实现线上APP bug的hot fix,使用后觉得JSPatch短小精悍并且功能强大,于是想往里窥探下其实现机制。本文从JSPatch的使用角度去分析源码。
2016-02-19 16:10:42 1554
原创 ios多线程编程知识小集
iOS多线程编程知识小集iOS为开发者提供了丰富的多线程编程机制,从最直接最简单的调用NSObject的performSelector系列API,到NSThread、Operation Queues以及Dispatch Queues,当然iOS也支持更原始的pthread。本文主要讨论使用这些多线程编程机制时候的一些注意事项
2015-10-27 14:15:50 506
原创 iOS App崩溃日志分析
APP新版本上线之前,一般都会经过测试团队的反复测试,确认无bug后才会发布。发布那刻作为开发人员的你,估计欣喜若狂吧,自豪吧!!。发布后线上运行好长一段时间,均安然无恙,可突然有一天你们家CEO说,自家APP崩了,出现闪退了。那一刻在CEO面前感觉弱爆了的感觉有木有啊?着急了吧,抓狂了吧,F**K it, 怎么解决呢?君不必太过忧伤,且听我给你细说。获取iOS APP崩溃日志你造吗,iOS系统会生
2015-08-24 10:11:57 3942
原创 iOS Tips(持续更新)
持续更新工作中碰到的iOS相关编程陷进和知识点1. #import和@class2. NS_ENUM和NS_OPTIONS3. NSKeyedArchive归档失败
2015-08-12 22:47:51 555
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人