I've added 4 new challenges to our ranked mode, one hard and three medium ones. The hard one is about finding word combinations in a 2D character matrix, it uses a depth-first search strategy. Two of the medium ones are about stock trading, below is a sample.
function maxProfit(prices) {
let profit = 0;
for(let i = 1; i < prices.length; i++) {
if (prices[i] > prices[i -1]) {
profit = profit + prices[i] - prices[i - 1];
}
}
return profit;
}
let arr = [7,5,3,2,1,4,5]
let A = maxProfit(arr);
// A = ?
Top comments (0)