Solution 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```\nclass Solution {\n    private function comb($n, $r) {\n        $ans = 1;\n        for ($i = 1, $j = $n - $r + 1; $i <= $r; ++$i, ++$j) {\n            $ans = $ans * $j / $i;\n        }\n        return $ans;\n    }\n\n    public function kthSmallestPath($A, $k) {\n        $h = $A[1];\n        $v = $A[0];\n        $N = $h + $v;\n        $s = \'\';\n\n        for ($i = 0; $i < $N; ++$i) {\n            if ($h) { \n                $c = $this->comb($h - 1 + $v, $v); \n                if ($k <= $c) { \n                    $s .= \'H\';\n                    --$h;\n                } else { \n                    $k -= $c;\n                    $s .= \'V\';\n                    --$v;\n                }\n            } else { \n                $s .= \'V\';\n                --$v;\n            }\n        }\n\n        return $s;\n    }\n}\n\n```
['PHP']