Posts

Showing posts from July, 2020

WIPRO TECHNICAL PAPER

              WIPRO TECHNICAL PAPER Program 1: Sub Topic: Arrays Sliding Window Given an array of numbers and a window of size k. Print the maximum of numbers inside the window for each step as the window moves from the beginning of the array. Input Format Input contains the array size , no of elements and the window size Output Format print the maximum of numbers Constraints 1 <= size <= 1000                     Sample Input 1 8 1 3 5 2 1 8 6 9 3 Sample Output 1 5 5 5 8 8 9 Solution: #include<stdio.h> #include<limits.h> int main() {    int size , arr[1000],ws,ctr,max = INT_MIN,ctr1;    scanf("%d",&size);    for( ctr = 0 ; ctr< size ; ctr++)       scanf("%d ",&arr[ctr]);   scanf("%d",&ws);   for( ctr = 0 ; ctr<= size - ws ; ctr++)      {           for( ctr1 = 0 ; ctr1 < ws ; ctr1++)           {                if( max < arr[ctr+ctr1])