Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3469a79

Browse files
one line get max matrix val
1 parent 2c8a81b commit 3469a79

File tree

1 file changed

+2
-0
lines changed
  • docs/19_python内置常用算法和数据结构

1 file changed

+2
-0
lines changed

‎docs/19_python内置常用算法和数据结构/builtins.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ presums = list(accumulate([1,2,3])) # [1, 3, 6]
128128
allsum = sum(map(sum, matrix)) # 或者 allsum = sum((sum(row) for row in matrix))
129129
# 一行代码判断一个元素是否在矩阵中,比如判断 1 是否在矩阵matrix中
130130
any(1 in row for row in matrix)
131+
# 一行代码获取矩阵最大、最小值
132+
maxval = max(map(max, matrix))
131133
```
132134

133135
# python dict 技巧

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /