@@ -0,0 +1,359 @@
+package leetcode;%0A%0Apublic class Java121 %7B%0A%09public int maxProfit_121(int%5B%5D prices) %7B%0A%09%09if(prices.length %3C= 1) return 0;%0A%09%09int min = prices%5B0%5D;%0A%09%09int profit = prices%5B1%5D - prices%5B0%5D;%0A%09%09for(int i = 2; i %3C prices.length; i++)%7B%0A%09%09%09min = Math.min(min, prices%5Bi-1%5D);%0A%09%09%09profit = Math.max( profit, prices%5Bi%5D- min);%0A%09%09%7D%0A%09%09if(profit %3C 0) return 0;%0A%09%09return profit;%0A%09%7D%0A%7D%0A

add leet code java 121