import java.util.*;
class stockbuysell{
//Function to find the days of buying and selling stock for max profit.
public static void main(String []args){
int A[] = {100,180,260,310,40,535,695};
ArrayList al = stockBuySell(A,7);
}
static ArrayList stockBuySell(int A[], int n) {
// code here
// buy = 0;
//sell = 1
ArrayList al = new ArrayList();
int flag = 0;
int idx = 0;
for(int i=1;iA[i-1]){//
al.add(new ArrayList());
al.get(idx).add(i-1);
flag = 1;
}
if(flag == 1 && A
Мобильная версия