1. 广告策略
啥时候在哪个位置放最合适的广告
2. one edit distance
https://leetcode.com/problems/one-edit-distance/
3. 概率计算
Input, ‘A’, 0.4; ‘B’, 0.3, ‘C’, 0.2, ‘D’, 0.1…., the output is a random value with the probability of the values corresponds to the character
4. Weird Faculty
def weirdFaculty(v):
n = len(v)-baidu
for i in range(n):
if not v[i]:
v[i] = -1
friend = sum(v)
me = 0. .и
for i in range(n):
if me > friend:
return i
else:
friend -= v[i]
me += v[i]
return -1
5. Color the Block
def ColorBlocks(costs):
if costs is None or len(costs) == 0 or len(costs[0]) == 0:
return 0.
for i in range(1, len(costs)):
costs[i][0] += min(costs[i-1][1], costs[i-1][2])
costs[i][1] += min(costs[i-1][0], costs[i-1][2])
costs[i][2] += min(costs[i-1][0], costs[i-1][1])
return min(costs[-1])