💥💥Runtime beats 99.32%, Memory beats 93.88%
Intuition\nFind the kth smallest path on a grid using only right (\'H\') and down (\'V\') moves by leveraging combinatorics to avoid generating all paths.\n\n# 
# Intuition\nFind the kth smallest path on a grid using only right (\'H\') and down (\'V\') moves by leveraging combinatorics to avoid generating all paths.\n\n# Approach\nCount Paths: Use combinations to determine how many paths start with \'H\' or \'V\'.\n\nBuild Path: Iteratively choose \'H\' or \'V\' based on the counts and adjust k accordingly.\n\n# Complexity\n- Time complexity:\nO(n) where n is the sum of rows and columns.\n\n- Space complexity:\nO(n) for storing the path.\n\n# Code\n```python3 []\nfrom math import comb\n\nclass Solution:\n    def kthSmallestPath(self, destination: list[int], k: int) -> str:\n        rows, cols = destination\n        path = []\n        k -= 1  # Convert k to 0-indexed\n\n        while rows > 0 or cols > 0:\n            # Number of paths starting with \'H\'\n            if cols > 0:\n                paths_with_H = comb(rows + cols - 1, cols - 1)\n            else:\n                paths_with_H = 0\n\n            if k < paths_with_H:\n                path.append(\'H\')\n                cols -= 1\n            else:\n                path.append(\'V\')\n                k -= paths_with_H\n                rows -= 1\n        \n        return \'\'.join(path)\n\n```
['Python3']