We get the following sequence (ie, for n = 3): "123" "132" "213" "231" "312" "321" Given n and k, return the kth permutation sequence. Note: Given n will be between 1 and 9 inclusive. Thoughts Java Solution 1 public class Solution { public String getPermutation(int n, int k) { // initialize all numbers ArrayList
Read full article from LeetCode – Permutation Sequence (Java)
No comments:
Post a Comment