0%

问题描述

给定一个数组,定义它的旋转数组为 f(k) = k * a[0] + (k + 1) * a[1] + (k + 2) * a[2] + ... + (n - 1) * a[n - k - 1] + 0 * a[n - k] + 1 * a[n - k + 1] + ... ,比如对于数组 [4,3,2,6],其旋转数组为:f(0) = 0 * 4 + 1 * 3 + 2 * 2 + 3 * 6 = 25f(1) = 1 * 4 + 2 * 3 + 3 * 2 + 0 * 6 = 16f(2) = 2 * 4 + 3 * 3 + 0 * 2 + 1 * 6 = 23f(3) = 3 * 4 + 0 * 3 + 1 * 2 + 2 * 6 = 26 要求找出最大的旋转数组的值。题目链接:**点我**

阅读全文 »