JAVA_Best Time to Buy and Sell Stock_LeetCode 121


JAVA_Best Time to Buy and Sell Stock_LeetCode 121

JAVA_Best Time to Buy and Sell Stock_LeetCode 121 Best Time to Buy and Sell Stock 풀이 class Solution { public int maxProfit(int[] prices) { int max=0,min=prices[0]; for(int i=1;i<prices.length;i++) { if(min<prices[i]){ max=Math.max(prices[i]-min,max); }else{ min=prices[i]; } } return max; } } * 출처 Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com...


#BestTimetoBuyandSellStock_LeetCode121 #JAVA #JAVA_BestTimetoBuyandSellStock #JAVA_BestTimetoBuyandSellStock_LeetCode121 #JAVA_LeetCode121

원문링크 : JAVA_Best Time to Buy and Sell Stock_LeetCode 121