class Solution {
public int maxProfit(int[] prices) {
int minprice=Integer.MAX_VALUE;
int maxprofit=0;
for(int i=0;imaxprofit){
maxprofit=prices[i]-minprice;
}
}
return maxprofit;
}
}



