"Coding is just like talking to a unknown girl. Once you talked to her with guts, the next time you'll never afraid",Really? Yes , try it Now !!!
Everything here is for education and learning purpose only , individual holds rights on outer posts/links etc.
Team Cracking The Code
About Me
▼
Thursday, February 24, 2011
Given an array and an integer k, find the maximum for each and every contiguous sub array of size k.
Sample Input : 1 2 3 1 4 5 2 3 6 3 [ value of k ]
Sample Output : 3 3 4 5 5 5 6
#include
using namespace std;
int max(int a[],int r,int pos) { int m=a[pos]; int i=0; for(i=pos+1;i { if(a[i]>m) { m=a[i]; }
}
return m; } void maxi(int a[],int r,int pos) { int m;
No comments:
Post a Comment
Hi thanks , we will get back to you shortly !!!