阿里搜索部面试
https://blog.csdn.net/kaikai_sk/article/details/90216539
买卖股票的最佳时机
https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/
class Solution:
def maxProfit(self, prices: List[int]) -> int:
n = len(prices)
if n < 2:
return 0
ret = [0] * n
for i in range(n-1):
tmp = sorted(prices[(i+1):])
if tmp[-1] > prices[i]:
ret[i] = tmp[-

这篇博客分享了阿里搜索部的面试经验,包括买卖股票的最佳时机和最大子序和的编程问题。买卖股票问题要求确定最佳买卖时刻以最大化利润,最大子序和问题可通过动态规划求解当前最大得分。此外,还提到了202阿里巴巴实习笔试的编程题目,涉及怪物击杀策略和二进制串翻转操作。
最低0.47元/天 解锁文章
656

被折叠的 条评论
为什么被折叠?



