Skip to content

Instantly share code, notes, and snippets.

@dyigitpolat
Last active November 8, 2016 22:12
Show Gist options
  • Save dyigitpolat/4b6212b433cbac090dd80cbdfbd2491b to your computer and use it in GitHub Desktop.
Save dyigitpolat/4b6212b433cbac090dd80cbdfbd2491b to your computer and use it in GitHub Desktop.
selam
#include <stdlib.h>
#include <stdio.h>
int main()
{
int* randoms;
long max_length = 0;
long cur_length = 0;
int range = 10000;
long i;
randoms = (int*) malloc( sizeof(int) * 100000000L);
for(i = 0; i < 100000000L; ++i)
{
randoms[i] = rand() % range + 1;
}
for(i = 0; i < 99999999L; ++i)
{
if( randoms[i] < randoms[i+1L])
{
cur_length++;
}
else
{
if( cur_length > max_length)
{
max_length = cur_length;
cur_length = 0;
}
}
}
printf( "%ld\n", max_length);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment