Sliding Window
Blind 75
Best Time to Buy & Sell Stock
Question

Drawing Explanation

code
public class BestTimeToBuySellStock {
public int maxProfit(int[] prices) {
int sell = 0;
int buy = Integer.MAX_VALUE;
for (int price: prices) {
if (price < buy) {
buy = price;
}
else {
sell = Math.max(sell, price - buy);
}
}
return sell;
}
}
Longest Substring Without Repeating Characters
Question
Drawing Explanation
Code
Longest Repeating Character Replacement
Question
Drawing Explanation
Code
Minimum Window Substring
Question
Drawing Explanation
Code
Last updated