Brossh Interview Question
Developer Program EngineersCountry: Isreal
Interview Type: Written Test
#include<stdio.h>
#include<stdlib.h>
void main()
{
int i, j, *arr, c=0, s=0;
printf("Enter the number of elements: ");
scanf("%d", &i);
arr=(int *)malloc(i*sizeof(int));
for(j=0; j<i; j++)
{
printf("Enter the element no. %d: ", j+1);
scanf("%d", &arr[j]);
}
for(j=0; j<i; j++)
{
if(arr[j]<arr[j+1])
c++;
else
{
if(c>s)
s=c;
c=0;
}
}
printf("The largest sequence is: %d", s+1);
}
see if this works
Python script:
- Practitioner December 11, 2018