题目 :http://acm.bnu.edu.cn/v3/problem_show.php?pid=40489最近做到的一道蛮有意思的题目(codechef现在的题目确实很赞了)题意 :中文题面 (cc的一大好处就是有中文翻译,嘿嘿)区间Max = max{a_i|gcd(a_i, g) > 1 &...
分类:
其他好文 时间:
2014-10-16 23:35:33
阅读次数:
307
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complet...
分类:
其他好文 时间:
2014-10-16 21:34:53
阅读次数:
240
这个求最大子数组乘积问题是由最大子数组之和问题演变而来,但是却比求最大子数组之和要复杂,因为在求和的时候,遇到0,不会改变最大值,遇到负数,也只是会减小最大值而已。而在求最大子数组乘积的问题中,遇到0会使整个乘积为0,而遇到负数,则会使最大乘积变成最小乘积,正因为有负数和0的存在,使问题变得复杂了不...
分类:
编程语言 时间:
2014-10-16 17:11:32
阅读次数:
274
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-10-16 15:45:42
阅读次数:
189
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-10-16 15:26:02
阅读次数:
169
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine i...
分类:
其他好文 时间:
2014-10-16 14:55:02
阅读次数:
297
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2014-10-16 06:33:22
阅读次数:
238
# Definition for a binary tree node# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right ...
分类:
其他好文 时间:
2014-10-16 03:27:21
阅读次数:
162
1.题目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]...
分类:
编程语言 时间:
2014-10-15 19:29:41
阅读次数:
228
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...
分类:
其他好文 时间:
2014-10-15 12:52:20
阅读次数:
160