时间复杂度:

https://www.nowcoder.com/discuss/610868392987316224