文章作者:Tyan
博客:noahsnail.com | CSDN | 简书
1. Description
2. Solution
解析:Version 1、Version 2都超时,Version 3、Version 4可以通过,Version 4效率高于Version 3。
- Version 1
1 | class Solution: |
- Version 2
1 | class Solution: |
- Version 3
1 | class Solution: |
- Version 4
1 | class Solution: |