c++ || No Math
\n//idea\n  we calculate the no of ways of reaching the dest from each point in\n  advance , how?\n  let goal (n,m)  let put distance in dp[][] matrix;\n  obviu
```\n//idea\n  we calculate the no of ways of reaching the dest from each point in\n  advance , how?\n  let goal (n,m)  let put distance in dp[][] matrix;\n  obviuosly dp[n][m] = 0; \n  other base cases if(i == n || j == m) means we can\'t move down / we can\'t move right\n  so ,dp[i][j] = 1; for all these , i.e; there is only one way to reach goal.\n  o.w. if we are at i ,j we have dp[i][j] = dp[i+1][j] + dp[i][j+1] ways\n  \n  that\'s precomputation done , now we can move according to following:-\n  1) if our k < total horizontal move we will moving this way\n  2) if not , then we need to move verticaly down and also need to update k as k = k- horzizontal ways\n```\n\n```\n string kthSmallestPath(vector<int>& dest, int k) {\n        int n = dest[0]+1 , m = dest[1]+1;\n        int dp[n][m];\n        dp[n-1][m-1] = 0;\n        \n        for(int i=n-2;i>=0;i--) dp[i][m-1] = 1;\n        for(int i=m-2;i>=0;i--) dp[n-1][i] = 1;\n        \n        for(int i=n-2;i>=0;i--)\n        {\n            for(int j=m-2;j>=0;j--)\n            {\n                dp[i][j] = dp[i+1][j] + dp[i][j+1];\n            }\n        }\n        \n        string ans;\n        int i = 0, j =0;\n        while(i<n && j < m)\n        {\n             if(i+1 == n && j+1 == m) break;\n                \n                if(i+1 == n)\n                {\n                    ans += \'H\';\n                    j++;\n                }\n                else if(j+1 == m)\n                {\n                    ans += \'V\';\n                    i++;\n                }\n                else\n                {\n                    if(k <= dp[i][j+1])\n                    {\n                        ans += \'H\';\n                        j++;\n                    }\n                    else\n                    {\n                        ans += \'V\';\n                        k -= dp[i][j+1];\n                        i++;\n                    }\n                }\n        }\n       \n        return ans;\n    }\n```
['C++']