public static String getPermutation2(int n, int k) {
		// Start typing your Java solution below
		// DO NOT write main() function
		boolean[] output = new boolean[n];
		StringBuilder buf = new StringBuilder("");
		int[] res = new int[n];
		res[0] = 1;
		for (int i = 1; i < n; i++)
			res[i] = res[i - 1] * i;
		for (int i : res) {
			System.out.println(i);
		}

		for (int i = n - 1; i >= 0; i--) {
			int s = 1;
			while (k > res[i]) {
				s++;
				k -= res[i];
			}
			for (int j = 0; j < n; j++) {
				if (j + 1 <= s && output[j]) {
					s++;
				}
			}
			output[s - 1] = true;
			buf.append(Integer.toString(s));
		}
		return buf.toString();
	}