leetcode -. 441 arranged coins

 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
When execution: 1752 ms, beat the 16.57% of users in all Python3 submission
Memory consumption: 13.8 MB, beat the 5.41% of users in all Python3 submission
 
Today completed the first four questions!
Come on!
                                                                                                       ——2019.9.27

Guess you like

Origin www.cnblogs.com/taoyuxin/p/11596462.html