Skip to content

Commit 41118c7

Browse files
authored
style: format python code in markdown files (#1040)
1 parent 01cf6af commit 41118c7

File tree

244 files changed

+17104
-16780
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+17104
-16780
lines changed

Pipfile

Lines changed: 0 additions & 12 deletions
This file was deleted.

Pipfile.lock

Lines changed: 0 additions & 134 deletions
This file was deleted.

lcci/16.19.Pond Sizes/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ p[find(a)] = find(b)
5656
p = list(range(n))
5757
size = [1] * n
5858

59+
5960
# 返回x的祖宗节点
6061
def find(x):
6162
if p[x] != x:
6263
# 路径压缩
6364
p[x] = find(p[x])
6465
return p[x]
6566

67+
6668
# 合并a和b所在的两个集合
6769
if find(a) != find(b):
6870
size[find(b)] += size[find(a)]
@@ -76,6 +78,7 @@ if find(a) != find(b):
7678
p = list(range(n))
7779
d = [0] * n
7880

81+
7982
# 返回x的祖宗节点
8083
def find(x):
8184
if p[x] != x:
@@ -84,6 +87,7 @@ def find(x):
8487
p[x] = t
8588
return p[x]
8689

90+
8791
# 合并a和b所在的两个集合
8892
p[find(a)] = find(b)
8993
d[find(a)] = distance

lcof/面试题06. 从尾到头打印链表/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class Solution:
5959
# self.val = x
6060
# self.next = None
6161

62+
6263
class Solution:
6364
def reversePrint(self, head: ListNode) -> List[int]:
6465
if head is None:

lcof/面试题24. 反转链表/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class Solution:
6666
# self.val = x
6767
# self.next = None
6868

69+
6970
class Solution:
7071
def reverseList(self, head: ListNode) -> ListNode:
7172
if head is None or head.next is None:

lcof/面试题25. 合并两个排序的链表/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class Solution:
7272
# self.val = x
7373
# self.next = None
7474

75+
7576
class Solution:
7677
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
7778
if l1 is None or l2 is None:

lcof/面试题27. 二叉树的镜像/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class Solution:
7474
# self.left = None
7575
# self.right = None
7676

77+
7778
class Solution:
7879
def mirrorTree(self, root: TreeNode) -> TreeNode:
7980
if root is None:

lcof/面试题51. 数组中的逆序对/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class BinaryIndexedTree:
9494
x -= x & -x
9595
return s
9696

97+
9798
class Solution:
9899
def reversePairs(self, nums: List[int]) -> int:
99100
alls = sorted(set(nums))

lcof/面试题55 - I. 二叉树的深度/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class Solution:
6262
# self.left = None
6363
# self.right = None
6464

65+
6566
class Solution:
6667
def maxDepth(self, root: TreeNode) -> int:
6768
def dfs(root):

lcof/面试题68 - I. 二叉搜索树的最近公共祖先/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,11 @@ class Solution:
8484
# self.left = None
8585
# self.right = None
8686

87+
8788
class Solution:
88-
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
89+
def lowestCommonAncestor(
90+
self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode'
91+
) -> 'TreeNode':
8992
if root.val < p.val and root.val < q.val:
9093
return self.lowestCommonAncestor(root.right, p, q)
9194
if root.val > p.val and root.val > q.val:

0 commit comments

Comments
 (0)