I use leetcode now about this syntax.
This abnormal when I open the Plugin name of Python for VSCode.
This normal when I close the Plugin name of Python for VSCode.
This is code:
class Solution:
def __init__(self):
self.total = 0
def convertBST(self, root: 'TreeNode') -> 'TreeNode':
if root is not None:
self.convertBST(root.right)
self.total += root.val
root.val = self.total
self.convertBST(root.left)
return root
# 优化
# Runtime: 80 ms, faster than 99.43% of Python3 online submissions for Convert BST to Greater Tree.
# Memory Usage: 14.9 MB, less than 2.62% of Python3 online submissions for Convert BST to Greater Tree.
I use leetcode now about this syntax. This abnormal when I open the Plugin name of Python for VSCode.
This normal when I close the Plugin name of Python for VSCode. This is code: