Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

find maximum contiguous Sub arrays

#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int arr[n];
    for(int i =0;i< n;i++){
        cin >> arr[i];
    }
    
    for (int i = 0; i < n; i++)
    {
        for (int j = i; j < n; j++)
        {
            for (int k = i; k <= j; k++)
            {
                cout << arr[k] << " ";
            }
            cout << endl;
        }
        
    }
    

    return 0;
}
 
PREVIOUS NEXT
Tagged: #find #maximum #contiguous #Sub #arrays
ADD COMMENT
Topic
Name
6+3 =