leetcode——441.排列硬币

 1 class Solution:
 2     def arrangeCoins(self, n: int) -> int:
 3         if n<2:
 4             return n
 5         m=1
 6         s=1
 7         while n-m>m:
 8             s=s+1
 9             n,m=n-m,m+1
10         return s
执行用时 :1752 ms, 在所有 Python3 提交中击败了16.57%的用户
内存消耗 :13.8 MB, 在所有 Python3 提交中击败了5.41%的用户
 
今天完成的第4道题!
加油!
                                                                                                       ——2019.9.27

猜你喜欢

转载自www.cnblogs.com/taoyuxin/p/11596462.html