Python solution using Combinatorics
Intuition\n* https://leetcode.ca/2020-05-30-1643-Kth-Smallest-Instructions/\n\nThe result string will have h + v characters\nSince the problem always has an ans
# Intuition\n* https://leetcode.ca/2020-05-30-1643-Kth-Smallest-Instructions/\n\nThe result string will have `h + v` characters\nSince the problem always has an answer we know:\n`comb(h+v, h) >= k`\n\n\'H\' is lexicographically smaller than \'V\'\n\nFor each iteration we will assume we have append \'H\' to `res`\nSo now we need to place `h-1` \'H\' in `h+v-1` places\nWe will check if this could lead to an answer\n\n`x = comb(h+v-1, h-1)`\n`if x < k`: does not lead to answer, so append \'V\'\n`else`: append \'H\' and continue\n\n# Complexity\n- Time complexity: $O(n^2)$\n- Space complexity: $O(n)$\n\n# Code\n```py\nclass Solution:\n    def kthSmallestPath(self, destination: List[int], k: int) -> str:\n        v, h = destination\n        res = ""\n        for _ in range(h + v):\n            if h == 0: res += "V"\n            else:\n                x = math.comb(h + v - 1, h - 1)\n                if k > x:\n                    res += "V"\n                    v -= 1\n                    k -= x\n                else:\n                    res += "H"\n                    h -= 1\n        return res\n```
['Python3']