vivekveeriah
BAN USERA simple solution in C with linear time complexity
The given array is A = {10, 3, 6, 8, 9, 4, 3}
int max = 0;
int res = 0;
for(int i = n - 1; i >= 0; i--)
{
if(A[i] > max)
max = A[i];
int tempdiff = max - A[i];
if(tempdiff > res)
res = tempdiff; // this gives the maximum difference in the array
}
Repdianacloweryd, Developer Program Engineer at Accolite software
I am Diana from Reston USA . I work as an Agricultural and food science technician in Jumbo Sports. I help ...
Repmarisamsan7, Cloud Support Associate at ADP
Hi, I am Photoengraver from an CO,USA. I am a girl with a strong desire to travel the world ...
Repkennypmillerk, AT&T Customer service email at 247quickbookshelp
My name is Kenny and I am working as a trusted investor in Pittsburgh USA.I identify / set up a ...
Modified the MergeSort algorithm for this problem - Time Complexity - O(nlogn)
- vivekveeriah January 28, 2015