(int[] prices)
| 1 | class Solution |
| 2 | { |
| 3 | public int maxProfit(int[] prices) |
| 4 | { |
| 5 | if(prices.length<=1) return 0; |
| 6 | int min=prices[0]; |
| 7 | int profit=0; |
| 8 | for(int i=1;i<prices.length;i++) |
| 9 | { |
| 10 | if(prices[i]<min) |
| 11 | { |
| 12 | min=prices[i]; |
| 13 | } |
| 14 | else |
| 15 | { |
| 16 | if(prices[i]-min>profit) profit=prices[i]-min; |
| 17 | } |
| 18 | } |
| 19 | return profit; |
| 20 | } |
| 21 | } |
nothing calls this directly
no outgoing calls
no test coverage detected