从输入导入列表
def find_peak(m: List[List[int]]) -> List[int]:
"""
Given an non-empty elevation map m, returns the cell of the
highest point in m.
Examples (note some spacing has been added for human readablity)
>>> m = [[1,2,3],
[9,8,7],
[5,4,6]]
>>> find_peak(m)
[1,0]
>>> m = [[6,2,3],
[1,8,7],
[5,4,9]]
>>> find_peak(m)
[2,2]
"""
max_location = []
for sublist in m:
max_location.append(max(sublist))
max_location = max(max_location)
for sublist in m:
if max_location in sublist:
return (m.index(max_location),sublist.index(max_location))
这并没有真正起作用,因为它只是返回该数字不在列表中
泛舟湖上清波郎朗
蓝山帝景
杨__羊羊
相关分类