[C++] simple solution
destination[0] and destination[1] denote respectively the number of "V" requiredV and that of "H" requiredH contained in the final answer.\n\nLet n be the lengt
destination[0] and destination[1] denote respectively the number of "V" `requiredV` and that of "H" `requiredH` contained in the final answer.\n\nLet `n` be the length of the whole string (`n = requiredV + requiredH`)\n\nWe determine bit by bit from left to right which ("H" or "V") should be there.\nInitially we consider the 1st bit. If the 1st bit is "V", then the whole string would look like `V...`. There are `nCr(n - 1, requiredV)` many strings that are "smaller" than the string starting with a `V` in dictionary order.\nTherefore, if `k > nCr(n - 1, requiredV)`, we should set the 1st bit as `V`. Otherwise we set the 1st bit as `H`.\nThen we repeat this process until the whole string is determined.\n```\nclass Solution {\nprivate:\n    int choose(int n, int r) {\n        long ans = 1;\n        for (int i = 1, j = n - r + 1; i <= r; ++i, ++j) ans = ans * j / i;\n        return ans;\n    }\npublic:\n    string kthSmallestPath(vector<int>& destination, int k) {\n        int requiredV = destination[0], requiredH = destination[1];\n        \n        string ans = "";\n        for(int i = 1; i <= destination[0] + destination[1]; i++){\n            int combinations = choose(requiredV + requiredH - 1, requiredV);\n            if(k > combinations) {\n                k -= combinations;\n                ans += "V";\n                requiredV--;\n            }else{\n                ans += "H";\n                requiredH--;\n            }\n        }\n        return ans;\n    }\n};\n```
[]