HackerRank: Array Manipulation
Tags: hackerrank, 紮馬步
Array Mainpulation
-
python
- 沒過時間複雜度 TAT!!!
# Complete the arrayManipulation function below.
def arrayManipulation(n, queries):
# n:
# 3 ~ 10^7 lol......
base = [0] * n
# queries:
# 1 ~ 2 * 10^5 lol....
for q_list in queries:
start = q_list[0] - 1
end = q_list[1]
operator = q_list[2]
base[start: end] = [ i + operator for i in base[start: end] ]
return max(base)