Solution
C++ []\nclass Solution {\npublic:\n    int getCount(int h, int v)\n    {\n        if(h == 0 || v == 0) return 1;\n        long long res = 1;\n        if(h < v) 
```C++ []\nclass Solution {\npublic:\n    int getCount(int h, int v)\n    {\n        if(h == 0 || v == 0) return 1;\n        long long res = 1;\n        if(h < v) swap(h, v);\n        for(int i = h + 1; i <= (h+v); i++) res *= i;\n        for(int i = 1; i <= v; i++) res /= i;\n        return (int)res;\n    }\n    string kthSmallestPath(vector<int>& dest, int k) {\n        int h = dest[1];\n        int v = dest[0];\n        int len = h + v;\n        string res;\n        for(int i = 0; i < len; i++)\n        {\n            if(h == 0) \n            {\n                v--;\n                res.push_back(\'V\');\n                continue;\n            }\n            if(v == 0) \n            {\n                h--;\n                res.push_back(\'H\');\n                continue;\n            }\n            int cnt = getCount(h - 1, v);\n            if(cnt >= k)\n            {\n                res.push_back(\'H\');\n                h--;\n            }\n            else\n            {\n                k -= cnt;\n                v--;\n                res.push_back(\'V\');\n            }\n        }\n        return res;\n    }\n};\n```\n```Python3 []\nclass Solution:\n    def kthSmallestPath(self, D, K):\n        K -= 1\n        V, H = D\n        ans = \'\'\n        while K and H and V:\n            C = comb(H + V - 1, H - 1)\n            if C <= K:\n                ans, V, K = ans + \'V\', V - 1, K - C\n            else:\n                ans, H = ans + \'H\', H - 1\n        return ans + \'H\' * H + \'V\' * V\n```\n```Java []\nclass Solution {\n    public String kthSmallestPath(int[] destination, int k) {\n        int m = destination[0] + 1;\n        int n = destination[1] + 1;\n        int[][] dp = new int[m][n];\n        for (int i = 0; i < m; i++) dp[i][n-1] = 1; \n        for (int j = 0; j < n; j++) dp[m-1][j] = 1; \n        for (int i = m-2; i >= 0; i--) {\n            for (int j = n-2; j >= 0; j--) {\n                dp[i][j] = dp[i+1][j] + dp[i][j+1];\n            }\n        }\n        int i = 0;\n        int j = 0;\n        StringBuilder sb = new StringBuilder();\n        while (i < m-1 && j < n-1) {\n            if (k <= dp[i][j+1]) {\n                j++;\n                sb.append(\'H\');\n            } \n            else {\n                k -= dp[i][j+1];\n                i++;\n                sb.append(\'V\');\n            }\n        }\n        for (; i < m-1; i++) sb.append(\'V\');\n        for (; j < n-1; j++) sb.append(\'H\');\n        return sb.toString();\n    }\n}\n```\n
['C++', 'Java', 'Python3']