LeetCode 238 Product of Array Except Self

2017-03-08
阅读 2 分钟
2.5k
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n).

Leet code -- Combination Sum系列整理

2017-03-08
阅读 7 分钟
4k
Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C unlimited number of times.例如: [2, 3, 6, 7] and target 7

雅虎面试题-无限排序数组查找

2017-03-07
阅读 2 分钟
5k
You are given an infinite array A[] in which the first n cells contain integers in sorted order and the rest of the cells are filled with ∞. You are not given the value of n. Describe an algorithm that takes an integer x as input and finds a position in the array containing x, if such a position ...

排序算法终极汇总

2017-03-05
阅读 28 分钟
6k
本文对9种排序方法进行汇总。分别是: 插入排序 选择排序 归并排序 冒泡排序 堆排序 快排序 计数排序 基数排序 桶排序。参照《算法》第四版这本书,把排序需要的公共的方法抽象出来,做一个抽象类,讨论到的各个排序类对抽象类进行继承,只需关注与排序本身的业务逻辑即可。[链接]