package com.Long class Solution { private int Max=0; public int maxProfit(int[] prices) { for(int i=1;i<prices.length;++i) { if(prices[i]-prices[i-1]>0) { Max+=prices[i]-prices[i-1]; } } return Max; } } public class Main{ public static void main(String[] args) { } }