Kth Smallest Instructions
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\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)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * @param {number[]} destination\n * @param {number} k\n * @return {string}\n */\nfunction kthSmallestPath(destination, k) {\n    let hCount = destination[1];\n    let vCount = destination[0];\n    let result = "";\n\n    // Calculate the number of paths that start with \'H\' and \'V\' respectively\n    const pathsStartingWithH = binomialCoefficient(hCount + vCount - 1, vCount);\n    const pathsStartingWithV = binomialCoefficient(hCount + vCount - 1, hCount);\n\n    // Determine whether kth smallest path starts with \'H\' or \'V\'\n    if (k <= pathsStartingWithH) {\n        result += \'H\';\n        hCount--;\n    } else {\n        result += \'V\';\n        vCount--;\n        k -= pathsStartingWithH;\n    }\n\n    // Calculate the subsequent characters of the kth smallest path\n    for (let i = 1; i < destination[0] + destination[1]; i++) {\n        const pathsStartingHereWithH = binomialCoefficient(hCount + vCount - 1, vCount);\n        if (k <= pathsStartingHereWithH) {\n            result += \'H\';\n            hCount--;\n        } else {\n            result += \'V\';\n            vCount--;\n            k -= pathsStartingHereWithH;\n        }\n    }\n\n    return result;\n}\n\n// Function to calculate binomial coefficient (n choose k)\nfunction binomialCoefficient(n, k) {\n    let result = 1;\n    for (let i = 1; i <= k; i++) {\n        result *= (n - i + 1) / i;\n    }\n    return Math.round(result);\n}\n```
['JavaScript']