I want to get the power of an matrix. I mean lets say my matrix is A i
wanna get the A ^k.
I have though the simple algorithm that gives me O(n^3).I though I could do
some kind of a change to modify it and be faster. I could use the algorithm
that is used to get the power of a number that
Just to make sure I understood your code that if means that in case the k
is an odd number just multiply the accumulator 1 time with the val and
continue with even k.A question I have is if a recursive implementation
of this would be any faster?
Τη Σάββατο, 19 Ιανουαρίου 2013 1:06:25 μ.μ.
Consider an array of N integers. Find the longest contiguous subarray
so that the average of its elements is greater than a given number k
I know the general brute force solution in O(N^2). Is there any
efficient solution using extra space?
--
, 9892159511
Oracle Corporation
On Tue, Nov 20, 2012 at 10:43 PM, Koup anasta...@gmail.com
javascript:wrote:
Consider an array of N integers. Find the longest contiguous subarray
so that the average of its elements is greater than a given number k
I know the general brute force solution
it does
the division 29/6 that is lower than k = 5 .
Τη Τρίτη, 20 Νοεμβρίου 2012 8:28:33 μ.μ. UTC+2, ο χρήστης Sachin Chitale
έγραψε:
Sorry Koup,
Plz ignore previous code, it has errors use below code
public class Kadanes {
static int maxAvgSum(int a[], int k) {
int max_so_far = 0
To be correct I need the longest subarray that has an average greater than
k but my main problem here is to find the longest one. Thank you !
--