【Leetcode】Permutation Sequence.pdfVIP

  • 21
  • 0
  • 约4.26千字
  • 约 4页
  • 2017-09-16 发布于浙江
  • 举报
为为梦梦起起航航 不不积积小小流流无无以以成成江江海海 【【LLeeeettccooddee】】PPeerrmmuuttaattiioonn SSeeqquueennccee 类: leetcode 2013-12-17 21:20 136人阅读 评论 (0) 收藏 举报 全排列leetcode The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following sequence (ie, for n = 3 : 1. 123 2. 132 3. 213 4. 231 5. 312 6. 321 Given n and k, return the kth permutation sequence. Note: Given n will be between 1 and 9 inclusive. 题意:在给定数字n的全排列中找到第k个字符串,并返回。 关键点:1)设num=(k-1 /factorial,factorial是1至n-1的乘积。可以知道第一个 数就

文档评论(0)

1亿VIP精品文档

相关文档