diff --git a/E_121_BestTimetoBuyandSellStock.java b/E_121_BestTimetoBuyandSellStock.java new file mode 100644 index 0000000..c4dd382 --- /dev/null +++ b/E_121_BestTimetoBuyandSellStock.java @@ -0,0 +1,21 @@ +class Solution { + public int maxProfit(int[] prices) { + int min=100000; + int max=-1; + int diff=0; + for(int i: prices){ + if(idiff){ + diff=max-min; + } + + } + } + return diff; + } +} \ No newline at end of file