leetcode刷题 60 61
        【摘要】      
官方题解  
  
import math
class Solution: def getPermutation(self, n: int, k: int) -> str: nums = list(range(1,n+1)) out = '' while n>1: temp = math.factorial(n-1) #print(k,temp) pos...
    
    
    
    
官方题解
 

 
import math
class Solution: def getPermutation(self, n: int, k: int) -> str: nums = list(range(1,n+1)) out = '' while n>1: temp = math.factorial(n-1) #print(k,temp) pos = (k-1)//temp k = k%temp nn = nums[pos] out += str(nn) nums.remove(nn) n -= 1 return out+str(nums[-1])
  
 - 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 - 8
 - 9
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 

 官方题解
 

class Solution: def rotateRight(self, head: ListNode, k: int) -> ListNode: if not head: return None p=q=head l=1 while p.next: p=p.next l+=1 p.next=head k%=l for _ in range(l-k-1): q=q.next ans=q.next q.next=None return ans		
  
 - 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 - 8
 - 9
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 
文章来源: maoli.blog.csdn.net,作者:刘润森!,版权归原作者所有,如需转载,请联系作者。
原文链接:maoli.blog.csdn.net/article/details/90450746
        【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
            cloudbbs@huaweicloud.com
        
        
        
        
        
        
        - 点赞
 - 收藏
 - 关注作者
 
            
           
评论(0)