Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int arr[]={5,4,-3,1,7,2,3,-20};
- int n=sizeof(arr)/sizeof(arr[0]);
- vector<int> v[n];
- int i,j=0;
- v[0].push_back(arr[0]);
- for(i=1;i<n;i++){
- if(arr[i]>arr[i-1]){
- v[j].push_back(arr[i]);
- }
- else{
- j++;
- v[j].push_back(arr[i]);
- }
- }
- int bigsize=0,bigindex,h;
- for(i=0;i<=j;i++){
- h=v[i].size();
- if(h>bigsize){
- bigsize=h;
- bigindex=i;
- }
- }
- printf("Length : %d\n",bigsize);
- printf("largest sequence: ");
- for(i=0;i<v[bigindex].size();i++){
- printf("%d ",v[bigindex][i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement