[Java] Combinatorics Solution
\nclass Solution {\n    public String kthSmallestPath(int[] destination, int k) {\n        StringBuilder sb = new StringBuilder();\n        int n = destination[
```\nclass Solution {\n    public String kthSmallestPath(int[] destination, int k) {\n        StringBuilder sb = new StringBuilder();\n        int n = destination[0] + destination[1];\n        for (int i = 0; i < n; i++) {\n            long cnt = comb(n - i - 1, destination[0]); //look at the subsequent possible characters after this one. n - i - 1.\n            if (destination[0] == 0) {\n                sb.append(\'H\');\n                destination[1]--;\n                continue;\n            }\n            if (destination[1] == 0) {\n                sb.append(\'V\');\n                destination[0]--;\n                continue;\n            }\n            if (k <= cnt) {\n                destination[1]--;\n                sb.append(\'H\');\n            }\n            else {\n                destination[0]--;\n                k -= cnt;\n                sb.append(\'V\');\n            }\n        }\n        return sb.toString();\n    }\n    \n    private long comb(int n, int k) {\n        long res = 1;\n        for (int i = 0; i < k; i++) {\n            res *= n - i; // getting rid of n - k and onwards.\n            res /= i + 1; // including division of k!.\n        }\n        return res;\n    }\n}\n```
[]