Fast java
Intuition\n Describe your first thoughts on how to solve this problem. \nWhen we select H or V we know what rank they should be.\nIf we pick H, when it belongs 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWhen we select H or V we know what rank they should be.\nIf we pick H, when it belongs to combination(h+v-1, h-1)\nelse we should pick V\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nthe most time is used in calculate the combination O(m+n)\nSo the total time is O((m+n)^2)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(M+N) \n\n# Code\n```\nclass Solution {\n    public String kthSmallestPath(int[] destination, int k) {\n        int h = destination[1];\n        int v = destination[0];\n        StringBuilder sb = new StringBuilder();\n        while (h > 0 && v > 0) {\n            long c = comb(h + v - 1, h -1);\n            if (k > c) {\n                sb.append("V");\n                v--;\n                k-=c;\n            } else {\n                sb.append("H");\n                h--;\n            }\n        }\n        while (h > 0) {\n            sb.append("H");\n            h--;\n        }\n        while (v > 0) {\n            sb.append("V");\n            v--;\n        }\n        return sb.toString();\n    }\n\n    private long comb(int m, int n) {\n        long com = 1;\n        for (long i = m - n + 1; i <= m; i++) com*=i;\n        for (long i = 1; i <= n; i++) com/=i;\n        return com;\n    }\n}\n```
['Java']