Skip to content

Commit bdd79ea

Browse files
committed
remove hashmap solution
1 parent 128a8be commit bdd79ea

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

exhaustive_search/permutation_index.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Example
1313
Given [1,2,4], return 1.
1414
```
1515

16-
## 题解1 - 双重 for 循环
16+
## 题解
1717

1818
做过 next permutation 系列题的话自然能想到不断迭代直至最后一个,最后返回计数器的值即可。这种方法理论上自然是可行的,但是最坏情况下时间复杂度为 $$O(n!)$$, 显然是不能接受的。由于这道题只是列出某给定 permutation 的相对顺序(index), 故我们可从 permutation 的特点出发进行分析。
1919

@@ -108,9 +108,6 @@ public class Solution {
108108

109109
双重 for 循环,时间复杂度为 $$O(n^2)$$. 使用了部分额外空间,空间复杂度 $$O(1)$$.
110110

111-
## 题解2 - 哈希表
112-
113111
## Reference
114112

115113
- [Permutation Index](http://www.geekviewpoint.com/java/numbers/permutation_index)
116-
- [permutation-index | 九章算法](http://www.jiuzhang.com/solutions/permutation-index/)

0 commit comments

Comments
 (0)