Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or ...
分类:
其他好文 时间:
2016-07-24 13:30:42
阅读次数:
116
首先复习一下quicksort. 先理解partition函数,就是选序列的最后一个数作为pivot,比它小的排到它左边,比它大的在它右边,它在中间。但是它左右的部分并没有排序。 返回值是这个pivot所在的位置,pivot所在位置就是它最终的位置,也就是说比如index是5,说明它就是第6大的数。 ...
分类:
其他好文 时间:
2016-07-24 07:01:32
阅读次数:
86
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4],t ...
分类:
其他好文 时间:
2016-07-23 00:36:52
阅读次数:
184
题目描述: Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = ...
分类:
其他好文 时间:
2016-07-20 23:04:27
阅读次数:
290
Description You are given a description of a depot. It is a rectangular checkered field of n?×?m size. Each cell in a field can be empty (".") or it c ...
分类:
其他好文 时间:
2016-07-20 16:18:09
阅读次数:
190
Description You are given a description of a depot. It is a rectangular checkered field of n?×?m size. Each cell in a field can be empty (".") or it c ...
分类:
其他好文 时间:
2016-07-20 11:43:48
阅读次数:
180
Problem: https://leetcode.com/problems/largest-number/ Given a list of non negative integers, arrange them such that they form the largest number. For ...
分类:
其他好文 时间:
2016-07-16 14:11:40
阅读次数:
189
Print numbers from 1 to the largest number with N digits by recursion. Notice It's pretty easy to do recursion like: recursion(i) { if i > largest num ...
分类:
其他好文 时间:
2016-07-16 06:51:53
阅读次数:
108