← 返回 oracle 的题目列表List All LRU Cache Possibilities
类型:online_judge
Design an algorithm to output all possible arrangements of an LRU cache with a given capacity. Implement LRU Cache, and based on it, generate all possibilities for a given input scenario. If the capacity is n, the number of cache possibilities is n!.
Input:
an integer, n.
Output:
list of all possible LRU cache states when n items are added sequentially.
Test Case
Input
3
Output
[[1,2,3], [2,3,1], [3,1,2], [1,3,2], [3,2,1], [2,1,3]]
Constraints
1 <= n <= 5
Example
Input
1