
LeetCode
文章平均质量分 89
Fireplusplus
前深信服员工,前鹅厂员工
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Set Matrix Zeroes
只有刷不完的题,没有过不去的坎: 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. 题目意思是给定一个数组,将数组中为0的元素所在的行和列都设置为0. 举个栗子: 给定一个数组: 1 2 3原创 2016-04-22 10:48:13 · 660 阅读 · 0 评论 -
二分查找进阶——循环有序数组查找
(此题出自LeetCode) 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 tar原创 2016-04-20 15:32:46 · 3689 阅读 · 0 评论 -
删除有序数组中重复出现的元素
一起来看看这道题吧: 这是取自LeetCode的一道题,题目大意是给你一个有序的数组,其中有些元素是重复的,且最多出现两次,现在让你写一个函数,把这个数组里重复的那些元素删除一个,留下一个,并返回新的元素个数。 那么这道题就很简单了,因为数组已经是是有序的,我们只需要遍历一遍,将多余的元素删除掉就好了。 接下来就直接贴上函数部分的实现: int remove(int *arr, int原创 2016-04-15 14:12:00 · 4645 阅读 · 0 评论 -
二分查找进阶——循环有序数组查找再进阶——循环有序重复数组查找
就在昨天才刚刚写了一篇关于循环有序数组查找的函数:http://blog.csdn.net/qq_33724710/article/details/51200889 今天又发现了这道题的升级版,迫不及待的拿来和大家分享(依旧来自LeetCode): Remove Duplicates from Sorted Array II Follow up for "Remove Dupli原创 2016-04-21 21:34:30 · 1065 阅读 · 0 评论 -
【LeetCode】Two Sum
TwoSum Given an array of integers,find two numbers such that they add up to a specific target number. The function two Sum should return indices of the two numbers such that they add up to the原创 2016-06-30 23:17:41 · 371 阅读 · 0 评论 -
【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原创 2016-06-19 08:45:31 · 525 阅读 · 0 评论 -
【LeetCode】三道简单的递归问题
1.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-06-19 08:52:47 · 458 阅读 · 0 评论 -
【LeetCode】Combination
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, If n = 4 and k = 2, a solution is: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] 思原创 2016-06-20 19:17:22 · 592 阅读 · 0 评论